4dc2ce3ec067b4ccb7987cbda16289d165954971
angie
  Thu Mar 9 20:04:39 2023 -0800
Translate multiple changes to the same codon correctly, collecting all mutations on the path from root to node.

diff --git src/lib/common.c src/lib/common.c
index 2931580..ac30338 100644
--- src/lib/common.c
+++ src/lib/common.c
@@ -329,30 +329,45 @@
 /* Free list */
 {
 struct slList **ppt = (struct slList**)listPt;
 struct slList *next = *ppt;
 struct slList *el;
 
 while (next != NULL)
     {
     el = next;
     next = el->next;
     freeMem((char*)el);
     }
 *ppt = NULL;
 }
 
+void slFreeListWithFunc(void *listPt, void (*freeFunc)())
+/* Free a list by calling freeFunc on each element.
+ * listPt must be a pointer to a pointer to some slList-compatible struct (&list).
+ * freeFunc must take one arg: a pointer to a pointer to the item it is going to free. */
+{
+struct slList **pList = (struct slList**)listPt;
+struct slList *el, *next;
+for (el = *pList; el != NULL; el = next)
+    {
+    next = el->next;
+    freeFunc(&el);
+    }
+*pList = NULL;
+}
+
 void slSort(void *pList, int (*compare )(const void *elem1,  const void *elem2))
 /* Sort a singly linked list with Qsort and a temporary array. */
 {
 struct slList **pL = (struct slList **)pList;
 struct slList *list = *pL;
 int count;
 count = slCount(list);
 if (count > 1)
     {
     struct slList *el;
     struct slList **array;
     int i;
     array = needLargeMem(count * sizeof(*array));
     for (el = list, i=0; el != NULL; el = el->next, i++)
         array[i] = el;