Changeset d1b1cf6 for perlconfig.c
- Timestamp:
- Aug 28, 2009, 12:09:07 AM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- ec21c62
- Parents:
- 0571c30
- git-author:
- Nelson Elhage <nelhage@mit.edu> (08/26/09 23:49:26)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (08/28/09 00:09:07)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perlconfig.c
rdbe8729 rd1b1cf6 22 22 } 23 23 24 25 SV *owl_new_sv(const char * str) 26 { 27 SV *ret = newSVpv(str, 0); 28 if(is_utf8_string(str, strlen(str))) { 29 SvUTF8_on(ret); 30 } else { 31 owl_function_error("Internal error! Non-UTF-8 string encountered:\n%s", str); 32 } 33 return ret; 34 } 35 24 36 SV *owl_perlconfig_message2hashref(const owl_message *m) 25 37 { … … 42 54 43 55 #define MSG2H(h,field) (void)hv_store(h, #field, strlen(#field), \ 44 newSVpv(owl_message_get_##field(m),0), 0)56 owl_new_sv(owl_message_get_##field(m)), 0) 45 57 46 58 if (owl_message_is_type_zephyr(m) … … 53 65 for (i=0; i<j; i++) { 54 66 ptr=owl_zephyr_get_field_as_utf8(owl_message_get_notice(m), i+1); 55 av_push(av_zfields, newSVpvn(ptr, strlen(ptr)));67 av_push(av_zfields, owl_new_sv(ptr)); 56 68 owl_free(ptr); 57 69 } … … 59 71 60 72 (void)hv_store(h, "auth", strlen("auth"), 61 newSVpv(owl_zephyr_get_authstr(owl_message_get_notice(m)),0),0);73 owl_new_sv(owl_zephyr_get_authstr(owl_message_get_notice(m))),0); 62 74 } 63 75 … … 66 78 pair=owl_list_get_element(&(m->attributes), i); 67 79 (void)hv_store(h, owl_pair_get_key(pair), strlen(owl_pair_get_key(pair)), 68 newSVpv(owl_pair_get_value(pair),0),0);80 owl_new_sv(owl_pair_get_value(pair)),0); 69 81 } 70 82 … … 85 97 MSG2H(h, header); 86 98 } 87 (void)hv_store(h, "time", strlen("time"), newSVpv(owl_message_get_timestr(m),0),0);99 (void)hv_store(h, "time", strlen("time"), owl_new_sv(owl_message_get_timestr(m)),0); 88 100 (void)hv_store(h, "unix_time", strlen("unix_time"), newSViv(m->time), 0); 89 101 (void)hv_store(h, "id", strlen("id"), newSViv(owl_message_get_id(m)),0); … … 261 273 XPUSHs(sv_2mortal(msgref)); 262 274 for(i=0;i<argc;i++) { 263 XPUSHs(sv_2mortal( newSVpv(argv[i], 0)));275 XPUSHs(sv_2mortal(owl_new_sv(argv[i]))); 264 276 } 265 277 PUTBACK; … … 352 364 path = owl_sprintf("%s/lib", owl_get_datadir()); 353 365 av_unshift(inc, 1); 354 av_store(inc, 0, newSVpv(path, 0));366 av_store(inc, 0, owl_new_sv(path)); 355 367 owl_free(path); 356 368 … … 437 449 438 450 PUSHMARK(SP); 439 XPUSHs(sv_2mortal( newSVpv(name, 0)));451 XPUSHs(sv_2mortal(owl_new_sv(name))); 440 452 PUTBACK; 441 453 … … 464 476 PUSHMARK(SP); 465 477 for(i=0;i<argc;i++) { 466 SV *tmp = newSVpv(argv[i], 0); 467 SvUTF8_on(tmp); 468 XPUSHs(sv_2mortal(tmp)); 478 XPUSHs(sv_2mortal(owl_new_sv(argv[i]))); 469 479 } 470 480 PUTBACK; … … 512 522 owl_function_error("Perl callback is NULL!"); 513 523 } 514 text = newSVpv(owl_editwin_get_text(e), 0); 515 SvUTF8_on(text); 524 text = owl_new_sv(owl_editwin_get_text(e)); 516 525 517 526 ENTER;
Note: See TracChangeset
for help on using the changeset viewer.