abffeaabe69569cce69dcbab139fd333eaf6641d
angie
  Fri Nov 20 10:01:16 2015 -0800
Libifying lmCloneRow, adding lmCloneRowExt for future use by annoStreamDb.

diff --git src/lib/localmem.c src/lib/localmem.c
index 50f62a1..422e355 100644
--- src/lib/localmem.c
+++ src/lib/localmem.c
@@ -186,15 +186,36 @@
     }
 return lmCloneFirstWord(lm, line);
 }
 
 
 struct slName *lmSlName(struct lm *lm, 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;
 }
 
+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;
+}
+
+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);
+}