From: Craig A. Berry Date: Thu, 5 Mar 2009 23:28:13 +0000 (-0600) Subject: In dl_vms.xs, treat dl_last_error like the SV that it is. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ec6cc21dee082f68c9c168d6e9b7712a5e7e7ccf;p=p5sagit%2Fp5-mst-13.2.git In dl_vms.xs, treat dl_last_error like the SV that it is. We apparently missed the memo back at 591022fb18ce8ae85902133bbbfe8e1de05216b1. --- diff --git a/ext/DynaLoader/dl_vms.xs b/ext/DynaLoader/dl_vms.xs index 6ebcd9b..5eb0d07 100644 --- a/ext/DynaLoader/dl_vms.xs +++ b/ext/DynaLoader/dl_vms.xs @@ -99,20 +99,10 @@ copy_errmsg(msg,unused) dTHX; dMY_CXT; if (*(msg->dsc$a_pointer) == '%') { /* first line */ - if (dl_last_error) - strncpy((dl_last_error = saferealloc(dl_last_error,msg->dsc$w_length+1)), - msg->dsc$a_pointer, msg->dsc$w_length); - else - strncpy((dl_last_error = safemalloc(msg->dsc$w_length+1)), - msg->dsc$a_pointer, msg->dsc$w_length); - dl_last_error[msg->dsc$w_length] = '\0'; + sv_setpvn(MY_CXT.x_dl_last_error, msg->dsc$a_pointer, (STRLEN)msg->dsc$w_length); } else { /* continuation line */ - int errlen = strlen(dl_last_error); - dl_last_error = saferealloc(dl_last_error, errlen + msg->dsc$w_length + 2); - dl_last_error[errlen] = '\n'; dl_last_error[errlen+1] = '\0'; - strncat(dl_last_error, msg->dsc$a_pointer, msg->dsc$w_length); - dl_last_error[errlen+msg->dsc$w_length+1] = '\0'; + sv_catpvn(MY_CXT.x_dl_last_error, msg->dsc$a_pointer, (STRLEN)msg->dsc$w_length); } DLDEBUG(2,PerlIO_printf(Perl_debug_log, "Saved error message: %s\n", dl_last_error)); return 0;