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/inc/localmem.h src/inc/localmem.h index 902afe1..c9b4632 100644 --- src/inc/localmem.h +++ src/inc/localmem.h @@ -24,44 +24,44 @@ size_t lmSize(struct lm *lm); // Returns current size of pool, even for memory already allocated void *lmAlloc(struct lm *lm, size_t size); /* Allocate memory from local pool. */ void *lmAllocMoreMem(struct lm *lm, void *pt, size_t oldSize, size_t newSize); /* Adjust memory size on a block, possibly relocating it. If block is grown, * new memory is zeroed. NOTE: in RARE cases, same pointer may be returned. */ void *lmCloneMem(struct lm *lm, void *pt, size_t size); /* Return a local mem copy of memory block. */ -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 of given size, adding null terminator. */ -char *lmCloneString(struct lm *lm, char *string); +char *lmCloneString(struct lm *lm, const char *string); /* Return local mem copy of string. */ -char *lmCloneFirstWord(struct lm *lm, char *line); +char *lmCloneFirstWord(struct lm *lm, const char *line); /* Clone first word in line */ -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. */ -struct slName *lmSlName(struct lm *lm, char *name); +struct slName *lmSlName(struct lm *lm, const char *name); /* Return slName in memory. */ #define lmAllocVar(lm, pt) (pt = lmAlloc(lm, sizeof(*pt))); /* Shortcut to allocating a single variable in local mem and * assigning pointer to it. */ #define lmCloneVar(lm, pt) lmCloneMem(lm, pt, sizeof((pt)[0])) /* Allocate copy of a structure. */ #define lmAllocArray(lm, pt, size) (pt = lmAlloc(lm, sizeof(*pt) * (size))) /* Shortcut to allocating an array in local mem and * assigning pointer to it. */ char **lmCloneRow(struct lm *lm, char **row, int rowSize); /* Allocate an array of strings and its contents cloned from row. */