X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=ext%2FDynaLoader%2Fdl_aix.xs;h=ea6de7b19838ed4a5742414e61866bec55cb89ec;hb=ef7e80c4ffb0d80daa17dc6be88a4595251bdd51;hp=c3f2c119f113c989a19ffd9ca3e830981a2f347b;hpb=cdc73a103e56840003cb817a381323974e4b9832;p=p5sagit%2Fp5-mst-13.2.git diff --git a/ext/DynaLoader/dl_aix.xs b/ext/DynaLoader/dl_aix.xs index c3f2c11..ea6de7b 100644 --- a/ext/DynaLoader/dl_aix.xs +++ b/ext/DynaLoader/dl_aix.xs @@ -26,6 +26,8 @@ #include "XSUB.h" #include +#include "dlutils.c" /* SaveError() etc */ + #else /* @@ -177,26 +179,13 @@ char *strerrorcat(char *str, int err) { int msgsiz; char *msg; -#ifdef USE_5005THREADS - char *buf = malloc(BUFSIZ); - - if (buf == 0) - return 0; - if (strerror_r(err, buf, BUFSIZ) == 0) - msg = buf; - else - msg = strerror_r_failed; - msgsiz = strlen(msg); - if (strsiz + msgsiz < BUFSIZ) - strcat(str, msg); - free(buf); -#else + dTHX; + if ((msg = strerror(err)) == 0) msg = strerror_failed; msgsiz = strlen(msg); /* Note msg = buf and free() above. */ if (strsiz + msgsiz < BUFSIZ) /* Do not move this after #endif. */ strcat(str, msg); -#endif return str; } @@ -205,26 +194,13 @@ char *strerrorcpy(char *str, int err) { int msgsiz; char *msg; -#ifdef USE_5005THREADS - char *buf = malloc(BUFSIZ); - - if (buf == 0) - return 0; - if (strerror_r(err, buf, BUFSIZ) == 0) - msg = buf; - else - msg = strerror_r_failed; - msgsiz = strlen(msg); - if (msgsiz < BUFSIZ) - strcpy(str, msg); - free(buf); -#else + dTHX; + if ((msg = strerror(err)) == 0) msg = strerror_failed; msgsiz = strlen(msg); /* Note msg = buf and free() above. */ if (msgsiz < BUFSIZ) /* Do not move this after #endif. */ strcpy(str, msg); -#endif return str; } @@ -252,7 +228,7 @@ void *dlopen(char *path, int mode) mp->refCnt++; return mp; } - Newz(1000,mp,1,Module); + Newxz(mp,1,Module); if (mp == NULL) { dl_errvalid++; strcpy(dl_errbuf, "Newz: "); @@ -592,7 +568,7 @@ static int readExports(ModulePtr mp) continue; mp->nExports++; } - Newz(1001, mp->exports, mp->nExports, Export); + Newxz(mp->exports, mp->nExports, Export); if (mp->exports == NULL) { dl_errvalid++; strcpy(dl_errbuf, "readExports: ");