about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--analyzer/pamfile.c2
-rw-r--r--converter/other/exif.c16
-rw-r--r--converter/other/giftopnm.c60
-rw-r--r--converter/other/jpeg2000/pamtojpeg2k.c94
-rw-r--r--converter/other/jpegtopnm.c2
-rw-r--r--converter/other/pamtofits.c4
-rw-r--r--converter/other/pamtosvg/pamtosvg.c8
-rw-r--r--converter/other/pamtotga.c4
-rw-r--r--converter/other/pamtouil.c4
-rw-r--r--converter/other/pngtopam.c8
-rw-r--r--converter/other/pngtxt.c2
-rw-r--r--converter/other/pnmtopng.c34
-rw-r--r--converter/other/pnmtops.c2
-rw-r--r--converter/other/pstopnm.c34
-rw-r--r--converter/other/svgtopam.c12
-rw-r--r--converter/other/tifftopnm.c18
-rw-r--r--converter/pbm/g3topbm.c50
-rw-r--r--converter/pbm/pbmtonokia.c4
-rw-r--r--converter/pbm/pbmtoxbm.c2
-rw-r--r--converter/ppm/picttoppm.c8
-rw-r--r--converter/ppm/ppmtogif.c38
-rw-r--r--converter/ppm/ppmtompeg/combine.c10
-rw-r--r--converter/ppm/ppmtompeg/input.c14
-rw-r--r--converter/ppm/ppmtompeg/mpeg.c16
-rw-r--r--converter/ppm/ppmtompeg/parallel.c74
-rw-r--r--converter/ppm/ppmtompeg/param.c2
-rw-r--r--converter/ppm/ppmtompeg/ppmtompeg.c16
-rw-r--r--converter/ppm/ppmtompeg/psocket.c44
-rw-r--r--converter/ppm/ppmtompeg/rate.c4
-rw-r--r--converter/ppm/ppmtompeg/readframe.c52
-rw-r--r--converter/ppm/ppmtowinicon.c14
-rw-r--r--converter/ppm/ppmtoxpm.c16
-rw-r--r--converter/ppm/winicontoppm.c27
-rw-r--r--converter/ppm/yuvsplittoppm.c12
-rw-r--r--editor/pambackground.c2
-rw-r--r--editor/pamdice.c12
-rw-r--r--editor/pamflip/pamflip.c2
-rw-r--r--editor/pamthreshold.c10
-rw-r--r--editor/pamundice.c18
-rw-r--r--editor/pnmconvol.c20
-rw-r--r--editor/pnmremap.c6
-rw-r--r--editor/pnmsmooth.c6
-rw-r--r--editor/pnmstitch.c8
-rw-r--r--editor/ppmcolormask.c2
-rw-r--r--editor/ppmdraw.c10
-rw-r--r--editor/specialty/pnmindex.c74
-rw-r--r--generator/pamstereogram.c2
-rw-r--r--generator/pbmtextps.c37
-rw-r--r--generator/ppmcie.c18
-rw-r--r--generator/ppmcolors.c7
-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
-rw-r--r--other/pamlookup.c4
-rw-r--r--other/pamsplit.c8
-rw-r--r--other/pamx/pamx.c2
-rw-r--r--other/pamx/window.c6
-rw-r--r--other/ppmdcfont.c20
-rw-r--r--urt/rle_open_f.c8
75 files changed, 694 insertions, 687 deletions
diff --git a/analyzer/pamfile.c b/analyzer/pamfile.c
index b6bb312c..c2507f66 100644
--- a/analyzer/pamfile.c
+++ b/analyzer/pamfile.c
@@ -157,7 +157,7 @@ doOneImage(const char * const name,
         if (wantComments)
             dumpComments(comments);
     }
-    strfree(comments);
+    pm_strfree(comments);
 
     pnm_checkpam(&pam, PM_CHECK_BASIC, &checkRetval);
     if (allimages) {
diff --git a/converter/other/exif.c b/converter/other/exif.c
index 2f9a998f..6178d9a2 100644
--- a/converter/other/exif.c
+++ b/converter/other/exif.c
@@ -770,20 +770,20 @@ process_EXIF(unsigned char * const ExifData,
                 fprintf(stderr, "Exif header in Motorola order\n");
             MotorolaOrder = 1;
         } else {
-            asprintfN(errorP, "Invalid alignment marker in Exif "
-                      "data.  First two bytes are '%c%c' (0x%02x%02x) "
-                      "instead of 'II' or 'MM'.", 
-                      ExifData[0], ExifData[1], ExifData[0], ExifData[1]);
+            pm_asprintf(errorP, "Invalid alignment marker in Exif "
+                        "data.  First two bytes are '%c%c' (0x%02x%02x) "
+                        "instead of 'II' or 'MM'.", 
+                        ExifData[0], ExifData[1], ExifData[0], ExifData[1]);
         }
     }
     if (!*errorP) {
         unsigned short const start = Get16u(ExifData + 2);
         /* Check the next value for correctness. */
         if (start != 0x002a){
-            asprintfN(errorP, "Invalid Exif header start.  "
-                      "two bytes after the alignment marker "
-                      "should be 0x002a, but is 0x%04x",
-                      start);
+            pm_asprintf(errorP, "Invalid Exif header start.  "
+                        "two bytes after the alignment marker "
+                        "should be 0x002a, but is 0x%04x",
+                        start);
         }
     }
     if (!*errorP) {
diff --git a/converter/other/giftopnm.c b/converter/other/giftopnm.c
index fc826102..faab1086 100644
--- a/converter/other/giftopnm.c
+++ b/converter/other/giftopnm.c
@@ -77,13 +77,13 @@ readFile(FILE *          const ifP,
         *errorP = NULL;
     else {
         if (ferror(ifP))
-            asprintfN(errorP, "Error reading file.  errno=%d (%s)",
-                      errno, strerror(errno));
+            pm_asprintf(errorP, "Error reading file.  errno=%d (%s)",
+                        errno, strerror(errno));
         else if (feof(ifP))
-            asprintfN(errorP, "End of file encountered");
+            pm_asprintf(errorP, "End of file encountered");
         else
-            asprintfN(errorP, "Short read -- %u bytes of %u",
-                              (unsigned)bytesRead, (unsigned)len);
+            pm_asprintf(errorP, "Short read -- %u bytes of %u",
+                        (unsigned)bytesRead, (unsigned)len);
     }
 }
 
@@ -323,9 +323,9 @@ getDataBlock(FILE *          const ifP,
             if (successfulRead) 
                 *errorP = NULL;
             else
-                asprintfN(errorP,
-                          "EOF or error reading data portion of %u byte "
-                          "DataBlock from file", count);
+                pm_asprintf(errorP,
+                            "EOF or error reading data portion of %u byte "
+                            "DataBlock from file", count);
         }
     }
 }
@@ -907,8 +907,8 @@ expandCodeOntoStack(struct decompressor * const decompP,
 
         while (code > decompP->max_dataVal && !error) {
             if (stringCount > maxnum_lzwCode) {
-                asprintfN(&error,
-                          "Error in GIF image: contains LZW string loop");
+                pm_asprintf(&error,
+                            "Error in GIF image: contains LZW string loop");
             } else {
                 ++stringCount;
                 pushStack(&decompP->stack, decompP->table[1][code]);
@@ -1015,8 +1015,8 @@ lzwReadByte(struct decompressor * const decompP,
                     &eof, &code, errorP);
         if (!*errorP) {
             if (eof)
-                asprintfN(errorP,
-                          "Premature end of file; no proper GIF closing");
+                pm_asprintf(errorP,
+                            "Premature end of file; no proper GIF closing");
             else {
                 if (code == decompP->clear_code) {
                     resetDecompressor(decompP);
@@ -1155,12 +1155,12 @@ verifyPixelRead(bool          const endOfImage,
         *errorP = strdup(readError);
     else {
         if (endOfImage)
-            asprintfN(errorP,
-                      "Error in GIF image: Not enough raster data to fill "
-                      "%u x %u dimensions.  Ran out of raster data in "
-                      "row %u.  The image has proper ending sequence, so "
-                      "this is not just a truncated file.",
-                      cols, rows, failedRowNum);
+            pm_asprintf(errorP,
+                        "Error in GIF image: Not enough raster data to fill "
+                        "%u x %u dimensions.  Ran out of raster data in "
+                        "row %u.  The image has proper ending sequence, so "
+                        "this is not just a truncated file.",
+                        cols, rows, failedRowNum);
         else
             *errorP = NULL;
     }
@@ -1208,7 +1208,7 @@ readRaster(struct decompressor * const decompP,
                             &error);
 
             if (readError)
-                strfree(readError);
+                pm_strfree(readError);
 
             if (error) {
                 if (tolerateBadInput) {
@@ -1243,7 +1243,7 @@ skipExtraneousData(struct decompressor * const decompP) {
     lzwReadByte(decompP, &byteRead, &endOfImage, &error);
 
     if (error)
-        strfree(error);
+        pm_strfree(error);
     else if (!endOfImage) {
         pm_message("Extraneous data at end of image.  "
                    "Skipped to end of image");
@@ -1254,7 +1254,7 @@ skipExtraneousData(struct decompressor * const decompP) {
         if (error) {
             pm_message("Error encountered skipping to end of image: %s",
                        error);
-            strfree(error);
+            pm_strfree(error);
         }
     }
 }
@@ -1463,10 +1463,10 @@ readExtensions(FILE*          const ifP,
         readFile(ifP, &c, 1, &error);
 
         if (error) {
-            asprintfN(errorP, "File read error where start of image "
-                      "descriptor or end of GIF expected.  %s",
-                      error);
-            strfree(error);
+            pm_asprintf(errorP, "File read error where start of image "
+                        "descriptor or end of GIF expected.  %s",
+                        error);
+            pm_strfree(error);
         } else {
             if (c == ';') {         /* GIF terminator */
                 eod = TRUE;
@@ -1477,10 +1477,10 @@ readExtensions(FILE*          const ifP,
                 readFile(ifP, &functionCode, 1, &error);
 
                 if (error) {
-                    asprintfN(errorP, "Failed to read function code "
-                              "of GIF extension (immediately after the '!' "
-                              "extension delimiter) from input.  %s", error);
-                    strfree(error);
+                    pm_asprintf(errorP, "Failed to read function code "
+                                "of GIF extension (immediately after the '!' "
+                                "extension delimiter) from input.  %s", error);
+                    pm_strfree(error);
                 } else {
                     doExtension(ifP, functionCode, gif89P);
                 }
@@ -1612,7 +1612,7 @@ disposeOfReadExtensionsError(const char * const error,
         else
             pm_error("Error accessing Image %u of stream.  %s",
                      imageSeq, error);
-        strfree(error);
+        pm_strfree(error);
         *eodP = TRUE;
     }
 }
diff --git a/converter/other/jpeg2000/pamtojpeg2k.c b/converter/other/jpeg2000/pamtojpeg2k.c
index 4ccbe456..731ee38c 100644
--- a/converter/other/jpeg2000/pamtojpeg2k.c
+++ b/converter/other/jpeg2000/pamtojpeg2k.c
@@ -380,7 +380,7 @@ writeJpc(jas_image_t *      const jasperP,
        specifying garbage for the -ilyrrates option 
     */
     if (strlen(cmdline.ilyrrates) > 0)
-        asprintfN(&ilyrratesOpt, "ilyrrates=%s", cmdline.ilyrrates);
+        pm_asprintf(&ilyrratesOpt, "ilyrrates=%s", cmdline.ilyrrates);
     else
         ilyrratesOpt = strdup("");
 
@@ -396,52 +396,52 @@ writeJpc(jas_image_t *      const jasperP,
 
     sprintf(rateOpt, "%1.9f", 1.0/cmdline.compressionRatio);
 
-    asprintfN(&options, 
-              "imgareatlx=%u "
-              "imgareatly=%u "
-              "tilegrdtlx=%u "
-              "tilegrdtly=%u "
-              "tilewidth=%u "
-              "tileheight=%u "
-              "prcwidth=%u "
-              "prcheight=%u "
-              "cblkwidth=%u "
-              "cblkheight=%u "
-              "mode=%s "
-              "rate=%s "
-              "%s "
-              "prg=%s "
-              "numrlvls=%u "
-              "numgbits=%u "
-              "%s %s %s %s %s %s %s %s %s",
-
-              cmdline.imgareatlx,
-              cmdline.imgareatly,
-              cmdline.tilegrdtlx,
-              cmdline.tilegrdtlx,
-              cmdline.tilewidth,
-              cmdline.tileheight,
-              cmdline.prcwidth,
-              cmdline.prcheight,
-              cmdline.cblkwidth,
-              cmdline.cblkheight,
-              cmdline.compmode == COMPMODE_INTEGER ? "int" : "real",
-              rateOpt,
-              ilyrratesOpt,
-              prgValue,
-              cmdline.numrlvls,
-              cmdline.numgbits,
-              cmdline.nomct     ? "nomct"     : "",
-              cmdline.sop       ? "sop"       : "",
-              cmdline.eph       ? "eph"       : "",
-              cmdline.lazy      ? "lazy"      : "",
-              cmdline.termall   ? "termall"   : "",
-              cmdline.segsym    ? "segsym"    : "",
-              cmdline.vcausal   ? "vcausal"   : "",
-              cmdline.pterm     ? "pterm"     : "",
-              cmdline.resetprob ? "resetprob" : ""
+    pm_asprintf(&options, 
+                "imgareatlx=%u "
+                "imgareatly=%u "
+                "tilegrdtlx=%u "
+                "tilegrdtly=%u "
+                "tilewidth=%u "
+                "tileheight=%u "
+                "prcwidth=%u "
+                "prcheight=%u "
+                "cblkwidth=%u "
+                "cblkheight=%u "
+                "mode=%s "
+                "rate=%s "
+                "%s "
+                "prg=%s "
+                "numrlvls=%u "
+                "numgbits=%u "
+                "%s %s %s %s %s %s %s %s %s",
+                
+                cmdline.imgareatlx,
+                cmdline.imgareatly,
+                cmdline.tilegrdtlx,
+                cmdline.tilegrdtlx,
+                cmdline.tilewidth,
+                cmdline.tileheight,
+                cmdline.prcwidth,
+                cmdline.prcheight,
+                cmdline.cblkwidth,
+                cmdline.cblkheight,
+                cmdline.compmode == COMPMODE_INTEGER ? "int" : "real",
+                rateOpt,
+                ilyrratesOpt,
+                prgValue,
+                cmdline.numrlvls,
+                cmdline.numgbits,
+                cmdline.nomct     ? "nomct"     : "",
+                cmdline.sop       ? "sop"       : "",
+                cmdline.eph       ? "eph"       : "",
+                cmdline.lazy      ? "lazy"      : "",
+                cmdline.termall   ? "termall"   : "",
+                cmdline.segsym    ? "segsym"    : "",
+                cmdline.vcausal   ? "vcausal"   : "",
+                cmdline.pterm     ? "pterm"     : "",
+                cmdline.resetprob ? "resetprob" : ""
         );
-    strfree(ilyrratesOpt);
+    pm_strfree(ilyrratesOpt);
 
 
     /* Open the output image file (Standard Output) */
@@ -478,7 +478,7 @@ writeJpc(jas_image_t *      const jasperP,
 
 	jas_image_clearfmts();
 
-    strfree(options);
+    pm_strfree(options);
 }
 
 
diff --git a/converter/other/jpegtopnm.c b/converter/other/jpegtopnm.c
index 59c18de4..790abff2 100644
--- a/converter/other/jpegtopnm.c
+++ b/converter/other/jpegtopnm.c
@@ -662,7 +662,7 @@ print_exif_info(struct jpeg_marker_struct const marker) {
 
     if (error) {
         pm_message("EXIF header is invalid.  %s", error);
-        strfree(error);
+        pm_strfree(error);
     } else
         ShowImageInfo(&imageInfo);
 }
diff --git a/converter/other/pamtofits.c b/converter/other/pamtofits.c
index 85ff7aaa..92e29c7e 100644
--- a/converter/other/pamtofits.c
+++ b/converter/other/pamtofits.c
@@ -111,11 +111,11 @@ writeHeaderCard(const char * const s) {
 -----------------------------------------------------------------------------*/
     const char * card;
 
-    asprintfN(&card, "%-80.80s", s);
+    pm_asprintf(&card, "%-80.80s", s);
 
     fwrite(card, sizeof(card[0]), 80, stdout);
 
-    strfree(card);
+    pm_strfree(card);
 }
 
 
diff --git a/converter/other/pamtosvg/pamtosvg.c b/converter/other/pamtosvg/pamtosvg.c
index 0e66bdb5..72aa4151 100644
--- a/converter/other/pamtosvg/pamtosvg.c
+++ b/converter/other/pamtosvg/pamtosvg.c
@@ -334,7 +334,7 @@ openLogFile(FILE **      const logFileP,
     const char * logfileName;
 
     if (streq(inputFileArg, "-"))
-        asprintfN(&logfileName, "pamtosvg.log");
+        pm_asprintf(&logfileName, "pamtosvg.log");
     else {
         const char * inputRootName;
 
@@ -343,14 +343,14 @@ openLogFile(FILE **      const logFileP,
             pm_error("Can't find the root portion of file name '%s'",
                      inputFileArg);
     
-        asprintfN(&logfileName, "%s.log", inputRootName);
+        pm_asprintf(&logfileName, "%s.log", inputRootName);
 
-        strfree(inputRootName);
+        pm_strfree(inputRootName);
     }
 
     *logFileP = pm_openw(logfileName);
 
-    strfree(logfileName);
+    pm_strfree(logfileName);
 }
     
 
diff --git a/converter/other/pamtotga.c b/converter/other/pamtotga.c
index d4aea399..aca93015 100644
--- a/converter/other/pamtotga.c
+++ b/converter/other/pamtotga.c
@@ -463,7 +463,7 @@ static void
 releaseTgaHeader(struct ImageHeader const tgaHeader) {
 
     if (tgaHeader.IdLength > 0)
-        strfree(tgaHeader.Id);
+        pm_strfree(tgaHeader.Id);
 }
 
 
@@ -567,7 +567,7 @@ main(int argc, char *argv[]) {
         pnm_freetupletable(&pam, chv);
 
     releaseTgaHeader(tgaHeader);
-    strfree(outName);
+    pm_strfree(outName);
     pnm_freepamarray(tuples, &pam);
 
     return 0;
diff --git a/converter/other/pamtouil.c b/converter/other/pamtouil.c
index 252b29d0..ee7f5ae6 100644
--- a/converter/other/pamtouil.c
+++ b/converter/other/pamtouil.c
@@ -374,9 +374,9 @@ freeCmap(cixel_map    const cmap[],
     for (i = 0; i < ncolors; ++i) {
         cixel_map const cmapEntry = cmap[i];
         if (cmapEntry.uilname)
-            strfree(cmapEntry.uilname);
+            pm_strfree(cmapEntry.uilname);
         if (cmapEntry.rgbname)
-            strfree(cmapEntry.rgbname);
+            pm_strfree(cmapEntry.rgbname);
     }
 }
 
diff --git a/converter/other/pngtopam.c b/converter/other/pngtopam.c
index 9609ff4e..f7767404 100644
--- a/converter/other/pngtopam.c
+++ b/converter/other/pngtopam.c
@@ -471,11 +471,11 @@ dumpPngInfo(struct pngx * const pngxP) {
 
     switch (info_ptr->filter_type) {
     case PNG_FILTER_TYPE_BASE:
-        asprintfN(&filter_string, "base filter");
+        pm_asprintf(&filter_string, "base filter");
         break;
     default:
-        asprintfN(&filter_string, "unknown filter type %d", 
-                  info_ptr->filter_type);
+        pm_asprintf(&filter_string, "unknown filter type %d", 
+                    info_ptr->filter_type);
     }
 
     pm_message("reading a %ldw x %ldh image, %d bit%s",
@@ -494,7 +494,7 @@ dumpPngInfo(struct pngx * const pngxP) {
                info_ptr->background.green,
                info_ptr->background.blue);
 
-    strfree(filter_string);
+    pm_strfree(filter_string);
 
     if (info_ptr->valid & PNG_INFO_tRNS)
         pm_message("tRNS chunk (transparency): %u entries",
diff --git a/converter/other/pngtxt.c b/converter/other/pngtxt.c
index bbbec099..e35450d7 100644
--- a/converter/other/pngtxt.c
+++ b/converter/other/pngtxt.c
@@ -299,7 +299,7 @@ pnmpng_read_text (png_info * const info_ptr,
                                     textline, lineLength);
                 }
             }
-            strfree(textline);
+            pm_strfree(textline);
         }
     } 
     if (noCommentsYet)
diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c
index db9d6458..5de3fdc1 100644
--- a/converter/other/pnmtopng.c
+++ b/converter/other/pnmtopng.c
@@ -1799,10 +1799,10 @@ tryAlphaPalette(FILE *         const ifP,
                           palette_pnm, trans_pnm, 
                           paletteSizeP, transSizeP, &tooBig);
     if (tooBig) {
-        asprintfN(impossibleReasonP,
-                  "too many color/transparency pairs "
-                  "(more than the PNG maximum of %u", 
-                  MAXPALETTEENTRIES);
+        pm_asprintf(impossibleReasonP,
+                    "too many color/transparency pairs "
+                    "(more than the PNG maximum of %u", 
+                    MAXPALETTEENTRIES);
     } else
         *impossibleReasonP = NULL;
 } 
@@ -1939,11 +1939,11 @@ computeColorMap(FILE *         const ifP,
   of that color as *backgroundIndexP.
 -------------------------------------------------------------------------- */
     if (force)
-        asprintfN(noColormapReasonP, "You requested no color map");
+        pm_asprintf(noColormapReasonP, "You requested no color map");
     else if (maxval > PALETTEMAXVAL)
-        asprintfN(noColormapReasonP, "The maxval of the input image (%u) "
-                  "exceeds the PNG palette maxval (%u)", 
-                  maxval, PALETTEMAXVAL);
+        pm_asprintf(noColormapReasonP, "The maxval of the input image (%u) "
+                    "exceeds the PNG palette maxval (%u)", 
+                    maxval, PALETTEMAXVAL);
     else {
         unsigned int bitsPerPixel;
         computePixelWidth(PNM_FORMAT_TYPE(format), pnm_meaningful_bits, alpha,
@@ -1953,7 +1953,7 @@ computeColorMap(FILE *         const ifP,
             /* No palette can beat 1 bit per pixel -- no need to waste time
                counting the colors.
             */
-            asprintfN(noColormapReasonP, "pixel is already only 1 bit");
+            pm_asprintf(noColormapReasonP, "pixel is already only 1 bit");
         else {
             /* We'll have to count the colors ('colors') to know if a
                palette is possible and desirable.  Along the way, we'll
@@ -1967,16 +1967,16 @@ computeColorMap(FILE *         const ifP,
                    &chv, &colors);
 
             if (chv == NULL) {
-                asprintfN(noColormapReasonP, 
-                          "More than %u colors found -- too many for a "
-                          "colormapped PNG", MAXCOLORS);
+                pm_asprintf(noColormapReasonP, 
+                            "More than %u colors found -- too many for a "
+                            "colormapped PNG", MAXCOLORS);
             } else {
                 /* There are few enough colors that a palette is possible */
                 if (bitsPerPixel <= paletteIndexBits(colors) && !pfP)
-                    asprintfN(noColormapReasonP, 
-                              "palette index for %u colors would be "
-                              "no smaller than the indexed value (%u bits)", 
-                              colors, bitsPerPixel);
+                    pm_asprintf(noColormapReasonP, 
+                                "palette index for %u colors would be "
+                                "no smaller than the indexed value (%u bits)", 
+                                colors, bitsPerPixel);
                 else {
                     unsigned int paletteSize;
                     unsigned int transSize;
@@ -2727,7 +2727,7 @@ convertpnm(struct cmdlineInfo const cmdline,
                    noColormapReason);
       if (verbose)
           pm_message("Not using color map.  %s", noColormapReason);
-      strfree(noColormapReason);
+      pm_strfree(noColormapReason);
       colorMapped = FALSE;
   } else
       colorMapped = TRUE;
diff --git a/converter/other/pnmtops.c b/converter/other/pnmtops.c
index 4bd59ed2..fae34861 100644
--- a/converter/other/pnmtops.c
+++ b/converter/other/pnmtops.c
@@ -1406,7 +1406,7 @@ main(int argc, char * argv[]) {
             pnm_nextimage(ifp, &eof);
         }
     }
-    strfree(name);
+    pm_strfree(name);
 
     pm_close(ifp);
 
diff --git a/converter/other/pstopnm.c b/converter/other/pstopnm.c
index 5f4d66a9..d9ce201f 100644
--- a/converter/other/pstopnm.c
+++ b/converter/other/pstopnm.c
@@ -218,14 +218,14 @@ addPsToFilespec(char          const orig_filespec[],
     else {
         const char *filespec_plus_ps;
 
-        asprintfN(&filespec_plus_ps, "%s.ps", orig_filespec);
+        pm_asprintf(&filespec_plus_ps, "%s.ps", orig_filespec);
 
         stat_rc = lstat(filespec_plus_ps, &statbuf);
         if (stat_rc == 0)
             *new_filespec_p = strdup(filespec_plus_ps);
         else
             *new_filespec_p = strdup(orig_filespec);
-        strfree(filespec_plus_ps);
+        pm_strfree(filespec_plus_ps);
     }
     if (verbose)
         pm_message("Input file is %s", *new_filespec_p);
@@ -560,12 +560,12 @@ computePstrans(struct box       const box,
         int llx, lly;
         llx = box.llx - (xsize * 72 / xres - (box.urx - box.llx)) / 2;
         lly = box.lly - (ysize * 72 / yres - (box.ury - box.lly)) / 2;
-        asprintfN(&retval, "%d neg %d neg translate", llx, lly);
+        pm_asprintf(&retval, "%d neg %d neg translate", llx, lly);
     } else {
         int llx, ury;
         llx = box.llx - (ysize * 72 / yres - (box.urx - box.llx)) / 2;
         ury = box.ury + (xsize * 72 / xres - (box.ury - box.lly)) / 2;
-        asprintfN(&retval, "90 rotate %d neg %d neg translate", llx, ury);
+        pm_asprintf(&retval, "90 rotate %d neg %d neg translate", llx, ury);
     }
 
     if (retval == NULL)
@@ -602,9 +602,9 @@ computeOutfileArg(struct cmdlineInfo const cmdline) {
         default: pm_error("Internal error: invalid value for format_type: %d",
                           cmdline.format_type);
         }
-        asprintfN(&retval, "%s%%03d.%s", basename, suffix);
+        pm_asprintf(&retval, "%s%%03d.%s", basename, suffix);
 
-        strfree(basename);
+        pm_strfree(basename);
     }
     return(retval);
 }
@@ -627,7 +627,7 @@ computeGsDevice(int  const format_type,
     if (forceplain)
         retval = strdup(basetype);
     else
-        asprintfN(&retval, "%sraw", basetype);
+        pm_asprintf(&retval, "%sraw", basetype);
 
     if (retval == NULL)
         pm_error("Unable to allocate memory for gs device");
@@ -658,7 +658,7 @@ findGhostscriptProg(const char ** const retvalP) {
                 const char * filename;
                 int rc;
 
-                asprintfN(&filename, "%s/gs", candidate);
+                pm_asprintf(&filename, "%s/gs", candidate);
                 rc = stat(filename, &statbuf);
                 if (rc == 0) {
                     if (S_ISREG(statbuf.st_mode))
@@ -667,7 +667,7 @@ findGhostscriptProg(const char ** const retvalP) {
                     pm_error("Error looking for Ghostscript program.  "
                              "stat(\"%s\") returns errno %d (%s)",
                              filename, errno, strerror(errno));
-                strfree(filename);
+                pm_strfree(filename);
 
                 candidate = strtok(NULL, ":");
             }
@@ -705,11 +705,11 @@ execGhostscript(int  const inputPipeFd,
     rc = dup2(inputPipeFd, STDIN_FILENO);
     close(inputPipeFd);
 
-    asprintfN(&arg0, "gs");
-    asprintfN(&deviceopt, "-sDEVICE=%s", ghostscript_device);
-    asprintfN(&outfileopt, "-sOutputFile=%s", outfile_arg);
-    asprintfN(&gopt, "-g%dx%d", xsize, ysize);
-    asprintfN(&ropt, "-r%dx%d", xres, yres);
+    pm_asprintf(&arg0, "gs");
+    pm_asprintf(&deviceopt, "-sDEVICE=%s", ghostscript_device);
+    pm_asprintf(&outfileopt, "-sOutputFile=%s", outfile_arg);
+    pm_asprintf(&gopt, "-g%dx%d", xsize, ysize);
+    pm_asprintf(&ropt, "-r%dx%d", xres, yres);
 
     /* -dSAFER causes Postscript to disable %pipe and file operations,
        which are almost certainly not needed here.  This prevents our
@@ -901,9 +901,9 @@ main(int argc, char ** argv) {
                        xsize, ysize, xres, yres, input_filespec,
                        language, cmdline.verbose);
 
-    strfree(ghostscript_device);
-    strfree(outfile_arg);
-    strfree(pstrans);
+    pm_strfree(ghostscript_device);
+    pm_strfree(outfile_arg);
+    pm_strfree(pstrans);
     
     return 0;
 }
diff --git a/converter/other/svgtopam.c b/converter/other/svgtopam.c
index d2e2a186..26530b9b 100644
--- a/converter/other/svgtopam.c
+++ b/converter/other/svgtopam.c
@@ -193,7 +193,7 @@ destroyPath(path * const pathP) {
     
     assert(pathP->pathTextLength == strlen(pathP->pathText));
 
-    strfree(pathP->pathText);
+    pm_strfree(pathP->pathText);
 
     free(pathP);
 }
@@ -519,7 +519,7 @@ interpretStyle(const char * const styleAttr) {
     p = &buffer[0];
 
     while (p) {
-        const char * const token = strsepN(&p, ";");
+        const char * const token = pm_strsep(&p, ";");
         const char * strippedToken;
         const char * p;
         char * buffer;
@@ -662,14 +662,14 @@ stringToUint(const char *   const string,
     /* TODO: move this to nstring.c */
 
     if (strlen(string) == 0)
-        asprintfN(errorP, "Value is a null string");
+        pm_asprintf(errorP, "Value is a null string");
     else {
         char * tailptr;
 
         *uintP = strtoul(string, &tailptr, 10);
 
         if (*tailptr != '\0')
-            asprintfN(errorP, "Non-numeric crap in string: '%s'", tailptr);
+            pm_asprintf(errorP, "Non-numeric crap in string: '%s'", tailptr);
         else
             *errorP = NULL;
     }
@@ -690,12 +690,12 @@ getSvgAttributes(xmlTextReaderPtr const xmlReaderP,
     stringToUint(width, colsP, &error);
     if (error) {
         pm_error("'width' attribute of <svg> has invalid value.  %s", error);
-        strfree(error);
+        pm_strfree(error);
     }
     stringToUint(height, rowsP, &error);
     if (error) {
         pm_error("'height' attribute of <svg> has invalid value.  %s", error);
-        strfree(error);
+        pm_strfree(error);
     }
 }
 
diff --git a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c
index 0f6e71b8..67e7c52f 100644
--- a/converter/other/tifftopnm.c
+++ b/converter/other/tifftopnm.c
@@ -730,8 +730,8 @@ spawnWithInputPipe(const char *  const shellCmd,
     rc = pipe(fd);
 
     if (rc != 0)
-        asprintfN(errorP, "Failed to create pipe for process input.  "
-                  "Errno=%d (%s)", errno, strerror(errno));
+        pm_asprintf(errorP, "Failed to create pipe for process input.  "
+                    "Errno=%d (%s)", errno, strerror(errno));
     else {
         int iAmParent;
         pid_t childPid;
@@ -746,9 +746,9 @@ spawnWithInputPipe(const char *  const shellCmd,
                 *pipePP = fdopen(fd[PIPE_WRITE], "w");
                 
                 if (*pipePP == NULL)
-                    asprintfN(errorP,"Unable to create stream from pipe.  "
-                              "fdopen() fails with errno=%d (%s)",
-                              errno, strerror(errno));
+                    pm_asprintf(errorP,"Unable to create stream from pipe.  "
+                                "fdopen() fails with errno=%d (%s)",
+                                errno, strerror(errno));
                 else
                     *errorP = NULL;
             } else {
@@ -800,8 +800,8 @@ createFlipProcess(FILE *         const outFileP,
        file descriptor is equivalent to writing to the stream.
     */
 
-    asprintfN(&pamflipCmd, "pamflip -xform=%s >&%u",
-              xformNeeded(orientation), fileno(outFileP));
+    pm_asprintf(&pamflipCmd, "pamflip -xform=%s >&%u",
+                xformNeeded(orientation), fileno(outFileP));
 
     if (verbose)
         pm_message("Reorienting raster with shell command '%s'", pamflipCmd);
@@ -813,7 +813,7 @@ createFlipProcess(FILE *         const outFileP,
                  "raster, failed.  %s.  To work around this, you can use "
                  "the -orientraw option.", pamflipCmd, error);
 
-        strfree(error);
+        pm_strfree(error);
     }
 }
 
@@ -1651,7 +1651,7 @@ main(int argc, const char * argv[]) {
     if (alphaFile != NULL)
         pm_close( alphaFile );
 
-    strfree(cmdline.inputFilename);
+    pm_strfree(cmdline.inputFilename);
 
     /* If the program failed, it previously aborted with nonzero completion
        code, via various function calls.  */
diff --git a/converter/pbm/g3topbm.c b/converter/pbm/g3topbm.c
index 04730357..908008a9 100644
--- a/converter/pbm/g3topbm.c
+++ b/converter/pbm/g3topbm.c
@@ -169,7 +169,7 @@ readBit(struct bitStream * const bitStreamP,
     if ((bitStreamP->shbit & 0xff) == 0) {
         bitStreamP->shdata = getc(bitStreamP->fileP);
         if (bitStreamP->shdata == EOF)
-            asprintfN(errorP, "EOF or error reading file");
+            pm_asprintf(errorP, "EOF or error reading file");
         else {
             bitStreamP->shbit = 0x80;
             if ( bitStreamP->reversebits )
@@ -428,12 +428,12 @@ formatBadCodeException(const char ** const exceptionP,
                        unsigned int  const curlen,
                        unsigned int  const curcode) {
 
-    asprintfN(exceptionP,
-        "bad code word at Column %u.  "
-        "No prefix of the %u bits 0x%x matches any recognized "
-        "code word and no code words longer than 12 bits are "
-        "defined.  ",
-        col, curlen, curcode);
+    pm_asprintf(exceptionP,
+                "bad code word at Column %u.  "
+                "No prefix of the %u bits 0x%x matches any recognized "
+                "code word and no code words longer than 12 bits are "
+                "defined.  ",
+                col, curlen, curcode);
 }
 
 
@@ -485,8 +485,8 @@ readFaxRow(struct bitStream * const bitStreamP,
 
     while (!done) {
         if (col >= MAXCOLS) {
-            asprintfN(exceptionP, "Line is too long for this program to "
-                      "handle -- longer than %u columns", MAXCOLS);
+            pm_asprintf(exceptionP, "Line is too long for this program to "
+                        "handle -- longer than %u columns", MAXCOLS);
             done = TRUE;
         } else {
             unsigned int bit;
@@ -570,7 +570,7 @@ handleRowException(const char * const exception,
                        row, exception);
         else
             pm_error("Problem reading Row %u.  Aborting.  %s", row, exception);
-        strfree(exception);
+        pm_strfree(exception);
     }
 
     if (error) {
@@ -579,7 +579,7 @@ handleRowException(const char * const exception,
                        row, error);
         else
             pm_error("Unable to read Row %u.  Aborting.  %s", row, error);
-        strfree(error);
+        pm_strfree(error);
     }
 }
 
@@ -626,16 +626,16 @@ analyzeLineSize(lineSizeAnalyzer * const analyzerP,
 
     if (analyzerP->expectedLineSize &&
         thisLineSize != analyzerP->expectedLineSize)
-        asprintfN(&error, "Image contains a line of %u pixels.  "
-                  "You specified lines should be %u pixels.",
-                  thisLineSize, analyzerP->expectedLineSize);
+        pm_asprintf(&error, "Image contains a line of %u pixels.  "
+                    "You specified lines should be %u pixels.",
+                    thisLineSize, analyzerP->expectedLineSize);
     else {
         if (analyzerP->maxLineSize && thisLineSize != analyzerP->maxLineSize)
-            asprintfN(&error, "There are at least two different "
-                      "line lengths in this image, "
-                      "%u pixels and %u pixels.  "
-                      "This is a violation of the G3 standard.  ",
-                      thisLineSize, analyzerP->maxLineSize);
+            pm_asprintf(&error, "There are at least two different "
+                        "line lengths in this image, "
+                        "%u pixels and %u pixels.  "
+                        "This is a violation of the G3 standard.  ",
+                        thisLineSize, analyzerP->maxLineSize);
         else
             error = NULL;
     }
@@ -649,7 +649,7 @@ analyzeLineSize(lineSizeAnalyzer * const analyzerP,
         } else
             pm_error("%s", error);
 
-        strfree(error);
+        pm_strfree(error);
     }
     analyzerP->maxLineSize = MAX(thisLineSize, analyzerP->maxLineSize);
 }
@@ -693,8 +693,8 @@ readFax(struct bitStream * const bitStreamP,
         unsigned int lineSize;
 
         if (row >= MAXROWS)
-            asprintfN(&error, "Image is too tall.  This program can "
-                      "handle at most %u rows", MAXROWS);
+            pm_asprintf(&error, "Image is too tall.  This program can "
+                        "handle at most %u rows", MAXROWS);
         else {
             const char * exception;
 
@@ -714,9 +714,9 @@ readFax(struct bitStream * const bitStreamP,
                     if (stretch) {
                         ++row;
                         if (row >= MAXROWS)
-                            asprintfN(&error, "Image is too tall.  This "
-                                      "program can handle at most %u rows "
-                                      "after stretching", MAXROWS);
+                            pm_asprintf(&error, "Image is too tall.  This "
+                                        "program can handle at most %u rows "
+                                        "after stretching", MAXROWS);
                         else
                             packedBits[row] = packedBits[row-1];
                     }
diff --git a/converter/pbm/pbmtonokia.c b/converter/pbm/pbmtonokia.c
index ba6b1059..839e6cc1 100644
--- a/converter/pbm/pbmtonokia.c
+++ b/converter/pbm/pbmtonokia.c
@@ -118,7 +118,7 @@ parseCommandLine(int argc, char ** argv,
         if (strlen(netOpt) != 6)
             pm_error("-net option must be 6 hex digits long.  "
                      "You specified %u characters", (unsigned)strlen(netOpt));
-        else if (!strishex(netOpt))
+        else if (!pm_strishex(netOpt))
             pm_error("-net option must be hexadecimal.  You specified '%s'",
                      netOpt);
         else
@@ -147,7 +147,7 @@ parseCommandLine(int argc, char ** argv,
 static void
 freeCmdline(struct cmdlineInfo const cmdline) {
 
-    strfree(cmdline.networkCode);
+    pm_strfree(cmdline.networkCode);
 }
 
 
diff --git a/converter/pbm/pbmtoxbm.c b/converter/pbm/pbmtoxbm.c
index 9169d862..2b59a17c 100644
--- a/converter/pbm/pbmtoxbm.c
+++ b/converter/pbm/pbmtoxbm.c
@@ -390,7 +390,7 @@ main(int    argc,
 
     convertRaster(ifP, cols, rows, format, stdout, cmdline.xbmVersion);
 
-    strfree(name);
+    pm_strfree(name);
     pm_close(ifP);
 
     return 0;
diff --git a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c
index 9a7d8e7c..d91e23e2 100644
--- a/converter/ppm/picttoppm.c
+++ b/converter/ppm/picttoppm.c
@@ -1217,8 +1217,8 @@ doDiffSize(struct Rect       const clipsrc,
 
     pm_close(tempFileP);
 
-    asprintfN(&command, "pnmscale -xsize %d -ysize %d > %s",
-              rectwidth(&clipdst), rectheight(&clipdst), tempFilename);
+    pm_asprintf(&command, "pnmscale -xsize %d -ysize %d > %s",
+                rectwidth(&clipdst), rectheight(&clipdst), tempFilename);
 
     pm_message("running command '%s'", command);
 
@@ -1227,7 +1227,7 @@ doDiffSize(struct Rect       const clipsrc,
         pm_error("cannot execute command '%s'  popen() errno = %s (%d)",
                  command, strerror(errno), errno);
 
-    strfree(command);
+    pm_strfree(command);
 
     fprintf(pnmscalePipeP, "P6\n%d %d\n%d\n",
             rectwidth(&clipsrc), rectheight(&clipsrc), PPM_MAXMAXVAL);
@@ -1331,7 +1331,7 @@ doDiffSize(struct Rect       const clipsrc,
 
     pm_close(scaled);
     ppm_freerow(row);
-    strfree(tempFilename);
+    pm_strfree(tempFilename);
     unlink(tempFilename);
 }
 
diff --git a/converter/ppm/ppmtogif.c b/converter/ppm/ppmtogif.c
index 3123d1f0..753782fb 100644
--- a/converter/ppm/ppmtogif.c
+++ b/converter/ppm/ppmtogif.c
@@ -183,8 +183,8 @@ openPnmremapStream(const char * const inputFileName,
     assert(inputFileName != NULL);
     assert(mapFileName != NULL);
 
-    asprintfN(&pnmremapCommand, "pnmremap -mapfile='%s' %s",
-              mapFileName, inputFileName);
+    pm_asprintf(&pnmremapCommand, "pnmremap -mapfile='%s' %s",
+                mapFileName, inputFileName);
 
     if (verbose)
         pm_message("Preprocessing Pamtogif input with shell command '%s'",
@@ -198,7 +198,7 @@ openPnmremapStream(const char * const inputFileName,
     else
         *pnmremapPipeP = pnmremapPipe;
 
-    strfree(pnmremapCommand);
+    pm_strfree(pnmremapCommand);
 }
 
 
@@ -221,39 +221,39 @@ pamtogifCommand(const char *       const arg0,
 
         struct stat statbuf;
 
-        asprintfN(&progName, "%s/%s", arg0DirName, pamtogifName);
+        pm_asprintf(&progName, "%s/%s", arg0DirName, pamtogifName);
 
         if (stat(progName, &statbuf) == 0)
             commandVerb = progName;
         else
             commandVerb = strdup(pamtogifName);
 
-        strfree(arg0DirName);
+        pm_strfree(arg0DirName);
     } else
         commandVerb = strdup(pamtogifName);
 
     if (cmdline.transparent)
-        asprintfN(&transparentOpt, "-transparent=%s", cmdline.transparent);
+        pm_asprintf(&transparentOpt, "-transparent=%s", cmdline.transparent);
     else
         transparentOpt = strdup("");
 
     if (cmdline.comment)
-        asprintfN(&commentOpt, "-comment=%s", cmdline.comment);
+        pm_asprintf(&commentOpt, "-comment=%s", cmdline.comment);
     else
         commentOpt = strdup("");
 
-    asprintfN(&retval, "%s - -alphacolor=%s %s %s %s %s %s %s",
-              commandVerb,
-              cmdline.alphacolor,
-              cmdline.interlace ? "-interlace" : "",
-              cmdline.sort ? "-sort" : "",
-              transparentOpt,
-              commentOpt,
-              cmdline.nolzw ? "-nolzw" : "",
-              cmdline.verbose ? "-verbose" : "");
+    pm_asprintf(&retval, "%s - -alphacolor=%s %s %s %s %s %s %s",
+                commandVerb,
+                cmdline.alphacolor,
+                cmdline.interlace ? "-interlace" : "",
+                cmdline.sort ? "-sort" : "",
+                transparentOpt,
+                commentOpt,
+                cmdline.nolzw ? "-nolzw" : "",
+                cmdline.verbose ? "-verbose" : "");
     
-    strfree(transparentOpt);
-    strfree(commentOpt);
+    pm_strfree(transparentOpt);
+    pm_strfree(commentOpt);
 
     return retval;
 }
@@ -413,7 +413,7 @@ main(int    argc,
     if (rc != 0)
         pm_error("Pamtogif process failed.  pclose() failed.");
 
-    strfree(command);
+    pm_strfree(command);
 
     pm_close(ifP);
     pm_close(stdout);
diff --git a/converter/ppm/ppmtompeg/combine.c b/converter/ppm/ppmtompeg/combine.c
index 8e0d3281..c00f9c71 100644
--- a/converter/ppm/ppmtompeg/combine.c
+++ b/converter/ppm/ppmtompeg/combine.c
@@ -104,7 +104,7 @@ appendSpecifiedGopFiles(struct inputSource * const inputSourceP,
         FILE * ifP;
 
         GetNthInputFileName(inputSourceP, fileSeq, &inputFileName);
-        asprintfN(&fileName, "%s/%s", currentGOPPath, inputFileName);
+        pm_asprintf(&fileName, "%s/%s", currentGOPPath, inputFileName);
 
         for (nAttempts = 0, ifP = NULL;
              nAttempts < READ_ATTEMPTS && !ifP;
@@ -122,8 +122,8 @@ appendSpecifiedGopFiles(struct inputSource * const inputSourceP,
         } else
             pm_error("Unable to read file '%s' after %u attempts.",
                      fileName, READ_ATTEMPTS);
-        strfree(fileName);
-        strfree(inputFileName);
+        pm_strfree(fileName);
+        pm_strfree(inputFileName);
     }
 } 
 
@@ -140,7 +140,7 @@ appendDefaultGopFiles(const char * const outputFileName,
         const char * fileName;
         FILE * ifP;
 
-        asprintfN(&fileName, "%s.gop.%u", outputFileName, fileSeq);
+        pm_asprintf(&fileName, "%s.gop.%u", outputFileName, fileSeq);
         
         ifP = fopen(fileName, "rb");
         if (ifP == NULL)
@@ -151,7 +151,7 @@ appendDefaultGopFiles(const char * const outputFileName,
             
             AppendFile(ofP, ifP);
         }
-        strfree(fileName);
+        pm_strfree(fileName);
     }
 }
 
diff --git a/converter/ppm/ppmtompeg/input.c b/converter/ppm/ppmtompeg/input.c
index 2b87afa7..4266d39b 100644
--- a/converter/ppm/ppmtompeg/input.c
+++ b/converter/ppm/ppmtompeg/input.c
@@ -104,17 +104,17 @@ GetNthInputFileName(struct inputSource * const inputSourceP,
         }
 
         if (mapNEntryP->repeat != TRUE)
-            asprintfN(fileNameP, "%s%s%s",
-                      mapNEntryP->left, &numBuffer[32-numPadding],
-                      mapNEntryP->right);
+            pm_asprintf(fileNameP, "%s%s%s",
+                        mapNEntryP->left, &numBuffer[32-numPadding],
+                        mapNEntryP->right);
         else
-            asprintfN(fileNameP, "%s", mapNEntryP->left);
+            pm_asprintf(fileNameP, "%s", mapNEntryP->left);
     } else {
         if (mapNEntryP->repeat != TRUE)
-            asprintfN(fileNameP, "%s%d%s",
-                      mapNEntryP->left, index, mapNEntryP->right);
+            pm_asprintf(fileNameP, "%s%d%s",
+                        mapNEntryP->left, index, mapNEntryP->right);
         else
-            asprintfN(fileNameP, "%s", mapNEntryP->left);
+            pm_asprintf(fileNameP, "%s", mapNEntryP->left);
     }
 
     lastN = n;
diff --git a/converter/ppm/ppmtompeg/mpeg.c b/converter/ppm/ppmtompeg/mpeg.c
index 6557f377..a00a1bb6 100644
--- a/converter/ppm/ppmtompeg/mpeg.c
+++ b/converter/ppm/ppmtompeg/mpeg.c
@@ -413,11 +413,11 @@ bitioNew(const char * const outputFileName,
     else {
         const char * fileName;
 
-        asprintfN(&fileName, "%s.frame.%d", outputFileName, frameNumber);
+        pm_asprintf(&fileName, "%s.frame.%d", outputFileName, frameNumber);
 
         bbP = Bitio_New_Filename(fileName);
 
-        strfree(fileName);
+        pm_strfree(fileName);
     }
     return bbP;
 }
@@ -771,12 +771,12 @@ doFirstFrameStuff(enum frameContext const context,
             time_t now;
                     
             time(&now);
-            asprintfN(&userDataString,"MPEG stream encoded by UCB Encoder "
-                      "(mpeg_encode) v%s on %s.",
-                      VERSION, ctime(&now));
+            pm_asprintf(&userDataString,"MPEG stream encoded by UCB Encoder "
+                        "(mpeg_encode) v%s on %s.",
+                        VERSION, ctime(&now));
             userData = strdup(userDataString);
             userDataSize = strlen(userData);
-            strfree(userDataString);
+            pm_strfree(userDataString);
         }
         Mhead_GenSequenceHeader(bbP, Fsize_x, Fsize_y,
                                 /* pratio */ aspectRatio,
@@ -1322,12 +1322,12 @@ PrintStartStats(time_t               const startTime,
             GetNthInputFileName(inputSourceP, 0, &inputFileName);
             fprintf(fpointer, "FIRST FILE:  %s/%s\n", 
                     currentPath, inputFileName);
-            strfree(inputFileName);
+            pm_strfree(inputFileName);
             GetNthInputFileName(inputSourceP, inputSourceP->numInputFiles-1, 
                                 &inputFileName);
             fprintf(fpointer, "LAST FILE:  %s/%s\n", 
                     currentPath, inputFileName);
-            strfree(inputFileName);
+            pm_strfree(inputFileName);
         }    
         fprintf(fpointer, "OUTPUT:  %s\n", outputFileName);
 
diff --git a/converter/ppm/ppmtompeg/parallel.c b/converter/ppm/ppmtompeg/parallel.c
index 97cb9f84..9bc695a6 100644
--- a/converter/ppm/ppmtompeg/parallel.c
+++ b/converter/ppm/ppmtompeg/parallel.c
@@ -156,7 +156,7 @@ machineDebug(const char format[], ...) {
     if (debugMachines) {
         const char * const hostname = GetHostName();
         fprintf(stderr, "%s: ---", hostname);
-        strfree(hostname);
+        pm_strfree(hostname);
         vfprintf(stderr, format, args);
         fputc('\n', stderr);
     }
@@ -175,7 +175,7 @@ errorExit(const char format[], ...) {
     va_start(args, format);
 
     fprintf(stderr, "%s: FATAL ERROR.  ", hostname);
-    strfree(hostname);
+    pm_strfree(hostname);
     vfprintf(stderr, format, args);
     fputc('\n', stderr);
 
@@ -767,13 +767,13 @@ routeFromSocketToDisk(int              const otherSock,
     ReadBytes(otherSock, bigBuffer, numBytes);
     
     /* open file to output this stuff to */
-    asprintfN(&fileName, "%s.frame.%d", outputFileName, frameNumber);
+    pm_asprintf(&fileName, "%s.frame.%d", outputFileName, frameNumber);
     filePtr = fopen(fileName, "wb");
 
     if (filePtr == NULL)
         errorExit("I/O SERVER: Could not open output file(3):  %s", fileName);
 
-    strfree(fileName);
+    pm_strfree(fileName);
 
     /* now write the bytes here */
     fwrite(bigBuffer, sizeof(char), numBytes, filePtr);
@@ -1246,11 +1246,11 @@ waitForOutputFile(void *        const inputHandle,
         }
         machineDebug("COMBINE SERVER: Wait for frame %u over", frameNumber);
 
-        asprintfN(&fileName, "%s.frame.%u", outputFileName, frameNumber);
+        pm_asprintf(&fileName, "%s.frame.%u", outputFileName, frameNumber);
 
         openInputFile(fileName, ifPP);
 
-        strfree(fileName);
+        pm_strfree(fileName);
     }
 }
 
@@ -1263,11 +1263,11 @@ unlinkFile(void *       const inputHandle,
     if (!keepTempFiles) {
         const char * fileName;
 
-        asprintfN(&fileName, "%s.frame.%u", outputFileName, frameNumber);
+        pm_asprintf(&fileName, "%s.frame.%u", outputFileName, frameNumber);
 
         unlink(fileName);
 
-        strfree(fileName);
+        pm_strfree(fileName);
     }
 }
 
@@ -1340,13 +1340,13 @@ startCombineServer(const char * const encoderName,
     int          otherSock;
     const char * error;
 
-    snprintfN(command, sizeof(command), 
-              "%s %s -max_machines %d -output_server %s %d %d %s",
-              encoderName, 
-              debugMachines ? "-debug_machines" : "",
-              numMachines, masterHostName, masterPortNum, 
-              numInputFiles, paramFileName);
-
+    pm_snprintf(command, sizeof(command), 
+                "%s %s -max_machines %d -output_server %s %d %d %s",
+                encoderName, 
+                debugMachines ? "-debug_machines" : "",
+                numMachines, masterHostName, masterPortNum, 
+                numInputFiles, paramFileName);
+    
     machineDebug("MASTER: Starting combine server with shell command '%s'",
                  command);
 
@@ -1382,12 +1382,12 @@ startDecodeServer(const char * const encoderName,
     int          otherSock;
     const char * error;
 
-    snprintfN(command, sizeof(command), 
-              "%s %s -max_machines %d -decode_server %s %d %d %s",
-              encoder_name, 
-              debugMachines ? "-debug_machines" : "",
-              numMachines, masterHostName, masterPortNum,
-              numInputFiles, paramFileName);
+    pm_snprintf(command, sizeof(command), 
+                "%s %s -max_machines %d -decode_server %s %d %d %s",
+                encoder_name, 
+                debugMachines ? "-debug_machines" : "",
+                numMachines, masterHostName, masterPortNum,
+                numInputFiles, paramFileName);
 
     machineDebug("MASTER: Starting decode server with shell command '%s'",
                  command);
@@ -1680,21 +1680,21 @@ startChildren(struct scheduler *   const schedulerP,
                 }
                 --childrenLeftCurrentIoServer;
             } 
-            snprintfN(command, sizeof(command),
-                      "%s %s -l %s %s "
-                      "%s %s -child %s %d %d %d %d %d %d "
-                      "-frames %d %d %s",
-                      rsh,
-                      machineName[childNum], userName[childNum],
-                      beNice ? "nice" : "",
-                      executable[childNum],
-                      debugMachines ? "-debug_machines" : "",
-                      masterHostName, masterPortNum, 
-                      remote[childNum] ? ioPortNum[numIoServers-1] : 0,
-                      combinePortNum, decodePortNum, childNum,
-                      remote[childNum] ? 1 : 0,
-                      startFrame, startFrame + nFrames - 1,
-                      remote[childNum] ? 
+            pm_snprintf(command, sizeof(command),
+                        "%s %s -l %s %s "
+                        "%s %s -child %s %d %d %d %d %d %d "
+                        "-frames %d %d %s",
+                        rsh,
+                        machineName[childNum], userName[childNum],
+                        beNice ? "nice" : "",
+                        executable[childNum],
+                        debugMachines ? "-debug_machines" : "",
+                        masterHostName, masterPortNum, 
+                        remote[childNum] ? ioPortNum[numIoServers-1] : 0,
+                        combinePortNum, decodePortNum, childNum,
+                        remote[childNum] ? 1 : 0,
+                        startFrame, startFrame + nFrames - 1,
+                        remote[childNum] ? 
                           remoteParamFile[childNum] : paramFileName
                 );
         
@@ -2070,7 +2070,7 @@ MasterServer(struct inputSource * const inputSourceP,
         fclose(statFile);
 
     free(childState);
-    strfree(hostName);
+    pm_strfree(hostName);
 }
 
 
diff --git a/converter/ppm/ppmtompeg/param.c b/converter/ppm/ppmtompeg/param.c
index a145d33c..15f13473 100644
--- a/converter/ppm/ppmtompeg/param.c
+++ b/converter/ppm/ppmtompeg/param.c
@@ -988,7 +988,7 @@ ReadParamFile(const char *         const fileName,
                            paramP);
               /* May read additional lines from file */
 
-      strfree(input);
+      pm_strfree(input);
   }
 
   fclose(fpointer);
diff --git a/converter/ppm/ppmtompeg/ppmtompeg.c b/converter/ppm/ppmtompeg/ppmtompeg.c
index f53ffea9..1440d88c 100644
--- a/converter/ppm/ppmtompeg/ppmtompeg.c
+++ b/converter/ppm/ppmtompeg/ppmtompeg.c
@@ -335,9 +335,9 @@ announceJob(enum frameContext const context,
         const char * combineDest;
 
         if (context == CONTEXT_JUSTFRAMES)
-            asprintfN(&outputDest, "to individual frame files");
+            pm_asprintf(&outputDest, "to individual frame files");
         else
-            asprintfN(&outputDest, "to file '%s'", outputFileName);
+            pm_asprintf(&outputDest, "to file '%s'", outputFileName);
 
         if (childProcess)
             combineDest = strdup("for delivery to combine server");
@@ -347,8 +347,8 @@ announceJob(enum frameContext const context,
         pm_message("%s:  ENCODING FRAMES %u-%u to %s %s",
                    hostname, frameStart, frameEnd, outputDest, combineDest);
 
-        strfree(combineDest);
-        strfree(outputDest);
+        pm_strfree(combineDest);
+        pm_strfree(outputDest);
     }
 }
 
@@ -540,15 +540,15 @@ getUserFrameFile(void *       const handle,
 
         GetNthInputFileName(inputSourceP, frameNumber, &inputFileName);
         
-        asprintfN(&fileName, "%s/%s", currentFramePath, inputFileName);
+        pm_asprintf(&fileName, "%s/%s", currentFramePath, inputFileName);
         
         *ifPP = fopen(fileName, "rb");
         if (*ifPP == NULL)
             pm_error("Unable to open file '%s'.  Errno = %d (%s)",
                      fileName, errno, strerror(errno));
         
-        strfree(inputFileName);
-        strfree(fileName);
+        pm_strfree(inputFileName);
+        pm_strfree(fileName);
     }
 }
 
@@ -702,7 +702,7 @@ main(int argc, char **argv) {
     } 
     Frame_Exit();
         
-    strfree(hostname);
+    pm_strfree(hostname);
 
     return 0;
 }
diff --git a/converter/ppm/ppmtompeg/psocket.c b/converter/ppm/ppmtompeg/psocket.c
index 707f1d84..6a50dc27 100644
--- a/converter/ppm/ppmtompeg/psocket.c
+++ b/converter/ppm/ppmtompeg/psocket.c
@@ -91,7 +91,7 @@ errorExit(const char format[], ...) {
     va_start(args, format);
 
     fprintf(stderr, "%s: FATAL ERROR.  ", hostname);
-    strfree(hostname);
+    pm_strfree(hostname);
     vfprintf(stderr, format, args);
     fputc('\n', stderr);
 
@@ -272,13 +272,13 @@ ConnectToSocket(const char *      const machineName,
     if ((*hostEnt) == NULL) {
         (*hostEnt) = gethostbyname(machineName);
         if ((*hostEnt) == NULL)
-            asprintfN(errorP, "Couldn't get host by name (%s)", machineName);
+            pm_asprintf(errorP, "Couldn't get host by name (%s)", machineName);
     }
     if (!*errorP) {
         rc = socket(AF_INET, SOCK_STREAM, 0);
         if (rc < 0)
-            asprintfN(errorP, "socket() failed with errno %d (%s)", 
-                      errno, strerror(errno));
+            pm_asprintf(errorP, "socket() failed with errno %d (%s)", 
+                        errno, strerror(errno));
         else {
             int const socketFd = rc;
             
@@ -298,10 +298,10 @@ ConnectToSocket(const char *      const machineName,
                          sizeof(struct sockaddr));
             
             if (rc != 0)
-                asprintfN(errorP, 
-                          "connect() to host '%s', port %d failed with "
-                          "errno %d (%s)",
-                          machineName, portNum, errno, strerror(errno));
+                pm_asprintf(errorP, 
+                            "connect() to host '%s', port %d failed with "
+                            "errno %d (%s)",
+                            machineName, portNum, errno, strerror(errno));
             else {
                 *errorP = NULL;
                 *socketFdP = socketFd;
@@ -364,14 +364,14 @@ bindToUnusedPort(int              const socketFd,
             foundPort = TRUE;
             *portNumP = trialPortNum;
         } else if (!portInUseErrno(errno))
-            asprintfN(errorP, "bind() of TCP port number %hu failed "
-                      "with errno %d (%s)", 
-                      trialPortNum, errno, strerror(errno));
+            pm_asprintf(errorP, "bind() of TCP port number %hu failed "
+                        "with errno %d (%s)", 
+                        trialPortNum, errno, strerror(errno));
     }
     
     if (!*errorP && !foundPort)
-        asprintfN(errorP, "Unable to find a free port.  Every TCP port "
-                  "in the range 2048-16383 is in use");
+        pm_asprintf(errorP, "Unable to find a free port.  Every TCP port "
+                    "in the range 2048-16383 is in use");
 }
 
 
@@ -392,10 +392,10 @@ CreateListeningSocket(int *         const socketP,
     
     rc = socket(AF_INET, SOCK_STREAM, 0);
     if (rc < 0)
-        asprintfN(errorP,
-                  "Unable to create socket.  "
-                  "socket() failed with errno %d (%s)",
-                  errno, strerror(errno));
+        pm_asprintf(errorP,
+                    "Unable to create socket.  "
+                    "socket() failed with errno %d (%s)",
+                    errno, strerror(errno));
     else {
         int const socketFd = rc;
 
@@ -414,9 +414,9 @@ CreateListeningSocket(int *         const socketP,
             */
             rc = listen(socketFd, SOMAXCONN);
             if (rc != 0)
-                asprintfN(errorP, "Unable to listen on TCP socket.  "
-                          "listen() fails with errno %d (%s)", 
-                          errno, strerror(errno));
+                pm_asprintf(errorP, "Unable to listen on TCP socket.  "
+                            "listen() fails with errno %d (%s)", 
+                            errno, strerror(errno));
         }
         if (*errorP)
             close(socketFd);
@@ -443,8 +443,8 @@ AcceptConnection(int           const listenSocketFd,
     rc = accept(listenSocketFd, &otherSocket, &otherSize);
 
     if (rc < 0)
-        asprintfN(errorP, "accept() failed with errno %d (%s).  ",
-                  errno, strerror(errno));
+        pm_asprintf(errorP, "accept() failed with errno %d (%s).  ",
+                    errno, strerror(errno));
     else {
         *connectSocketFdP = rc;
         *errorP = NULL;
diff --git a/converter/ppm/ppmtompeg/rate.c b/converter/ppm/ppmtompeg/rate.c
index 1a44cb95..0f1bcac1 100644
--- a/converter/ppm/ppmtompeg/rate.c
+++ b/converter/ppm/ppmtompeg/rate.c
@@ -236,7 +236,7 @@ analyzePattern(const char *  const framePattern,
         case 'p': ++*gop_pP; break;
         case 'b': ++*gop_bP; break;
         default:
-            asprintfN(errorP, "Bad pattern - not composed of i, p, and b");
+            pm_asprintf(errorP, "Bad pattern - not composed of i, p, and b");
         }
     }
     assert(*gop_xP == *gop_iP + *gop_pP + *gop_bP);
@@ -285,7 +285,7 @@ initRateControl(bool const wantUnderflowWarning,
     if (error) {
         pm_message("Unable to set up rate control.  Switching to variable.  "
                    "%s", error);
-        strfree(error);
+        pm_strfree(error);
         RateControlMode = VARIABLE_RATE;
         return -1;
     }
diff --git a/converter/ppm/ppmtompeg/readframe.c b/converter/ppm/ppmtompeg/readframe.c
index d1423c1f..112ebdf0 100644
--- a/converter/ppm/ppmtompeg/readframe.c
+++ b/converter/ppm/ppmtompeg/readframe.c
@@ -155,7 +155,7 @@ openFile(struct inputSource * const inputSourceP,
         
         GetNthInputFileName(inputSourceP, frameNumber, &fileName);
         
-        asprintfN(&fullFileName, "%s/%s", currentPath, fileName);
+        pm_asprintf(&fullFileName, "%s/%s", currentPath, fileName);
         
         CurrFile = fullFileName;
         
@@ -207,8 +207,8 @@ openFile(struct inputSource * const inputSourceP,
             if (baseFormat == JMOVIE_FILE_TYPE)
                 unlink(fullFileName);
         }
-        strfree(fullFileName);
-        strfree(fileName);
+        pm_strfree(fullFileName);
+        pm_strfree(fileName);
     }
 }
 
@@ -377,10 +377,10 @@ ReadFrame(MpegFrame *          const frameP,
 void
 SetFileType(const char * const conversion)
 {
-    if ( strcmp(conversion, "*") == 0 ) {
-    fileType = BASE_FILE_TYPE;
+    if (streq(conversion, "*")) {
+        fileType = BASE_FILE_TYPE;
     } else {
-    fileType = ANY_FILE_TYPE;
+        fileType = ANY_FILE_TYPE;
     }
 }
 
@@ -399,23 +399,23 @@ SetFileType(const char * const conversion)
 void
 SetFileFormat(const char * const format)
 {
-    if ( strcmp(format, "PPM") == 0 ) {
-    baseFormat = PNM_FILE_TYPE;
-    } else if ( strcmp(format, "YUV") == 0 ) {
-    baseFormat = YUV_FILE_TYPE;
-    } else if ( strcmp(format, "Y") == 0 ) {
-    baseFormat = Y_FILE_TYPE;
-    } else if ( strcmp(format, "PNM") == 0 ) {
-    baseFormat = PNM_FILE_TYPE;
-    } else if (( strcmp(format, "JPEG") == 0 ) || ( strcmp(format, "JPG") == 0 )) {
-    baseFormat = JPEG_FILE_TYPE;
-    } else if ( strcmp(format, "JMOVIE") == 0 ) {
-    baseFormat = JMOVIE_FILE_TYPE;
-    } else if ( strcmp(format, "SUB4") == 0 ) {
-    baseFormat = SUB4_FILE_TYPE;
+    if (streq(format, "PPM")) {
+        baseFormat = PNM_FILE_TYPE;
+    } else if (streq(format, "YUV")) {
+        baseFormat = YUV_FILE_TYPE;
+    } else if (streq(format, "Y")) {
+        baseFormat = Y_FILE_TYPE;
+    } else if (streq(format, "PNM")) {
+        baseFormat = PNM_FILE_TYPE;
+    } else if (streq(format, "JPEG") || streq(format, "JPG")) {
+        baseFormat = JPEG_FILE_TYPE;
+    } else if (streq(format, "JMOVIE")) {
+        baseFormat = JMOVIE_FILE_TYPE;
+    } else if (streq(format, "SUB4")) {
+        baseFormat = SUB4_FILE_TYPE;
     } else {
-    fprintf(stderr, "ERROR:  Invalid file format:  %s\n", format);
-    exit(1);
+        fprintf(stderr, "ERROR:  Invalid file format:  %s\n", format);
+        exit(1);
     }
 }
 
@@ -435,9 +435,9 @@ ReadIOConvert(struct inputSource * const inputSourceP,
 
     GetNthInputFileName(inputSourceP, frameNumber, &fileName);
 
-    asprintfN(&fullFileName, "%s/%s", currentPath, fileName);
+    pm_asprintf(&fullFileName, "%s/%s", currentPath, fileName);
 
-    if ( strcmp(ioConversion, "*") == 0 ) {
+    if (streq(ioConversion, "*")) {
         char buff[1024];
         ifp = fopen(fullFileName, "rb");
         sprintf(buff,"fopen \"%s\"",fullFileName);
@@ -483,8 +483,8 @@ ReadIOConvert(struct inputSource * const inputSourceP,
         exit(1);
     }
 
-    strfree(fullFileName);
-    strfree(fileName);
+    pm_strfree(fullFileName);
+    pm_strfree(fileName);
 
     return ifp;
 }
diff --git a/converter/ppm/ppmtowinicon.c b/converter/ppm/ppmtowinicon.c
index be07fcc8..faa6a5ac 100644
--- a/converter/ppm/ppmtowinicon.c
+++ b/converter/ppm/ppmtowinicon.c
@@ -529,9 +529,9 @@ makePalette(pixel **          const xorPPMarray,
     xorChv = ppm_computecolorhist(xorPPMarray, xorCols, xorRows, MAXCOLORS, 
                                   &colors);
     if (xorChv == NULL)
-        asprintfN(errorP,
-                  "image has too many colors - try doing a 'pnmquant %d'",
-                  MAXCOLORS);
+        pm_asprintf(errorP,
+                    "image has too many colors - try doing a 'pnmquant %d'",
+                    MAXCOLORS);
     else {
         *errorP = NULL;
 
@@ -589,10 +589,10 @@ getOrFakeAndMap(const char *      const andPgmFname,
         pm_close(andfile);
 
         if ((andCols != xorCols) || (andRows != xorRows)) {
-            asprintfN(errorP,
-                      "And mask and image have different dimensions "
-                     "(%d x %d vs %d x %d).  Aborting.",
-                     andCols, xorCols, andRows, xorRows);
+            pm_asprintf(errorP,
+                        "And mask and image have different dimensions "
+                        "(%d x %d vs %d x %d).  Aborting.",
+                        andCols, xorCols, andRows, xorRows);
         } else
             *errorP = NULL;
     }
diff --git a/converter/ppm/ppmtoxpm.c b/converter/ppm/ppmtoxpm.c
index 0b6aea84..ff47359b 100644
--- a/converter/ppm/ppmtoxpm.c
+++ b/converter/ppm/ppmtoxpm.c
@@ -363,13 +363,13 @@ genCmap(colorhist_vector const chv,
 
             PPM_DEPTH(scaledColor, color, maxval, xpmMaxval);
 
-            asprintfN(&hexString, xpmMaxval == 0x000F ? "#%X%X%X" :
-                      xpmMaxval == 0x00FF ? "#%02X%02X%02X" :
-                      xpmMaxval == 0x0FFF ? "#%03X%03X%03X" :
-                      "#%04X%04X%04X", 
-                      PPM_GETR(scaledColor),
-                      PPM_GETG(scaledColor),
-                      PPM_GETB(scaledColor)
+            pm_asprintf(&hexString, xpmMaxval == 0x000F ? "#%X%X%X" :
+                        xpmMaxval == 0x00FF ? "#%02X%02X%02X" :
+                        xpmMaxval == 0x0FFF ? "#%03X%03X%03X" :
+                        "#%04X%04X%04X", 
+                        PPM_GETR(scaledColor),
+                        PPM_GETG(scaledColor),
+                        PPM_GETB(scaledColor)
                 );
 
             if (hexString == NULL)
@@ -399,7 +399,7 @@ destroyCmap(cixel_map *  const cmap,
     int i;
     /* Free the real color entries */
     for (i = 0; i < cmapSize; i++) {
-        strfree(cmap[i].rgbname);
+        pm_strfree(cmap[i].rgbname);
         free(cmap[i].cixel);
     }
     free(cmap);
diff --git a/converter/ppm/winicontoppm.c b/converter/ppm/winicontoppm.c
index 98fe0934..014eab40 100644
--- a/converter/ppm/winicontoppm.c
+++ b/converter/ppm/winicontoppm.c
@@ -639,11 +639,11 @@ writeXors(FILE *   const multiOutF,
     } else {
         if (outputFileBase) {
             if (multiple) {
-                asprintfN(&outputFile, "%s%s_%d.ppm",
-                          outputFileBase,(xor ? "_xor" : ""), entryNum);
+                pm_asprintf(&outputFile, "%s%s_%d.ppm",
+                            outputFileBase,(xor ? "_xor" : ""), entryNum);
             } else { 
-                asprintfN(&outputFile, "%s%s.ppm",
-                          outputFileBase,(xor ? "_xor" : ""));
+                pm_asprintf(&outputFile, "%s%s.ppm",
+                            outputFileBase,(xor ? "_xor" : ""));
             }
         } else
             outputFile = strdup("-");
@@ -690,7 +690,7 @@ writeXors(FILE *   const multiOutF,
                  (pixval) maxval, forcetext);
     ppm_freearray(ppm_array,entry->height);
 
-    strfree(outputFile);
+    pm_strfree(outputFile);
     
     if (!multiOutF) 
         pm_close(outF);
@@ -727,11 +727,12 @@ writeAnds(FILE * const multiOutF,
         assert(outputFileBase);
 
         if (multiple) 
-            asprintfN(&outputFile, "%s_and_%d.pbm", outputFileBase, entryNum);
+            pm_asprintf(&outputFile, "%s_and_%d.pbm",
+                        outputFileBase, entryNum);
         else 
-            asprintfN(&outputFile, "%s_and.pbm", outputFileBase);
+            pm_asprintf(&outputFile, "%s_and.pbm", outputFileBase);
         outF = pm_openw(outputFile);
-        strfree(outputFile);
+        pm_strfree(outputFile);
     }
     pbm_array = pbm_allocarray(entry->width, entry->height);
     for (row=0; row < entry->height; row++) {
@@ -760,8 +761,8 @@ openMultiXor(char          outputFileBase[],
     const char *outputFile;
 
     if (outputFileBase) {
-        asprintfN(&outputFile, "%s%s.ppm",
-                  outputFileBase, (writeands ? "_xor" : ""));
+        pm_asprintf(&outputFile, "%s%s.ppm",
+                    outputFileBase, (writeands ? "_xor" : ""));
     } else
         outputFile = strdup("-");
 
@@ -770,7 +771,7 @@ openMultiXor(char          outputFileBase[],
      */
     *multiOutFP = pm_openw(outputFile);
 
-    strfree(outputFile);
+    pm_strfree(outputFile);
 }
 
 
@@ -782,11 +783,11 @@ openMultiAnd(char outputFileBase[], FILE ** const multiAndOutFP) {
 
     assert(outputFileBase);
 
-    asprintfN(&outputFile, "%s_and.pbm", outputFileBase);
+    pm_asprintf(&outputFile, "%s_and.pbm", outputFileBase);
     
     *multiAndOutFP = pm_openw(outputFile);
 
-    strfree(outputFile);
+    pm_strfree(outputFile);
 }
 
 static void free_iconentry(IC_Entry entry) {
diff --git a/converter/ppm/yuvsplittoppm.c b/converter/ppm/yuvsplittoppm.c
index 029cec00..5343a21e 100644
--- a/converter/ppm/yuvsplittoppm.c
+++ b/converter/ppm/yuvsplittoppm.c
@@ -196,9 +196,9 @@ main(int argc, char **argv) {
 
     parseCommandLine(argc, argv, &cmdline);
         
-    asprintfN(&ufname, "%s.U", cmdline.filenameBase);
-    asprintfN(&vfname, "%s.V", cmdline.filenameBase);
-    asprintfN(&yfname, "%s.Y", cmdline.filenameBase);
+    pm_asprintf(&ufname, "%s.U", cmdline.filenameBase);
+    pm_asprintf(&vfname, "%s.V", cmdline.filenameBase);
+    pm_asprintf(&yfname, "%s.Y", cmdline.filenameBase);
 
     uf = pm_openr(ufname);
     vf = pm_openr(vfname);
@@ -241,9 +241,9 @@ main(int argc, char **argv) {
     }
     pm_close(stdout);
 
-    strfree(yfname);
-    strfree(vfname);
-    strfree(ufname);
+    pm_strfree(yfname);
+    pm_strfree(vfname);
+    pm_strfree(ufname);
 
     pm_close(yf);
     pm_close(uf);
diff --git a/editor/pambackground.c b/editor/pambackground.c
index c8df269e..c27d071d 100644
--- a/editor/pambackground.c
+++ b/editor/pambackground.c
@@ -182,7 +182,7 @@ determineBackgroundColor(struct pam * const pamP,
             pnm_colorname(pamP, *bgColorP, hexokTrue);
         pm_message("Background color is %s", colorname);
 
-        strfree(colorname);
+        pm_strfree(colorname);
     }
 
     pnm_freepamtuple(lr);
diff --git a/editor/pamdice.c b/editor/pamdice.c
index 64f671ca..2c53a110 100644
--- a/editor/pamdice.c
+++ b/editor/pamdice.c
@@ -223,9 +223,9 @@ computeOutputFilenameFormat(int           const format,
     default:       filenameSuffix = "";    break;
     }
     
-    asprintfN(filenameFormatP, "%s_%%0%uu_%%0%uu.%s",
-              outstem, ndigits(nHorizSlice), ndigits(nVertSlice),
-              filenameSuffix);
+    pm_asprintf(filenameFormatP, "%s_%%0%uu_%%0%uu.%s",
+                outstem, ndigits(nHorizSlice), ndigits(nVertSlice),
+                filenameSuffix);
 
     if (*filenameFormatP == NULL)
         pm_error("Unable to allocate memory for filename format string");
@@ -258,7 +258,7 @@ openOutStreams(struct pam   const inpam,
     for (vertSlice = 0; vertSlice < nVertSlice; ++vertSlice) {
         const char * filename;
 
-        asprintfN(&filename, filenameFormat, horizSlice, vertSlice);
+        pm_asprintf(&filename, filenameFormat, horizSlice, vertSlice);
 
         if (filename == NULL)
             pm_error("Unable to allocate memory for output filename");
@@ -273,10 +273,10 @@ openOutStreams(struct pam   const inpam,
             
             pnm_writepaminit(&outpam[vertSlice]);
 
-            strfree(filename);
+            pm_strfree(filename);
         }
     }        
-    strfree(filenameFormat);
+    pm_strfree(filenameFormat);
 }
 
 
diff --git a/editor/pamflip/pamflip.c b/editor/pamflip/pamflip.c
index 58b09ed9..6cbe4edf 100644
--- a/editor/pamflip/pamflip.c
+++ b/editor/pamflip/pamflip.c
@@ -107,7 +107,7 @@ parseXformOpt(const char *     const xformOpt,
     xformCount = 0; /* initial value */
     while (!eol && xformCount < 10) {
         const char * token;
-        token = strsepN(&cursor, ",");
+        token = pm_strsep(&cursor, ",");
         if (token) {
             if (streq(token, "leftright"))
                 xformList[xformCount++] = LEFTRIGHT;
diff --git a/editor/pamthreshold.c b/editor/pamthreshold.c
index ceddff15..15ed271a 100644
--- a/editor/pamthreshold.c
+++ b/editor/pamthreshold.c
@@ -103,15 +103,15 @@ parseGeometry(const char *   const wxl,
 
     char * const xPos = strchr(wxl, 'x');
     if (!xPos)
-        asprintfN(errorP, "There is no 'x'.  It should be WIDTHxHEIGHT");
+        pm_asprintf(errorP, "There is no 'x'.  It should be WIDTHxHEIGHT");
     else {
         *widthP  = atoi(wxl);
         *heightP = atoi(xPos + 1);
 
         if (*widthP == 0)
-            asprintfN(errorP, "Width is zero.");
+            pm_asprintf(errorP, "Width is zero.");
         else if (*heightP == 0)
-            asprintfN(errorP, "Height is zero.");
+            pm_asprintf(errorP, "Height is zero.");
         else
             *errorP = NULL;
     }
@@ -194,7 +194,7 @@ parseCommandLine(int                 argc,
 
         if (error) {
             pm_error("Invalid -local value '%s'.  %s", localOpt, error);
-            strfree(error);
+            pm_strfree(error);
         }
     } else
         cmdlineP->local = FALSE;
@@ -207,7 +207,7 @@ parseCommandLine(int                 argc,
 
         if (error) {
             pm_error("Invalid -dual value '%s'.  %s", dualOpt, error);
-            strfree(error);
+            pm_strfree(error);
         }
     } else
         cmdlineP->dual = FALSE;
diff --git a/editor/pamundice.c b/editor/pamundice.c
index 068453e6..93ce69f1 100644
--- a/editor/pamundice.c
+++ b/editor/pamundice.c
@@ -232,12 +232,12 @@ doSubstitution(const char *    const pattern,
 
             switch (pattern[inCursor]) {
             case 'a':
-                asprintfN(&substString, "%0*u", precision, file);
-                asprintfN(&desc, "file (across)");
+                pm_asprintf(&substString, "%0*u", precision, file);
+                pm_asprintf(&desc, "file (across)");
                 break;
             case 'd':
-                asprintfN(&substString, "%0*u", precision, rank);
-                asprintfN(&desc, "rank (down)");
+                pm_asprintf(&substString, "%0*u", precision, rank);
+                pm_asprintf(&desc, "rank (down)");
                 break;
             default:
                 pm_error("Unknown format specifier '%c' in input file "
@@ -253,8 +253,8 @@ doSubstitution(const char *    const pattern,
             else
                 buffer_addString(bufferP, substString);
             
-            strfree(desc);
-            strfree(substString);
+            pm_strfree(desc);
+            pm_strfree(substString);
 
             ++inCursor;
         }
@@ -288,7 +288,7 @@ computeInputFileName(const char *  const pattern,
             buffer_addChar(&buffer, pattern[inCursor++]);
     }
 
-    asprintfN(fileNameP, "%s", buffer.string);
+    pm_asprintf(fileNameP, "%s", buffer.string);
 
     buffer_term(&buffer);
 }
@@ -327,7 +327,7 @@ getCommonInfo(const char *   const inputFilePattern,
 
     pm_close(ifP);
 
-    strfree(fileName);
+    pm_strfree(fileName);
 }
 
 
@@ -344,7 +344,7 @@ openInputImage(const char * const inputFilePattern,
 
     retval = pm_openr(fileName);
     
-    strfree(fileName);
+    pm_strfree(fileName);
 
     return retval;
 }
diff --git a/editor/pnmconvol.c b/editor/pnmconvol.c
index 61effe70..d0b3b307 100644
--- a/editor/pnmconvol.c
+++ b/editor/pnmconvol.c
@@ -88,7 +88,7 @@ countMatrixOptColumns(const char *   const rowString,
         if (error) {
             pm_error("Unable to parse -matrix value row '%s'.  %s",
                      rowString, error);
-            strfree(error);
+            pm_strfree(error);
         } else {
             ++colCt;
 
@@ -97,7 +97,7 @@ countMatrixOptColumns(const char *   const rowString,
                 assert(*cursor == ',');
                 ++cursor;  /* advance over comma to next column */
             }
-            strfree(colString);
+            pm_strfree(colString);
         }
     }
     *colCtP = colCt;
@@ -133,7 +133,7 @@ getMatrixOptDimensions(const char *   const matrixOptString,
         if (error) {
             pm_error("Unable to parse -matrix value '%s'.  %s",
                      matrixOptString, error);
-            strfree(error);
+            pm_strfree(error);
         } else {
             unsigned int colCt;
             ++rowCt;
@@ -147,7 +147,7 @@ getMatrixOptDimensions(const char *   const matrixOptString,
                 pm_error("-matrix option value contains rows of different "
                          "widths: %u and %u", *widthP, colCt);
             }            
-            strfree(rowString);
+            pm_strfree(rowString);
             cursor = next;
 
             if (*cursor) {
@@ -178,7 +178,7 @@ parseMatrixRow(const char * const matrixOptRowString,
 
         if (error) {
             pm_error("Failed parsing a row in the -matrix value.  %s", error);
-            strfree(error);
+            pm_strfree(error);
         } else {
             if (colString[0] == '\0')
                 pm_error("The Column %u element of the row '%s' in the "
@@ -193,7 +193,7 @@ parseMatrixRow(const char * const matrixOptRowString,
                              "-matrix value is not a valid floating point "
                              "number", col, matrixOptRowString);
             }
-            strfree(colString);
+            pm_strfree(colString);
 
             cursor = next;
 
@@ -225,11 +225,11 @@ parseMatrixOptWithDimensions(const char * const matrixOptString,
 
         if (error) {
             pm_error("Failed parsing -matrix value.  %s", error);
-            strfree(error);
+            pm_strfree(error);
         } else {
             parseMatrixRow(rowString, width, weight[row]);
 
-            strfree(rowString);
+            pm_strfree(rowString);
 
             cursor = next;
 
@@ -701,7 +701,7 @@ parsePlaneFileLine(const char *   const line,
 
                 ++colCt;
         }
-        strfree(token);
+        pm_strfree(token);
     }
     *weightP = weight;
     *widthP = colCt;
@@ -768,7 +768,7 @@ readPlaneFile(FILE *         const ifP,
                     }                    
                     ++rowCt;
                 }
-                strfree(line);
+                pm_strfree(line);
             }
         }
     }
diff --git a/editor/pnmremap.c b/editor/pnmremap.c
index 88c40ce6..dcd4e2a5 100644
--- a/editor/pnmremap.c
+++ b/editor/pnmremap.c
@@ -268,7 +268,7 @@ selectDepthAdjustment(const struct pam * const pamP,
     if (newDepth == pamP->depth)
         *adjustmentP = ADJUST_NONE;
     else {
-        if (stripeq(pamP->tuple_type, "RGB")) {
+        if (pm_stripeq(pamP->tuple_type, "RGB")) {
             if (newDepth != 1) {
                 pm_error("Map image depth of %u differs from input image "
                          "depth of %u, and the tuple type is RGB.  "
@@ -277,8 +277,8 @@ selectDepthAdjustment(const struct pam * const pamP,
                          newDepth, pamP->depth);
             } else
                 *adjustmentP = ADJUST_RGBTO1;
-        } else if (stripeq(pamP->tuple_type, "GRAYSCALE") ||
-                   stripeq(pamP->tuple_type, "BLACKANDWHITE")) {
+        } else if (pm_stripeq(pamP->tuple_type, "GRAYSCALE") ||
+                   pm_stripeq(pamP->tuple_type, "BLACKANDWHITE")) {
             if (newDepth != 3) {
                 pm_error("Map image depth of %u differs from input image "
                          "depth of %u, and the tuple type is GRAYSCALE "
diff --git a/editor/pnmsmooth.c b/editor/pnmsmooth.c
index 67594ae5..a76bd42b 100644
--- a/editor/pnmsmooth.c
+++ b/editor/pnmsmooth.c
@@ -248,7 +248,7 @@ main(int argc, const char ** argv) {
 
         const char * matrixOpt;
 
-        asprintfN(&matrixOpt, "-matrix=%s", matrixOptValue);
+        pm_asprintf(&matrixOpt, "-matrix=%s", matrixOptValue);
 
         pm_message("Running Pnmconvol -normalize %s", matrixOpt);
 
@@ -256,9 +256,9 @@ main(int argc, const char ** argv) {
                      "pnmconvol", matrixOpt, cmdline.inputFilespec,
                      "-normalize", "-quiet", plainOpt, NULL);
 
-        strfree(matrixOpt);
+        pm_strfree(matrixOpt);
     }
-    strfree(matrixOptValue);
+    pm_strfree(matrixOptValue);
 
     return 0;
 }
diff --git a/editor/pnmstitch.c b/editor/pnmstitch.c
index 1246d060..e7887232 100644
--- a/editor/pnmstitch.c
+++ b/editor/pnmstitch.c
@@ -370,7 +370,7 @@ static void
 free_image(Image * image)
 {
     if (image->name) {
-        strfree(image->name);
+        pm_strfree(image->name);
         image->name = NULL;     
     }
     if (image->tuple) {
@@ -405,14 +405,14 @@ openWithPossibleExtension(const char *  const baseName,
         
         const char * trialName;
         
-        asprintfN(&trialName, "%s%s", baseName, extlist[extIndex]);
+        pm_asprintf(&trialName, "%s%s", baseName, extlist[extIndex]);
         
         ifP = fopen(trialName, "rb");
         
         if (ifP)
             *filenameP = trialName;
         else
-            strfree(trialName);
+            pm_strfree(trialName);
     }
     if (!ifP) 
         pm_error ("Failed to open input file named '%s' "
@@ -470,7 +470,7 @@ writeinit(Image * image)
 {
     if (streq(image->name, "-")) {
         image->pam.file = stdout;
-        strfree(image->name);
+        pm_strfree(image->name);
         image->name = strdup("<stdout>");
     } else {
         image->pam.file = pm_openw(image->name);
diff --git a/editor/ppmcolormask.c b/editor/ppmcolormask.c
index 0b2b2ee1..4e462f3e 100644
--- a/editor/ppmcolormask.c
+++ b/editor/ppmcolormask.c
@@ -59,7 +59,7 @@ parseColorOpt(const char *         const colorOpt,
     colorCount = 0; /* initial value */
     while (!eol && colorCount < ARRAY_SIZE(cmdlineP->maskColor)) {
         const char * token;
-        token = strsepN(&cursor, ",");
+        token = pm_strsep(&cursor, ",");
         if (token) {
             if (strneq(token, "bk:", 3)) {
                 cmdlineP->maskColor[colorCount].matchType = MATCH_BK;
diff --git a/editor/ppmdraw.c b/editor/ppmdraw.c
index 5d426e90..1305a313 100644
--- a/editor/ppmdraw.c
+++ b/editor/ppmdraw.c
@@ -288,10 +288,10 @@ freeDrawCommand(const struct drawCommand * const commandP) {
     case VERB_SETLINECLIP:
         break;
     case VERB_SETCOLOR:
-        strfree(commandP->u.setcolorArg.colorName);
+        pm_strfree(commandP->u.setcolorArg.colorName);
         break;
     case VERB_SETFONT:
-        strfree(commandP->u.setfontArg.fontFileName);
+        pm_strfree(commandP->u.setfontArg.fontFileName);
         break;
     case VERB_LINE:
         break;
@@ -305,7 +305,7 @@ freeDrawCommand(const struct drawCommand * const commandP) {
         break;
     case VERB_TEXT:
     case VERB_TEXT_HERE:
-        strfree(commandP->u.textArg.text);
+        pm_strfree(commandP->u.textArg.text);
         break;
     }
     
@@ -677,7 +677,7 @@ disposeOfCommandTokens(struct tokenSet * const tokenSetP,
     {
         unsigned int i;
         for (i = 0; i < tokenSetP->count; ++i)
-            strfree(tokenSetP->token[i]);
+            pm_strfree(tokenSetP->token[i]);
         tokenSetP->count = 0;
     }
     /* Put the list element for this command at the tail of the list */
@@ -828,7 +828,7 @@ getScript(struct cmdlineInfo const cmdline,
 
     parseScript(scriptText, scriptPP);
 
-    strfree(scriptText);
+    pm_strfree(scriptText);
 }
 
           
diff --git a/editor/specialty/pnmindex.c b/editor/specialty/pnmindex.c
index bbd637f3..1909c93a 100644
--- a/editor/specialty/pnmindex.c
+++ b/editor/specialty/pnmindex.c
@@ -59,7 +59,7 @@ systemf(const char * const fmt,
     
     va_start(varargs, fmt);
     
-    vsnprintfN(NULL, 0, fmt, varargs, &dryRunLen);
+    pm_vsnprintf(NULL, 0, fmt, varargs, &dryRunLen);
 
     va_end(varargs);
 
@@ -80,7 +80,7 @@ systemf(const char * const fmt,
 
             va_start(varargs, fmt);
 
-            vsnprintfN(shellCommand, allocSize, fmt, varargs, &realLen);
+            pm_vsnprintf(shellCommand, allocSize, fmt, varargs, &realLen);
                 
             assert(realLen == dryRunLen);
             va_end(varargs);
@@ -93,7 +93,7 @@ systemf(const char * const fmt,
                 pm_error("shell command '%s' failed.  rc %d",
                          shellCommand, rc);
             
-            strfree(shellCommand);
+            pm_strfree(shellCommand);
         }
     }
 }
@@ -184,7 +184,7 @@ freeCmdline(struct cmdlineInfo const cmdline) {
     unsigned int i;
 
     for (i = 0; i < cmdline.inputFileCount; ++i)
-        strfree(cmdline.inputFileName[i]);
+        pm_strfree(cmdline.inputFileName[i]);
 
     free(cmdline.inputFileName);
 
@@ -200,7 +200,7 @@ makeTempDir(const char ** const tempDirP) {
     const char * mytmpdir;
     int rc;
 
-    asprintfN(&mytmpdir, "%s/pnmindex_%d", tmpdir, getpid());
+    pm_asprintf(&mytmpdir, "%s/pnmindex_%d", tmpdir, getpid());
 
     rc = pm_mkdir(mytmpdir, 0700);
     if (rc != 0)
@@ -232,7 +232,7 @@ rowFileName(const char * const dirName,
 
     const char * fileName;
     
-    asprintfN(&fileName, "%s/pi.%u", dirName, row);
+    pm_asprintf(&fileName, "%s/pi.%u", dirName, row);
     
     return fileName;
 }
@@ -259,7 +259,7 @@ makeTitle(const char * const title,
             "> %s", 
             title, invertStage, fileName);
 
-    strfree(fileName);
+    pm_strfree(fileName);
 }
 
 
@@ -285,28 +285,28 @@ copyScaleQuantImage(const char * const inputFileName,
 
     switch (PNM_FORMAT_TYPE(format)) {
     case PBM_TYPE:
-        asprintfN(&scaleCommand, 
-                  "pamscale -quiet -xysize %u %u %s "
-                  "| pgmtopbm > %s",
-                  size, size, inputFileName, outputFileName);
+        pm_asprintf(&scaleCommand, 
+                    "pamscale -quiet -xysize %u %u %s "
+                    "| pgmtopbm > %s",
+                    size, size, inputFileName, outputFileName);
         break;
         
     case PGM_TYPE:
-        asprintfN(&scaleCommand, 
-                  "pamscale -quiet -xysize %u %u %s >%s",
-                  size, size, inputFileName, outputFileName);
+        pm_asprintf(&scaleCommand, 
+                    "pamscale -quiet -xysize %u %u %s >%s",
+                    size, size, inputFileName, outputFileName);
         break;
         
     case PPM_TYPE:
         if (quant)
-            asprintfN(&scaleCommand, 
-                      "pamscale -quiet -xysize %u %u %s "
-                      "| pnmquant -quiet %u > %s",
-                      size, size, inputFileName, colors, outputFileName);
+            pm_asprintf(&scaleCommand, 
+                        "pamscale -quiet -xysize %u %u %s "
+                        "| pnmquant -quiet %u > %s",
+                        size, size, inputFileName, colors, outputFileName);
         else
-            asprintfN(&scaleCommand, 
-                      "pamscale -quiet -xysize %u %u %s >%s",
-                      size, size, inputFileName, outputFileName);
+            pm_asprintf(&scaleCommand, 
+                        "pamscale -quiet -xysize %u %u %s >%s",
+                        size, size, inputFileName, outputFileName);
         break;
     default:
         pm_error("Unrecognized Netpbm format: %d", format);
@@ -314,7 +314,7 @@ copyScaleQuantImage(const char * const inputFileName,
 
     systemf("%s", scaleCommand);
 
-    strfree(scaleCommand);
+    pm_strfree(scaleCommand);
 }
 
 
@@ -340,7 +340,7 @@ thumbnailFileName(const char * const dirName,
 
     const char * fileName;
     
-    asprintfN(&fileName, "%s/pi.%u.%u", dirName, row, col);
+    pm_asprintf(&fileName, "%s/pi.%u.%u", dirName, row, col);
     
     return fileName;
 }
@@ -372,7 +372,7 @@ thumbnailFileList(const char * const dirName,
             strcat(list, " ");
             strcat(list, fileName);
         }
-        strfree(fileName);
+        pm_strfree(fileName);
     }
 
     return list;
@@ -420,7 +420,7 @@ makeThumbnail(const char *  const inputFileName,
     pnm_readpnminit(ifP, &imageCols, &imageRows, &maxval, &format);
     pm_close(ifP);
     
-    asprintfN(&tmpfile, "%s/pi.tmp", tempDir);
+    pm_asprintf(&tmpfile, "%s/pi.tmp", tempDir);
 
     if (imageCols < size && imageRows < size)
         copyImage(inputFileName, tmpfile);
@@ -434,8 +434,8 @@ makeThumbnail(const char *  const inputFileName,
 
     unlink(tmpfile);
 
-    strfree(fileName);
-    strfree(tmpfile);
+    pm_strfree(fileName);
+    pm_strfree(tmpfile);
 
     *formatP = format;
 }
@@ -454,7 +454,7 @@ unlinkThumbnailFiles(const char * const dirName,
 
         unlink(fileName);
 
-        strfree(fileName);
+        pm_strfree(fileName);
     }
 }
 
@@ -471,7 +471,7 @@ unlinkRowFiles(const char * const dirName,
 
         unlink(fileName);
 
-        strfree(fileName);
+        pm_strfree(fileName);
     }
 }
 
@@ -497,7 +497,7 @@ combineIntoRowAndDelete(unsigned int const row,
     unlink(fileName);
 
     if (maxFormatType == PPM_TYPE && quant)
-        asprintfN(&quantStage, "| pnmquant -quiet %u ", colors);
+        pm_asprintf(&quantStage, "| pnmquant -quiet %u ", colors);
     else
         quantStage = strdup("");
 
@@ -508,9 +508,9 @@ combineIntoRowAndDelete(unsigned int const row,
             ">%s",
             blackWhiteOpt, fileList, quantStage, fileName);
 
-    strfree(fileList);
-    strfree(quantStage);
-    strfree(fileName);
+    pm_strfree(fileList);
+    pm_strfree(quantStage);
+    pm_strfree(fileName);
 
     unlinkThumbnailFiles(tempDir, row, cols);
 }
@@ -542,7 +542,7 @@ rowFileList(const char * const dirName,
             strcat(list, " ");
             strcat(list, fileName);
         }
-        strfree(fileName);
+        pm_strfree(fileName);
     }
 
     return list;
@@ -564,7 +564,7 @@ writeRowsAndDelete(unsigned int const rows,
     const char * fileList;
     
     if (maxFormatType == PPM_TYPE && quant)
-        asprintfN(&quantStage, "| pnmquant -quiet %u ", colors);
+        pm_asprintf(&quantStage, "| pnmquant -quiet %u ", colors);
     else
         quantStage = strdup("");
 
@@ -573,8 +573,8 @@ writeRowsAndDelete(unsigned int const rows,
     systemf("pnmcat %s -topbottom %s %s",
             blackWhiteOpt, fileList, quantStage);
 
-    strfree(fileList);
-    strfree(quantStage);
+    pm_strfree(fileList);
+    pm_strfree(quantStage);
 
     unlinkRowFiles(tempDir, rows);
 }
diff --git a/generator/pamstereogram.c b/generator/pamstereogram.c
index 8292f2c1..807722de 100644
--- a/generator/pamstereogram.c
+++ b/generator/pamstereogram.c
@@ -1107,7 +1107,7 @@ readTextureImage(struct cmdlineInfo const cmdline,
                        cmdline.bgColorName, colorname);
         else
             pm_message("Texture background color: %s", colorname);
-        strfree(colorname);
+        pm_strfree(colorname);
     }
 
     if (texPamP->width != pamP->width || texPamP->height != pamP->height)
diff --git a/generator/pbmtextps.c b/generator/pbmtextps.c
index f05293a9..e2775bb9 100644
--- a/generator/pbmtextps.c
+++ b/generator/pbmtextps.c
@@ -174,11 +174,11 @@ construct_postscript(struct cmdlineInfo const cmdline) {
             "showpage\n";
 
     if (cmdline.stroke < 0)
-        asprintfN(&retval, template, cmdline.font, cmdline.fontsize, 
-                  cmdline.text);
+        pm_asprintf(&retval, template, cmdline.font, cmdline.fontsize, 
+                    cmdline.text);
     else
-        asprintfN(&retval, template, cmdline.font, cmdline.fontsize, 
-                  cmdline.stroke, cmdline.text);
+        pm_asprintf(&retval, template, cmdline.font, cmdline.fontsize, 
+                    cmdline.stroke, cmdline.text);
 
     return retval;
 }
@@ -273,10 +273,11 @@ gsCommand(const char *       const psFname,
          pm_error("Absurdly fine resolution (%u) and/or huge font size (%u). "
                   "Output height too large.", cmdline.res, cmdline.fontsize);
          
-    asprintfN(&retval, "%s -g%dx%d -r%d -sDEVICE=pbm "
-              "-sOutputFile=%s -q -dBATCH -dNOPAUSE %s </dev/null >/dev/null", 
-              gsExecutableName(), (int) x, (int) y, cmdline.res, 
-              outputFilename, psFname);
+    pm_asprintf(&retval, "%s -g%dx%d -r%d -sDEVICE=pbm "
+                "-sOutputFile=%s -q -dBATCH -dNOPAUSE %s "
+                "</dev/null >/dev/null", 
+                gsExecutableName(), (int) x, (int) y, cmdline.res, 
+                outputFilename, psFname);
 
     return retval;
 }
@@ -290,9 +291,9 @@ cropCommand(const char * const inputFileName) {
     const char * plainOpt = pm_plain_output ? "-plain" : "" ;
     
     if (cropExecutableName()) {
-        asprintfN(&retval, "%s -top -right %s %s", 
-                  cropExecutableName(), plainOpt, inputFileName);
-        if (retval == strsol)
+        pm_asprintf(&retval, "%s -top -right %s %s", 
+                    cropExecutableName(), plainOpt, inputFileName);
+        if (retval == pm_strsol)
             pm_error("Unable to allocate memory");
     } else
         retval = NULL;
@@ -324,7 +325,7 @@ writeProgram(const char *       const psFname,
 
     fclose(psfile);
 
-    strfree(ps);
+    pm_strfree(ps);
 }
 
 
@@ -348,7 +349,7 @@ executeProgram(const char *       const psFname,
     if (rc != 0)
         pm_error("Failed to run Ghostscript process.  rc=%d", rc);
 
-    strfree(com);
+    pm_strfree(com);
 }
 
 
@@ -397,7 +398,7 @@ cropToStdout(const char * const inputFileName,
             }
             fclose(pnmcrop);
         }
-        strfree(com);
+        pm_strfree(com);
     }
 }
 
@@ -411,25 +412,25 @@ createOutputFile(struct cmdlineInfo const cmdline) {
     const char * psFname;
     const char * uncroppedPbmFname;
 
-    asprintfN(&psFname, template, getpid(), "ps");
+    pm_asprintf(&psFname, template, getpid(), "ps");
     if (psFname == NULL)
         pm_error("Unable to allocate memory");
  
     writeProgram(psFname, cmdline);
 
-    asprintfN(&uncroppedPbmFname, template, getpid(), "pbm");
+    pm_asprintf(&uncroppedPbmFname, template, getpid(), "pbm");
     if (uncroppedPbmFname == NULL)
         pm_error("Unable to allocate memory");
  
     executeProgram(psFname, uncroppedPbmFname, cmdline);
 
     unlink(psFname);
-    strfree(psFname);
+    pm_strfree(psFname);
 
     cropToStdout(uncroppedPbmFname, cmdline.verbose);
 
     unlink(uncroppedPbmFname);
-    strfree(uncroppedPbmFname);
+    pm_strfree(uncroppedPbmFname);
 }
 
 
diff --git a/generator/ppmcie.c b/generator/ppmcie.c
index d2dd5e1a..e3712f09 100644
--- a/generator/ppmcie.c
+++ b/generator/ppmcie.c
@@ -1092,15 +1092,15 @@ writeLabel(pixel **                   const pixels,
 
     PPM_ASSIGN(rgbcolor, maxval, maxval, maxval);
     
-    snprintfN(sysdesc, sizeof(sysdesc),
-              "System: %s\n"
-              "Primary illuminants (X, Y)\n"
-              "     Red:  %0.4f, %0.4f\n"
-              "     Green: %0.4f, %0.4f\n"
-              "     Blue:  %0.4f, %0.4f\n"
-              "White point (X, Y): %0.4f, %0.4f",
-              cs->name, cs->xRed, cs->yRed, cs->xGreen, cs->yGreen,
-              cs->xBlue, cs->yBlue, cs->xWhite, cs->yWhite);
+    pm_snprintf(sysdesc, sizeof(sysdesc),
+                "System: %s\n"
+                "Primary illuminants (X, Y)\n"
+                "     Red:  %0.4f, %0.4f\n"
+                "     Green: %0.4f, %0.4f\n"
+                "     Blue:  %0.4f, %0.4f\n"
+                "White point (X, Y): %0.4f, %0.4f",
+                cs->name, cs->xRed, cs->yRed, cs->xGreen, cs->yGreen,
+                cs->xBlue, cs->yBlue, cs->xWhite, cs->yWhite);
     sysdesc[sizeof(sysdesc)-1] = '\0';  /* for robustness */
 
     ppmd_text(pixels, pixcols, pixrows, Maxval,
diff --git a/generator/ppmcolors.c b/generator/ppmcolors.c
index 6f6f5e99..701812d1 100644
--- a/generator/ppmcolors.c
+++ b/generator/ppmcolors.c
@@ -72,15 +72,16 @@ main(int argc, char *argv[]) {
 
     parseCommandLine(argc, argv, &cmdline);
 
-    asprintfN(&cmd, "pamseq 3 %u -tupletype=RGB | pamtopnm", cmdline.maxval);
+    pm_asprintf(&cmd, "pamseq 3 %u -tupletype=RGB | pamtopnm", cmdline.maxval);
 
     rc = system(cmd);
 
     if (rc != 0) 
         pm_error("pamseq|pamtopnm pipeline failed.  system() rc = %d", rc);
 
-    strfree(cmd);
-    exit(rc);
+    pm_strfree(cmd);
+
+    return rc;
 }
 
 
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
diff --git a/other/pamlookup.c b/other/pamlookup.c
index 41da4f2d..d5f046a5 100644
--- a/other/pamlookup.c
+++ b/other/pamlookup.c
@@ -94,7 +94,7 @@ fitLookup(tuple **     const inputLookup,
     fitLookuppamP->width = cols;
     fitLookuppamP->height = rows;
 
-    asprintfN(&pamscaleCommand, "pamscale -width=%u -height=%u", cols, rows);
+    pm_asprintf(&pamscaleCommand, "pamscale -width=%u -height=%u", cols, rows);
 
     inPamtuples.pamP = (struct pam *) &inputLookuppam;
     inPamtuples.tuplesP = (tuple ***) &inputLookup;
@@ -105,7 +105,7 @@ fitLookup(tuple **     const inputLookup,
               &pm_accept_to_pamtuples, &outPamtuples,
               pamscaleCommand);
 
-    strfree(pamscaleCommand);
+    pm_strfree(pamscaleCommand);
 }
 
 
diff --git a/other/pamsplit.c b/other/pamsplit.c
index eb1176e1..2c64d1a0 100644
--- a/other/pamsplit.c
+++ b/other/pamsplit.c
@@ -138,11 +138,11 @@ computeOutputName(char          const outputFilePattern[],
     afterSub = strstr(outputFilePattern, "%d") + 2;
 
     /* Make filenameFormat something like "%s%04u%s" */
-    asprintfN(&filenameFormat, "%%s%%0%ud%%s", padCount);
+    pm_asprintf(&filenameFormat, "%%s%%0%ud%%s", padCount);
 
-    asprintfN(outputNameP, filenameFormat, beforeSub, imageSeq, afterSub);
+    pm_asprintf(outputNameP, filenameFormat, beforeSub, imageSeq, afterSub);
 
-    strfree(filenameFormat);
+    pm_strfree(filenameFormat);
 
     free(beforeSub);
 }
@@ -179,7 +179,7 @@ main(int argc, char *argv[]) {
         extractOneImage(ifP, ofP);
 
         pm_close(ofP);
-        strfree(outputFileName);
+        pm_strfree(outputFileName);
 
         pnm_nextimage(ifP, &eof);
     }
diff --git a/other/pamx/pamx.c b/other/pamx/pamx.c
index 384cfd9d..dbb8b62a 100644
--- a/other/pamx/pamx.c
+++ b/other/pamx/pamx.c
@@ -360,7 +360,7 @@ main(int     argc,
     destroyViewer(viewerP);
 
     if (title)
-        strfree(title);
+        pm_strfree(title);
 
     XCloseDisplay(dispP);
 
diff --git a/other/pamx/window.c b/other/pamx/window.c
index 1a91416a..29f85d92 100644
--- a/other/pamx/window.c
+++ b/other/pamx/window.c
@@ -112,11 +112,11 @@ getInitialViewerGeometry(const char *   const geometryString,
         *userChoseP = TRUE;
     } else if (geometryString) {
         const char * defGeom;
-        asprintfN(&defGeom, "%ux%u+0+0", defaultWidth, defaultHeight);
+        pm_asprintf(&defGeom, "%ux%u+0+0", defaultWidth, defaultHeight);
         XGeometry(dispP, scrn, geometryString, defGeom, 0, 1, 1, 0, 0,
                   (int *)xposP, (int *)yposP,
                   (int *)widthP, (int *)heightP);
-        strfree(defGeom);
+        pm_strfree(defGeom);
         *userChoseP = TRUE;
     } else {
         *widthP     = defaultWidth;
@@ -1175,7 +1175,7 @@ displayInViewer(viewer *       const viewerP,
     {
         const char * const name = iconName(title);
         XSetIconName(viewerP->dispP, viewerP->viewportWin, name);
-        strfree(name);
+        pm_strfree(name);
     }
     setNormalSizeHints(viewerP, imageP);
 
diff --git a/other/ppmdcfont.c b/other/ppmdcfont.c
index 701277a9..130b6383 100644
--- a/other/ppmdcfont.c
+++ b/other/ppmdcfont.c
@@ -73,14 +73,14 @@ generateCommandTables(const struct ppmd_font * const fontP,
         if (fontP->glyphTable[relativeCodePoint].header.commandCount > 0) {
             const char * commandTableVariableName;
 
-            asprintfN(&commandTableVariableName, "%s_cmd_%u",
-                      glyphTableVariableName,
-                      fontP->header.firstCodePoint + relativeCodePoint);
+            pm_asprintf(&commandTableVariableName, "%s_cmd_%u",
+                        glyphTableVariableName,
+                        fontP->header.firstCodePoint + relativeCodePoint);
             
             generateCommandTable(fontP->glyphTable[relativeCodePoint],
                                  commandTableVariableName);
 
-            strfree(commandTableVariableName);
+            pm_strfree(commandTableVariableName);
 
             fprintf(stdout, "};\n");
             fprintf(stdout, "\n");
@@ -130,14 +130,14 @@ generateGlyphTable(const struct ppmd_font * const fontP,
 
         const char * commandTableVariableName;
 
-        asprintfN(&commandTableVariableName, "%s_cmd_%u",
-                  variableName,
-                  fontP->header.firstCodePoint + relativeCodePoint);
+        pm_asprintf(&commandTableVariableName, "%s_cmd_%u",
+                    variableName,
+                    fontP->header.firstCodePoint + relativeCodePoint);
         
         generateGlyph(fontP->glyphTable[relativeCodePoint],
                       commandTableVariableName);
 
-        strfree(commandTableVariableName);
+        pm_strfree(commandTableVariableName);
 
         if (relativeCodePoint < fontP->header.characterCount - 1)
             fprintf(stdout, "  ,\n");
@@ -184,7 +184,7 @@ main(int argc, char **argv) {
 
     fprintf(stdout, "#include \"ppmdfont.h\"\n\n");
 
-    asprintfN(&glyphTableVariableName, "%s_glyphTable", fontVariableName);
+    pm_asprintf(&glyphTableVariableName, "%s_glyphTable", fontVariableName);
 
     generateGlyphTable(fontP, glyphTableVariableName);
 
@@ -192,7 +192,7 @@ main(int argc, char **argv) {
         
     generateFont(fontP, fontVariableName, glyphTableVariableName);
 
-    strfree(glyphTableVariableName);
+    pm_strfree(glyphTableVariableName);
 
     ppmd_free_font(fontP);
     
diff --git a/urt/rle_open_f.c b/urt/rle_open_f.c
index 7234afe9..0f1fc757 100644
--- a/urt/rle_open_f.c
+++ b/urt/rle_open_f.c
@@ -199,11 +199,11 @@ dealWithSubprocess(const char *  const file_name,
         *noSubprocessP = FALSE;
         
         if (*mode == 'w')
-            asprintfN(&command, "compress > %s", file_name);
+            pm_asprintf(&command, "compress > %s", file_name);
         else if (*mode == 'a')
-            asprintfN(&command, "compress >> %s", file_name);
+            pm_asprintf(&command, "compress >> %s", file_name);
         else
-            asprintfN(&command, "compress -d < %s", file_name);
+            pm_asprintf(&command, "compress -d < %s", file_name);
         
         *fpP = my_popen(command, mode, &thepid);
 
@@ -215,7 +215,7 @@ dealWithSubprocess(const char *  const file_name,
             if (*catchingChildrenP < MAX_CHILDREN)
                 pids[(*catchingChildrenP)++] = thepid;
         }
-        strfree(command);
+        pm_strfree(command);
     } else {
         *noSubprocessP = TRUE;
         *errorP = NULL;