about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2010-09-29 21:45:56 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2010-09-29 21:45:56 +0000
commit28ed9cda2a47c17130ee5b97588695ed3acb4e45 (patch)
tree8de89d205b94221a7941177f365f0e05c0fad039 /lib
parentc1b82fa06e7e88a68c877c501fc0422888920415 (diff)
downloadnetpbm-mirror-28ed9cda2a47c17130ee5b97588695ed3acb4e45.tar.gz
netpbm-mirror-28ed9cda2a47c17130ee5b97588695ed3acb4e45.tar.xz
netpbm-mirror-28ed9cda2a47c17130ee5b97588695ed3acb4e45.zip
Rename nstring.h functions with pm_ prefix
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1320 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib')
-rw-r--r--lib/colorname.c2
-rw-r--r--lib/libpam.c6
-rw-r--r--lib/libpammap.c13
-rw-r--r--lib/libpamn.c17
-rw-r--r--lib/libpamread.c17
-rw-r--r--lib/libpbmfont.c18
-rw-r--r--lib/libpgm1.c14
-rw-r--r--lib/libpm.c32
-rw-r--r--lib/libppm1.c17
-rw-r--r--lib/libppmcmap.c28
-rw-r--r--lib/libppmcolor.c20
-rw-r--r--lib/pmfileio.c32
-rw-r--r--lib/util/filename.c2
-rw-r--r--lib/util/io.c13
-rw-r--r--lib/util/nstring.c78
-rw-r--r--lib/util/nstring.h56
-rw-r--r--lib/util/shhopt.c10
-rw-r--r--lib/util/token.c9
-rw-r--r--lib/util/vasprintf.c8
19 files changed, 198 insertions, 194 deletions
diff --git a/lib/colorname.c b/lib/colorname.c
index cfaf026a..20b000e6 100644
--- a/lib/colorname.c
+++ b/lib/colorname.c
@@ -65,7 +65,7 @@ openColornameFileSearch(const char * const searchPath,
         *filePP = NULL;  /* initial value */
         while (!eol && !*filePP) {
             const char * token;
-            token = strsepN(&cursor, ":");
+            token = pm_strsep(&cursor, ":");
             if (token) {
                 *filePP = fopen(token, "r");
             } else
diff --git a/lib/libpam.c b/lib/libpam.c
index 0afe65c0..51305e48 100644
--- a/lib/libpam.c
+++ b/lib/libpam.c
@@ -629,7 +629,7 @@ disposeOfComments(const struct pam * const pamP,
     if (retP)
         *retP = comments;
     else
-        strfree(comments);
+        pm_strfree(comments);
 }
 
 
@@ -672,7 +672,7 @@ readpaminitrest(struct pam * const pamP) {
             buffer[256-1-1] = '\n';  /* In case fgets() truncated */
             if (buffer[0] == '#')
                 appendComment(&comments, buffer);
-            else if (stripeq(buffer, ""));
+            else if (pm_stripeq(buffer, ""));
                 /* Ignore it; it's a blank line */
             else 
                 processHeaderLine(buffer, pamP, &headerSeen);
@@ -951,7 +951,7 @@ pnm_writepaminit(struct pam * const pamP) {
         fprintf(pamP->file, "HEIGHT %u\n",  (unsigned)pamP->height);
         fprintf(pamP->file, "DEPTH %u\n",   pamP->depth);
         fprintf(pamP->file, "MAXVAL %lu\n", pamP->maxval);
-        if (!stripeq(tupleType, ""))
+        if (!pm_stripeq(tupleType, ""))
             fprintf(pamP->file, "TUPLTYPE %s\n", pamP->tuple_type);
         fprintf(pamP->file, "ENDHDR\n");
         break;
diff --git a/lib/libpammap.c b/lib/libpammap.c
index 6fea0eb9..663fe3c5 100644
--- a/lib/libpammap.c
+++ b/lib/libpammap.c
@@ -407,7 +407,7 @@ alloctupletable(const struct pam * const pamP,
                 const char **      const errorP) {
     
     if (UINT_MAX / sizeof(struct tupleint) < size)
-        asprintfN(errorP, "size %u is too big for arithmetic", size);
+        pm_asprintf(errorP, "size %u is too big for arithmetic", size);
     else {
         unsigned int const mainTableSize = size * sizeof(struct tupleint *);
         unsigned int const tupleIntSize = 
@@ -419,7 +419,7 @@ alloctupletable(const struct pam * const pamP,
            as a single malloc block and suballocate internally.
         */
         if ((UINT_MAX - mainTableSize) / tupleIntSize < size)
-            asprintfN(errorP, "size %u is too big for arithmetic", size);
+            pm_asprintf(errorP, "size %u is too big for arithmetic", size);
         else {
             unsigned int const allocSize = mainTableSize + size * tupleIntSize;
             void * pool;
@@ -427,8 +427,9 @@ alloctupletable(const struct pam * const pamP,
             pool = malloc(allocSize);
 
             if (!pool)
-                asprintfN(errorP, "Unable to allocate %u bytes for a %u-entry "
-                          "tuple table", allocSize, size);
+                pm_asprintf(errorP,
+                            "Unable to allocate %u bytes for a %u-entry "
+                            "tuple table", allocSize, size);
             else {
                 tupletable const tbl = (tupletable) pool;
 
@@ -459,7 +460,7 @@ pnm_alloctupletable(const struct pam * const pamP,
 
     if (error) {
         pm_errormsg("%s", error);
-        strfree(error);
+        pm_strfree(error);
         pm_longjmp();
     }
     return retval;
@@ -514,7 +515,7 @@ tuplehashtotable(const struct pam * const pamP,
 
     if (error) {
         pm_errormsg("%s", error);
-        strfree(error);
+        pm_strfree(error);
         pm_longjmp();
     } else {
         unsigned int i, j;
diff --git a/lib/libpamn.c b/lib/libpamn.c
index 76a8bb6d..b4d5435c 100644
--- a/lib/libpamn.c
+++ b/lib/libpamn.c
@@ -40,9 +40,10 @@ allocpamrown(const struct pam * const pamP,
 
     tuplerown = malloc(pamP->width * (sizeof(tuplen *) + bytes_per_tuple));
     if (tuplerown == NULL)
-        asprintfN(&error, "Out of memory allocating space for a tuple row of"
-                  "%u tuples by %u samples per tuple by %u bytes per sample.",
-                  pamP->width, pamP->depth, (unsigned)sizeof(samplen));
+        pm_asprintf(&error, "Out of memory allocating space for a tuple row of"
+                    "%u tuples by %u samples per tuple "
+                    "by %u bytes per sample.",
+                    pamP->width, pamP->depth, (unsigned)sizeof(samplen));
     else {
         /* Now we initialize the pointers to the individual tuples to make this
            a regulation C two dimensional array.
@@ -78,7 +79,7 @@ pnm_allocpamrown(const struct pam * const pamP) {
 
     if (error) {
         pm_errormsg("pnm_allocpamrown() failed.  %s", error);
-        strfree(error);
+        pm_strfree(error);
         pm_longjmp();
     }
 
@@ -279,9 +280,9 @@ pnm_allocpamarrayn(const struct pam * const pamP) {
     
     MALLOCARRAY(tuplenarray, pamP->height);
     if (tuplenarray == NULL) 
-        asprintfN(&error,
-                  "Out of memory allocating the row pointer section of "
-                  "a %u row array", pamP->height);
+        pm_asprintf(&error,
+                    "Out of memory allocating the row pointer section of "
+                    "a %u row array", pamP->height);
     else {
         unsigned int rowsDone;
 
@@ -302,7 +303,7 @@ pnm_allocpamarrayn(const struct pam * const pamP) {
     }
     if (error) {
         pm_errormsg("pnm_allocpamarrayn() failed.  %s", error);
-        strfree(error);
+        pm_strfree(error);
         pm_longjmp();
     }
 
diff --git a/lib/libpamread.c b/lib/libpamread.c
index 0506d020..35d118b4 100644
--- a/lib/libpamread.c
+++ b/lib/libpamread.c
@@ -214,13 +214,12 @@ readRawNonPbmRow(const struct pam * const pamP,
 
     if (bytesRead != rowImageSize) {
         if (feof(pamP->file))
-            asprintfN(&error,
-                      "End of file encountered when trying to read a row from "
-                      "input file.");
+            pm_asprintf(&error, "End of file encountered "
+                        "when trying to read a row from input file.");
         else 
-            asprintfN(&error, "Error reading a row from input file.  "
-                      "fread() fails with errno=%d (%s)",
-                      errno, strerror(errno));
+            pm_asprintf(&error, "Error reading a row from input file.  "
+                        "fread() fails with errno=%d (%s)",
+                        errno, strerror(errno));
     } else {
         error = NULL;  /* initial assumption */
         if (tuplerow) {
@@ -230,8 +229,8 @@ readRawNonPbmRow(const struct pam * const pamP,
             case 3: parse3BpsRow(pamP, tuplerow, inbuf); break;
             case 4: parse4BpsRow(pamP, tuplerow, inbuf); break;
             default:
-                asprintfN(&error, "invalid bytes per sample passed to "
-                          "pnm_formatpamrow(): %u",  pamP->bytes_per_sample);
+                pm_asprintf(&error, "invalid bytes per sample passed to "
+                            "pnm_formatpamrow(): %u",  pamP->bytes_per_sample);
             }
         }
     }
@@ -239,7 +238,7 @@ readRawNonPbmRow(const struct pam * const pamP,
 
     if (error) {
         pm_errormsg("%s", error);
-        strfree(error);
+        pm_strfree(error);
         pm_longjmp();
     }
 }
diff --git a/lib/libpbmfont.c b/lib/libpbmfont.c
index c2753e20..68b1ffb4 100644
--- a/lib/libpbmfont.c
+++ b/lib/libpbmfont.c
@@ -1192,9 +1192,9 @@ parseBitmapRow(const char *    const hex,
          i -= 4) {
 
         if (*p == '\0')
-            asprintfN(errorP, "Not enough hexadecimal digits for glyph "
-                      "of width %u in '%s'",
-                      glyphWidth, hex);
+            pm_asprintf(errorP, "Not enough hexadecimal digits for glyph "
+                        "of width %u in '%s'",
+                        glyphWidth, hex);
         else {
             char const hdig = *p++;
             unsigned int hdigValue;
@@ -1206,11 +1206,11 @@ parseBitmapRow(const char *    const hex,
             else if (hdig >= 'A' && hdig <= 'F')
                 hdigValue = 10 + (hdig - 'A');
             else 
-                asprintfN(errorP,
-                          "Invalid hex digit x%02x (%c) in bitmap data '%s'",
-                          (unsigned int)(unsigned char)hdig, 
-                          isprint(hdig) ? hdig : '.',
-                          hex);
+                pm_asprintf(errorP,
+                            "Invalid hex digit x%02x (%c) in bitmap data '%s'",
+                            (unsigned int)(unsigned char)hdig, 
+                            isprint(hdig) ? hdig : '.',
+                            hex);
 
             if (!*errorP) {
                 if (i > 0)
@@ -1261,7 +1261,7 @@ readBitmap(readline *      const readlineP,
         if (error) {
             pm_error("Error in line %d of bitmap for character '%s': %s",
                      n, charName, error);
-            strfree(error);
+            pm_strfree(error);
         }
     }
 }
diff --git a/lib/libpgm1.c b/lib/libpgm1.c
index 2526a22a..5a533f49 100644
--- a/lib/libpgm1.c
+++ b/lib/libpgm1.c
@@ -186,17 +186,17 @@ readRpgmRow(FILE * const fileP,
     
     MALLOCARRAY(rowBuffer, bytesPerRow);
     if (rowBuffer == NULL)
-        asprintfN(&error, "Unable to allocate memory for row buffer "
-                  "for %u columns", cols);
+        pm_asprintf(&error, "Unable to allocate memory for row buffer "
+                    "for %u columns", cols);
     else {
         size_t rc;
         rc = fread(rowBuffer, 1, bytesPerRow, fileP);
         if (rc == 0)
-            asprintfN(&error, "Error reading row.  fread() errno=%d (%s)",
-                      errno, strerror(errno));
+            pm_asprintf(&error, "Error reading row.  fread() errno=%d (%s)",
+                        errno, strerror(errno));
         else if (rc != bytesPerRow)
-            asprintfN(&error, "Error reading row.  Short read of %u bytes "
-                      "instead of %u", (unsigned)rc, bytesPerRow);
+            pm_asprintf(&error, "Error reading row.  Short read of %u bytes "
+                        "instead of %u", (unsigned)rc, bytesPerRow);
         else {
             error = NULL;
             if (maxval < 256) {
@@ -223,7 +223,7 @@ readRpgmRow(FILE * const fileP,
     }
     if (error) {
         pm_errormsg("%s", error);
-        strfree(error);
+        pm_strfree(error);
         pm_longjmp();
     }
 } 
diff --git a/lib/libpm.c b/lib/libpm.c
index 6c01148c..62ba0180 100644
--- a/lib/libpm.c
+++ b/lib/libpm.c
@@ -115,8 +115,8 @@ pm_fork(int *         const iAmParentP,
     rc = fork();
 
     if (rc < 0) {
-        asprintfN(errorP, "Failed to fork a process.  errno=%d (%s)",
-                  errno, strerror(errno));
+        pm_asprintf(errorP, "Failed to fork a process.  errno=%d (%s)",
+                    errno, strerror(errno));
     } else {
         *errorP = NULL;
 
@@ -146,9 +146,9 @@ pm_waitpid(pid_t         const pid,
     pid_t rc;
     rc = waitpid(pid, statusP, options);
     if (rc == (pid_t)-1) {
-        asprintfN(errorP, "Failed to wait for process exit.  "
-                  "waitpid() errno = %d (%s)",
-                  errno, strerror(errno));
+        pm_asprintf(errorP, "Failed to wait for process exit.  "
+                    "waitpid() errno = %d (%s)",
+                    errno, strerror(errno));
     } else {
         *exitedPidP = rc;
         *errorP = NULL;
@@ -172,7 +172,7 @@ pm_waitpidSimple(pid_t const pid) {
 
     if (error) {
         pm_errormsg("%s", error);
-        strfree(error);
+        pm_strfree(error);
         pm_longjmp();
     } else {
         assert(exitedPid != 0);
@@ -213,14 +213,14 @@ pm_message(const char format[], ...) {
 
     if (pm_showmessages) {
         const char * msg;
-        vasprintfN(&msg, format, args);
+        pm_vasprintf(&msg, format, args);
 
         if (userMessageFn)
             userMessageFn(msg);
         else
             fprintf(stderr, "%s: %s\n", pm_progname, msg);
 
-        strfree(msg);
+        pm_strfree(msg);
     }
     va_end(args);
 }
@@ -246,11 +246,11 @@ pm_errormsg(const char format[], ...) {
 
     va_start(args, format);
 
-    vasprintfN(&msg, format, args);
+    pm_vasprintf(&msg, format, args);
     
     errormsg(msg);
 
-    strfree(msg);
+    pm_strfree(msg);
 
     va_end(args);
 }
@@ -264,11 +264,11 @@ pm_error(const char format[], ...) {
 
     va_start(args, format);
 
-    vasprintfN(&msg, format, args);
+    pm_vasprintf(&msg, format, args);
     
     errormsg(msg);
 
-    strfree(msg);
+    pm_strfree(msg);
 
     va_end(args);
 
@@ -742,11 +742,11 @@ pm_parse_width(const char * const arg) {
     unsigned int width;
     const char * error;
 
-    interpret_uint(arg, &width, &error);
+    pm_interpret_uint(arg, &width, &error);
 
     if (error) {
         pm_error("'%s' is invalid as an image width.  %s", arg, error);
-        strfree(error);
+        pm_strfree(error);
     } else {
         if (width > INT_MAX-10)
             pm_error("Width %u is too large for computations.", width);
@@ -767,11 +767,11 @@ pm_parse_height(const char * const arg) {
     unsigned int height;
     const char * error;
 
-    interpret_uint(arg, &height, &error);
+    pm_interpret_uint(arg, &height, &error);
 
     if (error) {
         pm_error("'%s' is invalid as an image height.  %s", arg, error);
-        strfree(error);
+        pm_strfree(error);
     } else {
         if (height > INT_MAX-10)
             pm_error("Height %u is too large for computations.", height);
diff --git a/lib/libppm1.c b/lib/libppm1.c
index 7c7417e9..1b417613 100644
--- a/lib/libppm1.c
+++ b/lib/libppm1.c
@@ -239,23 +239,24 @@ readRppmRow(FILE *       const fileP,
     MALLOCARRAY(rowBuffer, bytesPerRow);
         
     if (rowBuffer == NULL)
-        asprintfN(&error, "Unable to allocate memory for row buffer "
-                  "for %u columns", cols);
+        pm_asprintf(&error, "Unable to allocate memory for row buffer "
+                    "for %u columns", cols);
     else {
         ssize_t rc;
 
         rc = fread(rowBuffer, 1, bytesPerRow, fileP);
     
         if (feof(fileP))
-            asprintfN(&error, "Unexpected EOF reading row of PPM image.");
+            pm_asprintf(&error, "Unexpected EOF reading row of PPM image.");
         else if (ferror(fileP))
-            asprintfN(&error, "Error reading row.  fread() errno=%d (%s)",
-                      errno, strerror(errno));
+            pm_asprintf(&error, "Error reading row.  fread() errno=%d (%s)",
+                        errno, strerror(errno));
         else {
             size_t const bytesRead = rc;
             if (bytesRead != bytesPerRow)
-                asprintfN(&error, "Error reading row.  Short read of %u bytes "
-                          "instead of %u", (unsigned)bytesRead, bytesPerRow);
+                pm_asprintf(&error,
+                            "Error reading row.  Short read of %u bytes "
+                            "instead of %u", (unsigned)bytesRead, bytesPerRow);
             else {
                 interpRasterRowRaw(rowBuffer, pixelrow, cols, bytesPerSample);
                 error = NULL;
@@ -265,7 +266,7 @@ readRppmRow(FILE *       const fileP,
     }
     if (error) {
         pm_errormsg("%s", error);
-        strfree(error);
+        pm_strfree(error);
         pm_longjmp();
     }
 }
diff --git a/lib/libppmcmap.c b/lib/libppmcmap.c
index 055bfc8b..1fd87441 100644
--- a/lib/libppmcmap.c
+++ b/lib/libppmcmap.c
@@ -153,7 +153,7 @@ readppmrow(FILE *        const fileP,
     
     if (setjmp(jmpbuf) != 0) {
         pm_setjmpbuf(origJmpbufP);
-        asprintfN(errorP, "Failed to read row of image.");
+        pm_asprintf(errorP, "Failed to read row of image.");
     } else {
         pm_setjmpbufsave(&jmpbuf, &origJmpbufP);
 
@@ -227,8 +227,8 @@ buildHashTable(FILE *          const ifP,
                 else {
                     MALLOCVAR(chl);
                     if (chl == NULL)
-                        asprintfN(errorP,
-                                  "out of memory computing hash table");
+                        pm_asprintf(errorP,
+                                    "out of memory computing hash table");
                     chl->ch.color = apixel;
                     chl->ch.value = 1;
                     chl->next = cht[hash];
@@ -282,7 +282,7 @@ computecolorhash(pixel **          const pixels,
     MALLOCARRAY(rowbuffer, cols);
         
     if (rowbuffer == NULL)
-        asprintfN(errorP, "Unable to allocate %u-column row buffer.", cols);
+        pm_asprintf(errorP, "Unable to allocate %u-column row buffer.", cols);
     else {
         colorhash_table cht;
         bool tooManyColors;
@@ -290,7 +290,7 @@ computecolorhash(pixel **          const pixels,
         cht = alloccolorhash();
 
         if (cht == NULL)
-            asprintfN(errorP, "Unable to allocate color hash.");
+            pm_asprintf(errorP, "Unable to allocate color hash.");
         else {
             buildHashTable(ifP, pixels, cols, rows, maxval, format, maxcolors,
                            cht, rowbuffer,
@@ -326,7 +326,7 @@ ppm_computecolorhash(pixel ** const pixels,
 
     if (error) {
         pm_errormsg("%s", error);
-        strfree(error);
+        pm_strfree(error);
         pm_longjmp();
     }
     return cht;
@@ -351,7 +351,7 @@ ppm_computecolorhash2(FILE * const ifP,
 
     if (error) {
         pm_errormsg("%s", error);
-        strfree(error);
+        pm_strfree(error);
         pm_longjmp();
     }
     return cht;
@@ -484,7 +484,7 @@ ppm_colorhisttocolorhash(colorhist_vector const chv,
 
     cht = alloccolorhash( );  /* Initializes to NULLs */
     if (cht == NULL)
-        asprintfN(&error, "Unable to allocate color hash");
+        pm_asprintf(&error, "Unable to allocate color hash");
     else {
         unsigned int i;
 
@@ -496,13 +496,13 @@ ppm_colorhisttocolorhash(colorhist_vector const chv,
 
             for (chl = cht[hash]; chl && !error; chl = chl->next)
                 if (PPM_EQUAL(chl->ch.color, color))
-                    asprintfN(&error, "same color found twice: (%u %u %u)",
-                              PPM_GETR(color),
-                              PPM_GETG(color),
-                              PPM_GETB(color));
+                    pm_asprintf(&error, "same color found twice: (%u %u %u)",
+                                PPM_GETR(color),
+                                PPM_GETG(color),
+                                PPM_GETB(color));
             MALLOCVAR(chl);
             if (chl == NULL)
-                asprintfN(&error, "out of memory");
+                pm_asprintf(&error, "out of memory");
             else {
                 chl->ch.color = color;
                 chl->ch.value = i;
@@ -515,7 +515,7 @@ ppm_colorhisttocolorhash(colorhist_vector const chv,
     }
     if (error) {
         pm_errormsg("%s", error);
-        strfree(error);
+        pm_strfree(error);
         pm_longjmp();
     } else
         retval = cht;
diff --git a/lib/libppmcolor.c b/lib/libppmcolor.c
index 7e324185..36eb7a3f 100644
--- a/lib/libppmcolor.c
+++ b/lib/libppmcolor.c
@@ -264,7 +264,7 @@ parseOldX11(char       const colorname[],
     
     computeHexTable(hexit);
 
-    if (!strishex(&colorname[1]))
+    if (!pm_strishex(&colorname[1]))
         pm_error("Non-hexadecimal characters in #-type color specification");
 
     switch (strlen(colorname) - 1 /* (Number of hex digits) */) {
@@ -460,8 +460,8 @@ processColorfileEntry(struct colorfile_entry const ce,
                       const char **          const errorP) {
 
     if (*colornameIndexP >= MAXCOLORNAMES)
-        asprintfN(errorP, "Too many colors in colorname dictionary.  "
-                  "Max allowed is %u", MAXCOLORNAMES);
+        pm_asprintf(errorP, "Too many colors in colorname dictionary.  "
+                    "Max allowed is %u", MAXCOLORNAMES);
     else {
         pixel color;
 
@@ -479,7 +479,7 @@ processColorfileEntry(struct colorfile_entry const ce,
             colornames[*colornameIndexP] = strdup(ce.colorname);
             colors[*colornameIndexP] = color;
             if (colornames[*colornameIndexP] == NULL)
-                asprintfN(errorP, "Unable to allocate space for color name");
+                pm_asprintf(errorP, "Unable to allocate space for color name");
             else {
                 *errorP = NULL;
                 ++(*colornameIndexP);
@@ -500,7 +500,7 @@ openColornameFile(const char *  const fileName,
     jmp_buf * origJmpbufP;
 
     if (setjmp(jmpbuf) != 0) {
-        asprintfN(errorP, "Failed to open color name file");
+        pm_asprintf(errorP, "Failed to open color name file");
         pm_setjmpbuf(origJmpbufP);
         pm_longjmp();
     } else {
@@ -554,7 +554,7 @@ readOpenColorFile(FILE *          const colorFileP,
         unsigned int colorIndex;
 
         for (colorIndex = 0; colorIndex < nColorsDone; ++colorIndex)
-            strfree(colornames[colorIndex]);
+            pm_strfree(colornames[colorIndex]);
     }
 }
 
@@ -624,21 +624,21 @@ readcolordict(const char *      const fileName,
     MALLOCARRAY(colornames, MAXCOLORNAMES);
 
     if (colornames == NULL)
-        asprintfN(errorP, "Unable to allocate space for colorname table.");
+        pm_asprintf(errorP, "Unable to allocate space for colorname table.");
     else {
         pixel * colors;
 
         MALLOCARRAY(colors, MAXCOLORNAMES);
         
         if (colors == NULL)
-            asprintfN(errorP, "Unable to allocate space for color table.");
+            pm_asprintf(errorP, "Unable to allocate space for color table.");
         else {
             colorhash_table cht;
 
             cht = allocColorHash();
             
             if (cht == NULL)
-                asprintfN(errorP, "Unable to allocate space for color hash");
+                pm_asprintf(errorP, "Unable to allocate space for color hash");
             else {
                 readColorFile(fileName, mustOpen,
                               nColorsP, colornames, colors, cht,
@@ -682,7 +682,7 @@ ppm_readcolordict(const char *      const fileName,
 
     if (error) {
         pm_errormsg("%s", error);
-        strfree(error);
+        pm_strfree(error);
         ppm_freecolorhash(cht);
     } else {
         if (chtP)
diff --git a/lib/pmfileio.c b/lib/pmfileio.c
index dd7e617e..555098c0 100644
--- a/lib/pmfileio.c
+++ b/lib/pmfileio.c
@@ -194,25 +194,25 @@ makeTmpfileWithTemplate(const char *  const filenameTemplate,
     filenameBuffer = strdup(filenameTemplate);
 
     if (filenameBuffer == NULL)
-        asprintfN(errorP, "Unable to allocate storage for temporary "
-                  "file name");
+        pm_asprintf(errorP, "Unable to allocate storage for temporary "
+                    "file name");
     else {
         int rc;
         
         rc = mkstemp2(filenameBuffer);
         
         if (rc < 0)
-            asprintfN(errorP,
-                      "Unable to create temporary file according to name "
-                      "pattern '%s'.  mkstemp() failed with errno %d (%s)",
-                      filenameTemplate, errno, strerror(errno));
+            pm_asprintf(errorP,
+                        "Unable to create temporary file according to name "
+                        "pattern '%s'.  mkstemp() failed with errno %d (%s)",
+                        filenameTemplate, errno, strerror(errno));
         else {
             *fdP = rc;
             *filenameP = filenameBuffer;
             *errorP = NULL;
         }
         if (*errorP)
-            strfree(filenameBuffer);
+            pm_strfree(filenameBuffer);
     }
 }
 
@@ -237,20 +237,20 @@ pm_make_tmpfile_fd(int *         const fdP,
     else
         dirseparator = "/";
     
-    asprintfN(&filenameTemplate, "%s%s%s%s", 
-              tmpdir, dirseparator, pm_progname, "_XXXXXX");
+    pm_asprintf(&filenameTemplate, "%s%s%s%s", 
+                tmpdir, dirseparator, pm_progname, "_XXXXXX");
 
     if (filenameTemplate == NULL)
-        asprintfN(&error,
-                  "Unable to allocate storage for temporary file name");
+        pm_asprintf(&error,
+                    "Unable to allocate storage for temporary file name");
     else {
         makeTmpfileWithTemplate(filenameTemplate, fdP, filenameP, &error);
 
-        strfree(filenameTemplate);
+        pm_strfree(filenameTemplate);
     }
     if (error) {
         pm_errormsg("%s", error);
-        strfree(error);
+        pm_strfree(error);
         pm_longjmp();
     }
 }
@@ -270,7 +270,7 @@ pm_make_tmpfile(FILE **       const filePP,
     if (*filePP == NULL) {
         close(fd);
         unlink(*filenameP);
-        strfree(*filenameP);
+        pm_strfree(*filenameP);
 
         pm_error("Unable to create temporary file.  "
                  "fdopen() failed with errno %d (%s)",
@@ -290,7 +290,7 @@ pm_tmpfile(void) {
 
     unlink(tmpfile);
 
-    strfree(tmpfile);
+    pm_strfree(tmpfile);
 
     return fileP;
 }
@@ -307,7 +307,7 @@ pm_tmpfile_fd(void) {
 
     unlink(tmpfile);
 
-    strfree(tmpfile);
+    pm_strfree(tmpfile);
 
     return fd;
 }
diff --git a/lib/util/filename.c b/lib/util/filename.c
index e3a9a89f..18c12e3c 100644
--- a/lib/util/filename.c
+++ b/lib/util/filename.c
@@ -20,7 +20,7 @@ pm_basename(const char * const fileName) {
         if (fileName[i] == '/')
             basenameStart = i+1;
     }
-    asprintfN(&retval, "%s", &fileName[basenameStart]);
+    pm_asprintf(&retval, "%s", &fileName[basenameStart]);
 
     return retval;
 }
diff --git a/lib/util/io.c b/lib/util/io.c
index edec4a7c..5fe959a9 100644
--- a/lib/util/io.c
+++ b/lib/util/io.c
@@ -49,9 +49,9 @@ pm_freadline(FILE *        const fileP,
         }
 
         if (!buffer)
-            asprintfN(errorP,
-                      "Couldn't get memory for a %u-byte file read buffer.",
-                      (unsigned int)bufferSize);
+            pm_asprintf(errorP,
+                        "Couldn't get memory for a %u-byte file read buffer.",
+                        (unsigned int)bufferSize);
         else {
             int const rc = getc(fileP);
         
@@ -59,9 +59,10 @@ pm_freadline(FILE *        const fileP,
                 if (feof(fileP))
                     eof = true;
                 else
-                    asprintfN(errorP, "Failed to read a character from file.  "
-                              "Errno = %d (%s)",
-                              errno, strerror(errno));
+                    pm_asprintf(errorP,
+                                "Failed to read a character from file.  "
+                                "Errno = %d (%s)",
+                                errno, strerror(errno));
             } else {
                 char const c = (char)rc;
 
diff --git a/lib/util/nstring.c b/lib/util/nstring.c
index 0fa78c7a..03439cad 100644
--- a/lib/util/nstring.c
+++ b/lib/util/nstring.c
@@ -190,12 +190,12 @@ static char credits[] = "\n\
 
 
 void
-vsnprintfN(char *       const str,
-           size_t       const str_m,
-           const char * const fmt,
-           va_list            ap,
-           size_t *     const sizeP) {
-
+pm_vsnprintf(char *       const str,
+             size_t       const str_m,
+             const char * const fmt,
+             va_list            ap,
+             size_t *     const sizeP) {
+    
     size_t str_l = 0;
     const char *p = fmt;
 
@@ -704,17 +704,17 @@ vsnprintfN(char *       const str,
 
 
 int
-snprintfN(char *       const dest,
-          size_t       const str_m,
-          const char * const fmt,
-          ...) {
+pm_snprintf(char *       const dest,
+            size_t       const str_m,
+            const char * const fmt,
+            ...) {
 
     size_t size;
     va_list ap;
 
     va_start(ap, fmt);
     
-    vsnprintfN(dest, str_m, fmt, ap, &size);
+    pm_vsnprintf(dest, str_m, fmt, ap, &size);
 
     va_end(ap);
 
@@ -726,24 +726,24 @@ snprintfN(char *       const dest,
 
 
 /* When a function that is supposed to return a malloc'ed string cannot
-   get the memory for it, it should return 'strsol'.  That has a much
+   get the memory for it, it should return 'pm_strsol'.  That has a much
    better effect on the caller, if the caller doesn't explicitly allow for
    the out of memory case, than returning NULL.  Note that it is very
    rare for the system not to have enough memory to return a small string,
    so it's OK to have somewhat nonsensical behavior when it happens.  We
    just don't want catastrophic behavior.
 
-   'strsol' is an external symbol, so if Caller wants to detect the
+   'pm_strsol' is an external symbol, so if Caller wants to detect the
    out-of-memory failure, he certainly can.
 */
-const char * const strsol = "NO MEMORY TO CREATE STRING!";
+const char * const pm_strsol = "NO MEMORY TO CREATE STRING!";
 
 
 
 void PM_GNU_PRINTF_ATTR(2,3)
-asprintfN(const char ** const resultP,
-          const char *  const fmt, 
-          ...) {
+pm_asprintf(const char ** const resultP,
+            const char *  const fmt, 
+            ...) {
 
     va_list varargs;
     
@@ -751,26 +751,26 @@ asprintfN(const char ** const resultP,
     
     va_start(varargs, fmt);
     
-    vsnprintfN(NULL, 0, fmt, varargs, &dryRunLen);
+    pm_vsnprintf(NULL, 0, fmt, varargs, &dryRunLen);
 
     va_end(varargs);
 
     if (dryRunLen + 1 < dryRunLen)
         /* arithmetic overflow */
-        *resultP = strsol;
+        *resultP = pm_strsol;
     else {
         size_t const allocSize = dryRunLen + 1;
         char * result;
         result = malloc(allocSize);
         if (result == NULL)
-            *resultP = strsol;
+            *resultP = pm_strsol;
         else {
             va_list varargs;
             size_t realLen;
 
             va_start(varargs, fmt);
 
-            vsnprintfN(result, allocSize, fmt, varargs, &realLen);
+            pm_vsnprintf(result, allocSize, fmt, varargs, &realLen);
                 
             assert(realLen == dryRunLen);
             va_end(varargs);
@@ -783,16 +783,16 @@ asprintfN(const char ** const resultP,
 
 
 void
-strfree(const char * const string) {
+pm_strfree(const char * const string) {
 
-    if (string != strsol)
+    if (string != pm_strsol)
         free((void *) string);
 }
 
 
 
 const char *
-strsepN(char ** const stringP, const char * const delim) {
+pm_strsep(char ** const stringP, const char * const delim) {
     const char * retval;   
 
     if (stringP == NULL || *stringP == NULL)
@@ -824,8 +824,8 @@ strsepN(char ** const stringP, const char * const delim) {
 
 
 int
-stripeq(const char * const comparand,
-        const char * const comparator) {
+pm_stripeq(const char * const comparand,
+           const char * const comparator) {
 /*----------------------------------------------------------------------------
   Compare two strings, ignoring leading and trailing white space.
 
@@ -879,10 +879,10 @@ stripeq(const char * const comparand,
 
 
 const void *
-memmemN(const void * const haystackArg,
-        size_t       const haystacklen,
-        const void * const needleArg,
-        size_t       const needlelen) {
+pm_memmem(const void * const haystackArg,
+          size_t       const haystacklen,
+          const void * const needleArg,
+          size_t       const needlelen) {
 
     const unsigned char * const haystack = haystackArg;
     const unsigned char * const needle   = needleArg;
@@ -902,7 +902,7 @@ memmemN(const void * const haystackArg,
 
 
 bool
-strishex(const char * const subject) {
+pm_strishex(const char * const subject) {
 
     bool retval;
     unsigned int i;
@@ -919,12 +919,12 @@ strishex(const char * const subject) {
 
 
 void
-interpret_uint(const char *   const string,
-               unsigned int * const valueP,
-               const char **  const errorP) {
+pm_interpret_uint(const char *   const string,
+                  unsigned int * const valueP,
+                  const char **  const errorP) {
 
     if (string[0] == '\0')
-        asprintfN(errorP, "Null string.");
+        pm_asprintf(errorP, "Null string.");
     else {
         /* strtoul() does a bizarre thing where if the number is out
            of range, it returns a clamped value but tells you about it
@@ -939,13 +939,13 @@ interpret_uint(const char *   const string,
         ulongValue = strtoul(string, &tail, 10);
 
         if (tail[0] != '\0')
-            asprintfN(errorP, "Non-digit stuff in string: %s", tail);
+            pm_asprintf(errorP, "Non-digit stuff in string: %s", tail);
         else if (errno == ERANGE)
-            asprintfN(errorP, "Number too large");
+            pm_asprintf(errorP, "Number too large");
         else if (ulongValue > UINT_MAX)
-            asprintfN(errorP, "Number too large");
+            pm_asprintf(errorP, "Number too large");
         else if (string[0] == '-')
-            asprintfN(errorP, "Negative number");
+            pm_asprintf(errorP, "Negative number");
             /* Sleazy code; string may have leading spaces. */
         else {
             *valueP = ulongValue;
diff --git a/lib/util/nstring.h b/lib/util/nstring.h
index 53f1e4c0..60bab9ae 100644
--- a/lib/util/nstring.h
+++ b/lib/util/nstring.h
@@ -137,62 +137,62 @@ strncaseeq(const char * const comparand,
      - The returned string is a const char * instead of a char *.  The
        const is more correct.
 
-     - If the function can't get the memory, it returns 'strsol',
+     - If the function can't get the memory, it returns 'pm_strsol',
        which is a string that is in static memory that contains text
        indicating an out of memory failure has occurred, intead of
        NULL.  This makes it much easier for programs to ignore this
        possibility.
 
    strfree() is strictly a Netpbm invention, to allow proper type checking
-   when freeing storage allocated by the Netpbm asprintfN().
+   when freeing storage allocated by the Netpbm pm_asprintf().
 */
 
-extern const char * const strsol;
+extern const char * const pm_strsol;
 
 int
-snprintfN(char *       const dest,
-          size_t       const str_m,
-          const char * const fmt,
-          ...) PM_GNU_PRINTF_ATTR(3,4);
+pm_snprintf(char *       const dest,
+            size_t       const str_m,
+            const char * const fmt,
+            ...) PM_GNU_PRINTF_ATTR(3,4);
 
 void
-vsnprintfN(char *       const str,
-           size_t       const str_m,
-           const char * const fmt,
-           va_list            ap,
-           size_t *     const sizeP);
+pm_vsnprintf(char *       const str,
+             size_t       const str_m,
+             const char * const fmt,
+             va_list            ap,
+             size_t *     const sizeP);
 
 void
-asprintfN(const char ** const resultP,
-          const char *  const fmt,
-          ...) PM_GNU_PRINTF_ATTR(2,3);
+pm_asprintf(const char ** const resultP,
+            const char *  const fmt,
+            ...) PM_GNU_PRINTF_ATTR(2,3);
 
 void
-vasprintfN(const char ** const resultP,
-           const char *  const format,
-           va_list             args);
+pm_vasprintf(const char ** const resultP,
+             const char *  const format,
+             va_list             args);
 
 void 
-strfree(const char * const string);
+pm_strfree(const char * const string);
 
 const char *
-strsepN(char ** const stringP, const char * const delim);
+pm_strsep(char ** const stringP, const char * const delim);
 
 int
-stripeq(const char * const comparand,
-        const char * const comparator);
+pm_stripeq(const char * const comparand,
+           const char * const comparator);
 
 const void *
-memmemN(const void * const haystackArg,
-        size_t       const haystacklen,
-        const void * const needleArg,
-        size_t       const needlelen);
+pm_memmem(const void * const haystackArg,
+          size_t       const haystacklen,
+          const void * const needleArg,
+          size_t       const needlelen);
 
 bool
-strishex(const char * const subject);
+pm_strishex(const char * const subject);
 
 void
-interpret_uint(const char *   const string,
+pm_interpret_uint(const char *   const string,
                unsigned int * const valueP,
                const char **  const errorP);
 
diff --git a/lib/util/shhopt.c b/lib/util/shhopt.c
index a557fcd5..2e7c6abd 100644
--- a/lib/util/shhopt.c
+++ b/lib/util/shhopt.c
@@ -737,13 +737,13 @@ fatalUnrecognizedLongOption(const char * const optionName,
         const char * entry;
 
         if (optEntryP->longName)
-            asprintfN(&entry, "-%s ", optEntryP->longName);
+            pm_asprintf(&entry, "-%s ", optEntryP->longName);
         else
-            asprintfN(&entry, "-%c ", optEntryP->shortName);
+            pm_asprintf(&entry, "-%c ", optEntryP->shortName);
 
         strncat(optList, entry, sizeof(optList) - strlen(optList) - 1);
 
-        strfree(entry);
+        pm_strfree(entry);
 
         if (strlen(optList) + 1 == sizeof(optList)) {
             /* Buffer is full.  Overwrite end of list with ellipsis */
@@ -1014,8 +1014,8 @@ pm_optDestroyNameValueList(struct optNameValue * const list) {
     unsigned int i;
 
     for (i = 0; list[i].name; ++i) {
-        strfree(list[i].name);
-        strfree(list[i].value);
+        pm_strfree(list[i].name);
+        pm_strfree(list[i].value);
     }
 
     free(list);
diff --git a/lib/util/token.c b/lib/util/token.c
index c4fe0aed..a68a4821 100644
--- a/lib/util/token.c
+++ b/lib/util/token.c
@@ -38,7 +38,8 @@ pm_gettoken(const char *  const tokenStart,
         if (*cursor == '\\') {
             ++cursor;
             if (*cursor == '\0')
-                asprintfN(errorP, "string ends with an escape character (\\)");
+                pm_asprintf(errorP,
+                            "string ends with an escape character (\\)");
         } else {
             ++cursor;
             ++charCount;
@@ -47,9 +48,9 @@ pm_gettoken(const char *  const tokenStart,
     if (!*errorP) {
         token = malloc(charCount + 1);
         if (token == NULL)
-            asprintfN(errorP, "Could not allocate %u bytes of memory "
-                      "to parse a string",
-                      charCount + 1);
+            pm_asprintf(errorP, "Could not allocate %u bytes of memory "
+                        "to parse a string",
+                        charCount + 1);
         else {
             /* Go back and do it again, this time copying the characters */
             charCount = 0;
diff --git a/lib/util/vasprintf.c b/lib/util/vasprintf.c
index ed8fc808..b9cc6a2f 100644
--- a/lib/util/vasprintf.c
+++ b/lib/util/vasprintf.c
@@ -14,9 +14,9 @@
 #endif
 
 void
-vasprintfN(const char ** const resultP,
-           const char *  const format,
-           va_list             varargs) {
+pm_vasprintf(const char ** const resultP,
+             const char *  const format,
+             va_list             varargs) {
 
     char * result;
 
@@ -24,7 +24,7 @@ vasprintfN(const char ** const resultP,
     vasprintf(&result, format, varargs);
 
     if (result == NULL)
-        *resultP = strsol;
+        *resultP = pm_strsol;
     else
         *resultP = result;
 #else