37977956905d588f73ee5f635fae2f609cb40842 angie Wed Aug 9 12:52:00 2017 -0700 Assorted little util functions in support of adding HGVS output to hgVai -- refs #19968 diff --git src/inc/common.h src/inc/common.h index e54c5e0..200b1e3 100644 --- src/inc/common.h +++ src/inc/common.h @@ -635,30 +635,34 @@ void slPairAdd(struct slPair **pList, char *name, void *val); /* Add new slPair to head of list. */ void slPairFree(struct slPair **pEl); /* Free up struct and name. (Don't free up values.) */ void slPairFreeList(struct slPair **pList); /* Free up list. (Don't free up values.) */ void slPairFreeVals(struct slPair *list); /* Free up all values on list. */ void slPairFreeValsAndList(struct slPair **pList); /* Free up all values on list and list itself */ +void slPairFreeValsAndListExt(struct slPair **pList, void (*freeFunc)()); +/* Free up all values on list using freeFunc and list itself. freeFunc should take a simple + * pointer to free an item, and can be NULL. */ + struct slPair *slPairFind(struct slPair *list, char *name); /* Return list element of given name, or NULL if not found. */ void *slPairFindVal(struct slPair *list, char *name); /* Return value associated with name in list, or NULL if not found. */ struct slPair *slPairListFromString(char *str,boolean respectQuotes); // Return slPair list parsed from list in string like: [name1=val1 name2=val2 ...] // if respectQuotes then string can have double quotes: [name1="val 1" "name 2"=val2 ...] // resulting pair strips quotes: {name1}={val 1},{name 2}={val2} // Returns NULL if parse error. Free this up with slPairFreeValsAndList. #define slPairFromString(s) slPairListFromString(s,FALSE) char *slPairListToString(struct slPair *list,boolean quoteIfSpaces); // Returns an allocated string of pairs in form of [name1=val1 name2=val2 ...]