345e4ee67a3c7afb41be7899635259f8745fefe3 kent Sat Jun 18 06:31:46 2022 -0700 Adding lmSlRef function. diff --git src/inc/localmem.h src/inc/localmem.h index 274435d..e014fed 100644 --- src/inc/localmem.h +++ src/inc/localmem.h @@ -52,30 +52,33 @@ /* Return local mem copy of string of given size, adding null terminator. */ char *lmCloneString(struct lm *lm, const char *string); /* Return local mem copy of string. */ char *lmCloneFirstWord(struct lm *lm, const char *line); /* Clone first word in line */ 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, const char *name); /* Return slName in memory. */ +struct slRef *lmSlRef(struct lm *lm, void *val); +/* Return a new slRef pointing to val in local 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. */ char **lmCloneRowExt(struct lm *lm, char **row, int rowOutSize, int rowInSize);