345e4ee67a3c7afb41be7899635259f8745fefe3
kent
  Sat Jun 18 06:31:46 2022 -0700
Adding lmSlRef function.

diff --git src/lib/localmem.c src/lib/localmem.c
index 7030a53..3089257 100644
--- src/lib/localmem.c
+++ src/lib/localmem.c
@@ -237,30 +237,39 @@
     }
 return lmCloneFirstWord(lm, line);
 }
 
 
 struct slName *lmSlName(struct lm *lm, const char *name)
 /* Return slName in memory. */
 {
 struct slName *n;
 int size = sizeof(*n) + strlen(name) + 1;
 n = lmAlloc(lm, size);
 strcpy(n->name, name);
 return n;
 }
 
+struct slRef *lmSlRef(struct lm *lm, void *val)
+/* Return a new slRef pointing to val in local memory */
+{
+struct slRef *ref;
+lmAllocVar(lm, ref);
+ref->val = val;
+return ref;
+}
+
 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)
     errAbort("lmCloneRowExt: rowOutSize (%d) must be greater than or equal to rowInSize (%d)",
              rowOutSize, rowInSize);
 char **rowClone = NULL;
 lmAllocArray(lm, rowClone, rowOutSize);
 int i;
 for (i = 0;  i < rowInSize;  i++)
     rowClone[i] = lmCloneString(lm, row[i]);
 return rowClone;
 }