4d1e38588ee18350611bbe576a7ceb91d5812e65 angie Tue Apr 16 14:01:29 2019 -0700 Added const to declarations of some char * function params that are not modified, so I can use const in calling routines. diff --git src/lib/localmem.c src/lib/localmem.c index 422e355..012879c 100644 --- src/lib/localmem.c +++ src/lib/localmem.c @@ -123,84 +123,84 @@ return pt; } void *new = lmAlloc(lm, newSize); memcpy(new, pt, oldSize); return new; } void *lmCloneMem(struct lm *lm, void *pt, size_t size) /* Return a local mem copy of memory block. */ { void *d = lmAlloc(lm, size); memcpy(d, pt, size); return d; } -char *lmCloneStringZ(struct lm *lm, char *string, int size) +char *lmCloneStringZ(struct lm *lm, const char *string, int size) /* Return local mem copy of string. */ { if (string == NULL) return NULL; else { char *s = lmAlloc(lm, size+1); memcpy(s, string, size); return s; } } -char *lmCloneString(struct lm *lm, char *string) +char *lmCloneString(struct lm *lm, const char *string) /* Return local mem copy of string. */ { if (string == NULL) return NULL; else return lmCloneStringZ(lm, string, strlen(string)); } -char *lmCloneFirstWord(struct lm *lm, char *line) +char *lmCloneFirstWord(struct lm *lm, const char *line) /* Clone first word in line */ { char *startFirstWord = skipLeadingSpaces(line); if (startFirstWord == NULL) return NULL; char *endFirstWord = skipToSpaces(startFirstWord); if (endFirstWord == NULL) return lmCloneString(lm, startFirstWord); else return lmCloneStringZ(lm, startFirstWord, endFirstWord - startFirstWord); } -char *lmCloneSomeWord(struct lm *lm, char *line, int wordIx) +char *lmCloneSomeWord(struct lm *lm, const char *line, int wordIx) /* Return a clone of the given space-delimited word within line. Returns NULL if * not that many words in line. */ { if (wordIx < 0) return NULL; int i; for (i=0; iname, name); return n; } char **lmCloneRowExt(struct lm *lm, char **row, int rowOutSize, int rowInSize) /* Allocate an array of strings with rowOutSize elements. Clone the first rowInSize elements * of row into the new array, leaving others NULL if rowOutSize is greater than rowInSize. * rowOutSize must be greater than or equal to rowInSize. */ { if (rowOutSize < rowInSize)