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