26ba96b7f67ea72bbc737211e5a7a475ece5754e kent Sat Jan 28 15:51:13 2017 -0800 Removing the kind of inconvenient and flaky-about-escapes function nextWordRespectingQuotes in common.h and replacing it with calls to the easier less flaky (and older) function nextQuotedWord in obscure.h. This fixed a bug in tagStormCheck which didn't deal with escapes in quoted strings right. Also added BIGLONGLONG to common.h for use similar to BIGNUM. Thought I'd need it in tagStormInfo to fix a bug in schema, but it turned out to be floating point rounding instead. diff --git src/lib/common.c src/lib/common.c index 647513e..f0681b6 100644 --- src/lib/common.c +++ src/lib/common.c @@ -790,61 +790,30 @@ e = strchr(s, delimiter); if (e == NULL) el = slNameNew(s); else { el = slNameNewN(s, e-s); e += 1; } slAddHead(&list, el); s = e; } slReverse(&list); return list; } -struct slName *slNameListOfUniqueWords(char *text,boolean respectQuotes) -// Return list of unique words found by parsing string delimited by whitespace. -// If respectQuotes then ["Lucy and Ricky" 'Fred and Ethyl'] will yield 2 slNames no quotes -{ -struct slName *list = NULL; -char *word = NULL; -while (text != NULL) - { - if (respectQuotes) - { - word = nextWordRespectingQuotes(&text); - if (word != NULL) - { - if (word[0] == '"') - stripChar(word, '"'); - else if (word[0] == '\'') - stripChar(word, '\''); - } - } - else - word = nextWord(&text); - if (word) - slNameStore(&list, word); - else - break; - } - -slReverse(&list); -return list; -} - struct slName *slNameListFromStringArray(char *stringArray[], int arraySize) /* Return list of slNames from an array of strings of length arraySize. * If a string in the array is NULL, the array will be treated as * NULL-terminated (shorter than arraySize). */ { char *s; struct slName *list = NULL, *el; int i; if (stringArray == NULL) return NULL; for (i = 0; i < arraySize; i++) { s = stringArray[i]; if (s == NULL) break; @@ -2319,59 +2288,30 @@ * word. */ { char *s = *pLine, *e; if (s == NULL || s[0] == 0) return NULL; s = skipLeadingSpaces(s); if (s[0] == 0) return NULL; e = skipToSpaces(s); if (e != NULL) *e++ = 0; *pLine = e; return s; } -char *nextWordRespectingQuotes(char **pLine) -// return next word but respects single or double quotes surrounding sets of words. -{ -char *s = *pLine, *e; -if (s == NULL || s[0] == 0) - return NULL; -s = skipLeadingSpaces(s); -if (s[0] == 0) - return NULL; -if (s[0] == '"') - { - e = skipBeyondDelimit(s+1,'"'); - if (e != NULL && !isspace(e[0])) - e = skipToSpaces(s); - } -else if (s[0] == '\'') - { - e = skipBeyondDelimit(s+1,'\''); - if (e != NULL && !isspace(e[0])) - e = skipToSpaces(s); - } -else - e = skipToSpaces(s); -if (e != NULL) - *e++ = 0; -*pLine = e; -return s; -} - char *nextTabWord(char **pLine) /* Return next tab-separated word. */ { char *s = *pLine; char *e; if (s == NULL || *s == '\n' || *s == 0) { *pLine = NULL; return NULL; } e = strchr(s, '\t'); if (e == NULL) { e = strchr(s, '\n'); if (e != NULL)