Index: perlconfig.c
===================================================================
--- perlconfig.c	(revision 5b37c063d5a6a7a9fdfe3cde5a21e30d94beee7b)
+++ perlconfig.c	(revision 3ea31b6aee25c06dc9ca8af933d4d920eaf112c4)
@@ -44,6 +44,6 @@
   h = newHV();
 
-#define MSG2H(h,field) hv_store(h, #field, strlen(#field), \
-			      newSVpv(owl_message_get_##field(m),0), 0)
+#define MSG2H(h,field) (void)hv_store(h, #field, strlen(#field),        \
+                                      newSVpv(owl_message_get_##field(m),0), 0)
 
   if (owl_message_is_type_zephyr(m)
@@ -59,8 +59,8 @@
       owl_free(ptr);
     }
-    hv_store(h, "fields", strlen("fields"), newRV_noinc((SV*)av_zfields), 0);
-
-    hv_store(h, "auth", strlen("auth"), 
-	     newSVpv(owl_zephyr_get_authstr(owl_message_get_notice(m)),0),0);
+    (void)hv_store(h, "fields", strlen("fields"), newRV_noinc((SV*)av_zfields), 0);
+
+    (void)hv_store(h, "auth", strlen("auth"), 
+                   newSVpv(owl_zephyr_get_authstr(owl_message_get_notice(m)),0),0);
   }
 
@@ -68,6 +68,6 @@
   for(i=0; i<j; i++) {
     pair=owl_list_get_element(&(m->attributes), i);
-    hv_store(h, owl_pair_get_key(pair), strlen(owl_pair_get_key(pair)),
-	     newSVpv(owl_pair_get_value(pair),0),0);
+    (void)hv_store(h, owl_pair_get_key(pair), strlen(owl_pair_get_key(pair)),
+                   newSVpv(owl_pair_get_value(pair),0),0);
   }
   
@@ -88,11 +88,11 @@
     MSG2H(h, header); 
   }
-  hv_store(h, "time", strlen("time"), newSVpv(owl_message_get_timestr(m),0),0);
-  hv_store(h, "id", strlen("id"), newSViv(owl_message_get_id(m)),0);
-  hv_store(h, "deleted", strlen("deleted"), newSViv(owl_message_is_delete(m)),0);
-  hv_store(h, "private", strlen("private"), newSViv(owl_message_is_private(m)),0);
-  hv_store(h, "should_wordwrap",
-	   strlen("should_wordwrap"), newSViv(
-					      owl_filter_message_match(wrap, m)),0);
+  (void)hv_store(h, "time", strlen("time"), newSVpv(owl_message_get_timestr(m),0),0);
+  (void)hv_store(h, "id", strlen("id"), newSViv(owl_message_get_id(m)),0);
+  (void)hv_store(h, "deleted", strlen("deleted"), newSViv(owl_message_is_delete(m)),0);
+  (void)hv_store(h, "private", strlen("private"), newSViv(owl_message_is_private(m)),0);
+  (void)hv_store(h, "should_wordwrap",
+                 strlen("should_wordwrap"), newSViv(
+                                                    owl_filter_message_match(wrap, m)),0);
 
   type = owl_message_get_type(m);
@@ -102,5 +102,5 @@
   blessas = owl_sprintf("BarnOwl::Message::%s", type);
 
-  hr = sv_2mortal(newRV_noinc((SV*)h));
+  hr = newRV_noinc((SV*)h);
   stash =  gv_stashpv(blessas,0);
   if(!stash) {
@@ -182,7 +182,6 @@
   dSP ;
   int count;
-  unsigned int len;
   SV *msgref, *srv;
-  char *out, *preout;
+  char *out;
   
   ENTER ;
@@ -191,5 +190,5 @@
   PUSHMARK(SP) ;
   msgref = owl_perlconfig_message2hashref(m);
-  XPUSHs(msgref);
+  XPUSHs(sv_2mortal(msgref));
   PUTBACK ;
   
@@ -199,6 +198,5 @@
 
   if (SvTRUE(ERRSV)) {
-    STRLEN n_a;
-    owl_function_error("Perl Error: '%s'", SvPV(ERRSV, n_a));
+    owl_function_error("Perl Error: '%s'", SvPV_nolen(ERRSV));
     /* and clear the error */
     sv_setsv (ERRSV, &PL_sv_undef);
@@ -213,8 +211,5 @@
 
   if (srv) {
-    preout=SvPV(srv, len);
-    out = owl_malloc(strlen(preout)+1);
-    strncpy(out, preout, len);
-    out[len] = '\0';
+    out = owl_strdup(SvPV_nolen(srv));
   } else {
     out = NULL;
@@ -235,7 +230,7 @@
 {
   dSP;
-  unsigned int count, len, i;
+  unsigned int count, i;
   SV *msgref, *srv;
-  char *out, *preout;
+  char *out;
 
   msgref = owl_perlconfig_message2hashref(m);
@@ -245,5 +240,5 @@
 
   PUSHMARK(SP);
-  XPUSHs(msgref);
+  XPUSHs(sv_2mortal(msgref));
   for(i=0;i<argc;i++) {
     XPUSHs(sv_2mortal(newSVpv(argv[i], 0)));
@@ -261,6 +256,5 @@
 
   if (SvTRUE(ERRSV)) {
-    STRLEN n_a;
-    owl_function_error("Error: '%s'", SvPV(ERRSV, n_a));
+    owl_function_error("Error: '%s'", SvPV_nolen(ERRSV));
     /* and clear the error */
     sv_setsv (ERRSV, &PL_sv_undef);
@@ -270,8 +264,5 @@
 
   if (srv) {
-    preout=SvPV(srv, len);
-    out = owl_malloc(strlen(preout)+1);
-    strncpy(out, preout, len);
-    out[len] = '\0';
+    out = owl_strdup(SvPV_nolen(srv));
   } else {
     out = NULL;
@@ -286,5 +277,5 @@
 
 
-char *owl_perlconfig_initperl(char * file, int *Pargc, char ***Pargv, char *** Penv)
+char *owl_perlconfig_initperl(char * file)
 {
   int ret;
@@ -294,5 +285,4 @@
 
   /* create and initialize interpreter */
-  PERL_SYS_INIT3(Pargc, Pargv, Penv);
   p=perl_alloc();
   owl_global_set_perlinterp(&g, (void*)p);
@@ -304,6 +294,5 @@
   ret=perl_parse(p, owl_perl_xs_init, 2, args, NULL);
   if (ret || SvTRUE(ERRSV)) {
-    STRLEN n_a;
-    err=owl_strdup(SvPV(ERRSV, n_a));
+    err=owl_strdup(SvPV_nolen(ERRSV));
     sv_setsv(ERRSV, &PL_sv_undef);     /* and clear the error */
     return(err);
@@ -312,6 +301,5 @@
   ret=perl_run(p);
   if (ret || SvTRUE(ERRSV)) {
-    STRLEN n_a;
-    err=owl_strdup(SvPV(ERRSV, n_a));
+    err=owl_strdup(SvPV_nolen(ERRSV));
     sv_setsv(ERRSV, &PL_sv_undef);     /* and clear the error */
     return(err);
@@ -342,6 +330,5 @@
 
   if (SvTRUE(ERRSV)) {
-    STRLEN n_a;
-    err=owl_strdup(SvPV(ERRSV, n_a));
+    err=owl_strdup(SvPV_nolen(ERRSV));
     sv_setsv (ERRSV, &PL_sv_undef);     /* and clear the error */
     return(err);
@@ -396,17 +383,13 @@
 
   if (SvTRUE(ERRSV)) {
-    STRLEN n_a;
-    owl_function_error("Perl Error: '%s'", SvPV(ERRSV, n_a));
+    owl_function_error("Perl Error: '%s'", SvPV_nolen(ERRSV));
     sv_setsv (ERRSV, &PL_sv_undef);     /* and clear the error */
   }
 
   preout=SvPV(response, len);
-  /* leave enough space in case we have to add a newline */
-  out = owl_malloc(strlen(preout)+2);
-  strncpy(out, preout, len);
-  out[len] = '\0';
-  if (!strlen(out) || out[strlen(out)-1]!='\n') {
-    strcat(out, "\n");
-  }
+  if (len == 0 || preout[len - 1] != '\n')
+    out = owl_sprintf("%s\n", preout);
+  else
+    out = owl_strdup(preout);
 
   return(out);
@@ -439,5 +422,4 @@
   char * ret = NULL;
   SV *rv;
-  STRLEN n_a;
   dSP;
 
@@ -458,5 +440,5 @@
 
   if(SvTRUE(ERRSV)) {
-    owl_function_error("%s", SvPV(ERRSV, n_a));
+    owl_function_error("%s", SvPV_nolen(ERRSV));
     (void)POPs;
   } else {
@@ -465,5 +447,5 @@
     rv = POPs;
     if(SvTRUE(rv)) {
-      ret = owl_strdup(SvPV(rv, n_a));
+      ret = owl_strdup(SvPV_nolen(rv));
     }
   }
@@ -489,5 +471,4 @@
   SV *cb = (SV*)(e->cbdata);
   SV *text;
-  unsigned int n_a;
   dSP;
 
@@ -508,5 +489,5 @@
 
   if(SvTRUE(ERRSV)) {
-    owl_function_error("%s", SvPV(ERRSV, n_a));
+    owl_function_error("%s", SvPV_nolen(ERRSV));
   }
 
@@ -526,6 +507,5 @@
   call_pv("BarnOwl::Hooks::_mainloop_hook", G_DISCARD|G_EVAL);
   if(SvTRUE(ERRSV)) {
-    STRLEN n_a;
-    owl_function_error("%s", SvPV(ERRSV, n_a));
+    owl_function_error("%s", SvPV_nolen(ERRSV));
   }
   return;
@@ -535,5 +515,4 @@
 {
   SV *cb = d->pfunc;
-  unsigned int n_a;
   dSP;
   if(cb == NULL) {
@@ -550,5 +529,5 @@
 
   if(SvTRUE(ERRSV)) {
-    owl_function_error("%s", SvPV(ERRSV, n_a));
+    owl_function_error("%s", SvPV_nolen(ERRSV));
   }
 
