110dc66a0ea7bc9968f1985810ac83c80473f11b galt Tue Apr 19 04:30:31 2011 -0700 adding tolerance of leading spaces as required by a few naughty trackDb.ra files diff --git src/lib/common.c src/lib/common.c index 5ed0bbd..0c263a5 100644 --- src/lib/common.c +++ src/lib/common.c @@ -981,38 +981,38 @@ void *slPairFindVal(struct slPair *list, char *name) /* Return value associated with name in list, or NULL if not found. */ { struct slPair *el = slPairFind(list, name); if (el == NULL) return NULL; return el->val; } 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. { -if (isEmpty(str)) +char *s = skipLeadingSpaces(str); // Would like to remove this and tighten up the standard someday. +if (isEmpty(s)) return NULL; struct slPair *list = NULL; char name[1024]; char val[1024]; char buf[1024]; -char *s = str; bool inQuote = FALSE; char *b = buf; char sep = '='; char c = ' '; int mode = 0; while(1) { c = *s++; if (mode == 0 || mode == 2) // reading name or val { boolean term = FALSE; if (respectQuotes && b == buf && !inQuote && c == '"') inQuote = TRUE; else if (inQuote && c == '"') term = TRUE;