921232ef9a1527f02356e2af8e19a28628fe1774 kent Sat Aug 17 12:59:18 2019 -0700 Adding lmJoinStrings. diff --git src/lib/localmem.c src/lib/localmem.c index de9bbcd..7030a53 100644 --- src/lib/localmem.c +++ src/lib/localmem.c @@ -267,15 +267,27 @@ char **lmCloneRow(struct lm *lm, char **row, int rowSize) /* Allocate an array of strings and its contents cloned from row. */ { return lmCloneRowExt(lm, row, rowSize, rowSize); } void lmRefAdd(struct lm *lm, struct slRef **pRefList, void *val) /* Add reference to list. */ { struct slRef *ref; lmAllocVar(lm, ref); ref->val = val; slAddHead(pRefList, ref); } + +char *lmJoinStrings(struct lm *lm, char *a, char *b) +/* Return concatenation of a and b allocated in lm */ +{ +int aSize = strlen(a); +int resSize = aSize + strlen(b) + 1; +char *output = lmAlloc(lm, resSize); +strcpy(output, a); +strcpy(output + aSize, b); +return output; +} +