about summary refs log tree commit diff
path: root/converter
diff options
context:
space:
mode:
Diffstat (limited to 'converter')
-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
33 files changed, 353 insertions, 352 deletions
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);