Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perlconfig.c

    r5b37c063 r3ea31b6  
    4444  h = newHV();
    4545
    46 #define MSG2H(h,field) hv_store(h, #field, strlen(#field), \
    47                               newSVpv(owl_message_get_##field(m),0), 0)
     46#define MSG2H(h,field) (void)hv_store(h, #field, strlen(#field),        \
     47                                      newSVpv(owl_message_get_##field(m),0), 0)
    4848
    4949  if (owl_message_is_type_zephyr(m)
     
    5959      owl_free(ptr);
    6060    }
    61     hv_store(h, "fields", strlen("fields"), newRV_noinc((SV*)av_zfields), 0);
    62 
    63     hv_store(h, "auth", strlen("auth"),
    64              newSVpv(owl_zephyr_get_authstr(owl_message_get_notice(m)),0),0);
     61    (void)hv_store(h, "fields", strlen("fields"), newRV_noinc((SV*)av_zfields), 0);
     62
     63    (void)hv_store(h, "auth", strlen("auth"),
     64                   newSVpv(owl_zephyr_get_authstr(owl_message_get_notice(m)),0),0);
    6565  }
    6666
     
    6868  for(i=0; i<j; i++) {
    6969    pair=owl_list_get_element(&(m->attributes), i);
    70     hv_store(h, owl_pair_get_key(pair), strlen(owl_pair_get_key(pair)),
    71              newSVpv(owl_pair_get_value(pair),0),0);
     70    (void)hv_store(h, owl_pair_get_key(pair), strlen(owl_pair_get_key(pair)),
     71                   newSVpv(owl_pair_get_value(pair),0),0);
    7272  }
    7373 
     
    8888    MSG2H(h, header);
    8989  }
    90   hv_store(h, "time", strlen("time"), newSVpv(owl_message_get_timestr(m),0),0);
    91   hv_store(h, "id", strlen("id"), newSViv(owl_message_get_id(m)),0);
    92   hv_store(h, "deleted", strlen("deleted"), newSViv(owl_message_is_delete(m)),0);
    93   hv_store(h, "private", strlen("private"), newSViv(owl_message_is_private(m)),0);
    94   hv_store(h, "should_wordwrap",
    95            strlen("should_wordwrap"), newSViv(
    96                                               owl_filter_message_match(wrap, m)),0);
     90  (void)hv_store(h, "time", strlen("time"), newSVpv(owl_message_get_timestr(m),0),0);
     91  (void)hv_store(h, "id", strlen("id"), newSViv(owl_message_get_id(m)),0);
     92  (void)hv_store(h, "deleted", strlen("deleted"), newSViv(owl_message_is_delete(m)),0);
     93  (void)hv_store(h, "private", strlen("private"), newSViv(owl_message_is_private(m)),0);
     94  (void)hv_store(h, "should_wordwrap",
     95                 strlen("should_wordwrap"), newSViv(
     96                                                    owl_filter_message_match(wrap, m)),0);
    9797
    9898  type = owl_message_get_type(m);
     
    102102  blessas = owl_sprintf("BarnOwl::Message::%s", type);
    103103
    104   hr = sv_2mortal(newRV_noinc((SV*)h));
     104  hr = newRV_noinc((SV*)h);
    105105  stash =  gv_stashpv(blessas,0);
    106106  if(!stash) {
     
    182182  dSP ;
    183183  int count;
    184   unsigned int len;
    185184  SV *msgref, *srv;
    186   char *out, *preout;
     185  char *out;
    187186 
    188187  ENTER ;
     
    191190  PUSHMARK(SP) ;
    192191  msgref = owl_perlconfig_message2hashref(m);
    193   XPUSHs(msgref);
     192  XPUSHs(sv_2mortal(msgref));
    194193  PUTBACK ;
    195194 
     
    199198
    200199  if (SvTRUE(ERRSV)) {
    201     STRLEN n_a;
    202     owl_function_error("Perl Error: '%s'", SvPV(ERRSV, n_a));
     200    owl_function_error("Perl Error: '%s'", SvPV_nolen(ERRSV));
    203201    /* and clear the error */
    204202    sv_setsv (ERRSV, &PL_sv_undef);
     
    213211
    214212  if (srv) {
    215     preout=SvPV(srv, len);
    216     out = owl_malloc(strlen(preout)+1);
    217     strncpy(out, preout, len);
    218     out[len] = '\0';
     213    out = owl_strdup(SvPV_nolen(srv));
    219214  } else {
    220215    out = NULL;
     
    235230{
    236231  dSP;
    237   unsigned int count, len, i;
     232  unsigned int count, i;
    238233  SV *msgref, *srv;
    239   char *out, *preout;
     234  char *out;
    240235
    241236  msgref = owl_perlconfig_message2hashref(m);
     
    245240
    246241  PUSHMARK(SP);
    247   XPUSHs(msgref);
     242  XPUSHs(sv_2mortal(msgref));
    248243  for(i=0;i<argc;i++) {
    249244    XPUSHs(sv_2mortal(newSVpv(argv[i], 0)));
     
    261256
    262257  if (SvTRUE(ERRSV)) {
    263     STRLEN n_a;
    264     owl_function_error("Error: '%s'", SvPV(ERRSV, n_a));
     258    owl_function_error("Error: '%s'", SvPV_nolen(ERRSV));
    265259    /* and clear the error */
    266260    sv_setsv (ERRSV, &PL_sv_undef);
     
    270264
    271265  if (srv) {
    272     preout=SvPV(srv, len);
    273     out = owl_malloc(strlen(preout)+1);
    274     strncpy(out, preout, len);
    275     out[len] = '\0';
     266    out = owl_strdup(SvPV_nolen(srv));
    276267  } else {
    277268    out = NULL;
     
    286277
    287278
    288 char *owl_perlconfig_initperl(char * file, int *Pargc, char ***Pargv, char *** Penv)
     279char *owl_perlconfig_initperl(char * file)
    289280{
    290281  int ret;
     
    294285
    295286  /* create and initialize interpreter */
    296   PERL_SYS_INIT3(Pargc, Pargv, Penv);
    297287  p=perl_alloc();
    298288  owl_global_set_perlinterp(&g, (void*)p);
     
    304294  ret=perl_parse(p, owl_perl_xs_init, 2, args, NULL);
    305295  if (ret || SvTRUE(ERRSV)) {
    306     STRLEN n_a;
    307     err=owl_strdup(SvPV(ERRSV, n_a));
     296    err=owl_strdup(SvPV_nolen(ERRSV));
    308297    sv_setsv(ERRSV, &PL_sv_undef);     /* and clear the error */
    309298    return(err);
     
    312301  ret=perl_run(p);
    313302  if (ret || SvTRUE(ERRSV)) {
    314     STRLEN n_a;
    315     err=owl_strdup(SvPV(ERRSV, n_a));
     303    err=owl_strdup(SvPV_nolen(ERRSV));
    316304    sv_setsv(ERRSV, &PL_sv_undef);     /* and clear the error */
    317305    return(err);
     
    342330
    343331  if (SvTRUE(ERRSV)) {
    344     STRLEN n_a;
    345     err=owl_strdup(SvPV(ERRSV, n_a));
     332    err=owl_strdup(SvPV_nolen(ERRSV));
    346333    sv_setsv (ERRSV, &PL_sv_undef);     /* and clear the error */
    347334    return(err);
     
    396383
    397384  if (SvTRUE(ERRSV)) {
    398     STRLEN n_a;
    399     owl_function_error("Perl Error: '%s'", SvPV(ERRSV, n_a));
     385    owl_function_error("Perl Error: '%s'", SvPV_nolen(ERRSV));
    400386    sv_setsv (ERRSV, &PL_sv_undef);     /* and clear the error */
    401387  }
    402388
    403389  preout=SvPV(response, len);
    404   /* leave enough space in case we have to add a newline */
    405   out = owl_malloc(strlen(preout)+2);
    406   strncpy(out, preout, len);
    407   out[len] = '\0';
    408   if (!strlen(out) || out[strlen(out)-1]!='\n') {
    409     strcat(out, "\n");
    410   }
     390  if (len == 0 || preout[len - 1] != '\n')
     391    out = owl_sprintf("%s\n", preout);
     392  else
     393    out = owl_strdup(preout);
    411394
    412395  return(out);
     
    439422  char * ret = NULL;
    440423  SV *rv;
    441   STRLEN n_a;
    442424  dSP;
    443425
     
    458440
    459441  if(SvTRUE(ERRSV)) {
    460     owl_function_error("%s", SvPV(ERRSV, n_a));
     442    owl_function_error("%s", SvPV_nolen(ERRSV));
    461443    (void)POPs;
    462444  } else {
     
    465447    rv = POPs;
    466448    if(SvTRUE(rv)) {
    467       ret = owl_strdup(SvPV(rv, n_a));
     449      ret = owl_strdup(SvPV_nolen(rv));
    468450    }
    469451  }
     
    489471  SV *cb = (SV*)(e->cbdata);
    490472  SV *text;
    491   unsigned int n_a;
    492473  dSP;
    493474
     
    508489
    509490  if(SvTRUE(ERRSV)) {
    510     owl_function_error("%s", SvPV(ERRSV, n_a));
     491    owl_function_error("%s", SvPV_nolen(ERRSV));
    511492  }
    512493
     
    526507  call_pv("BarnOwl::Hooks::_mainloop_hook", G_DISCARD|G_EVAL);
    527508  if(SvTRUE(ERRSV)) {
    528     STRLEN n_a;
    529     owl_function_error("%s", SvPV(ERRSV, n_a));
     509    owl_function_error("%s", SvPV_nolen(ERRSV));
    530510  }
    531511  return;
     
    535515{
    536516  SV *cb = d->pfunc;
    537   unsigned int n_a;
    538517  dSP;
    539518  if(cb == NULL) {
     
    550529
    551530  if(SvTRUE(ERRSV)) {
    552     owl_function_error("%s", SvPV(ERRSV, n_a));
     531    owl_function_error("%s", SvPV_nolen(ERRSV));
    553532  }
    554533
Note: See TracChangeset for help on using the changeset viewer.