67ce69b2d6be585fcad3cb0dd5fc927e95c327ff chmalee Mon Oct 14 13:48:54 2019 -0700 Rework of hgHubConnect hub searching to not use trackDb or udc so searches can be sped up. The hubSearchText table now has an extra column for the parent track names (if any) of a search result to a track. hgHubConnect has been changed to use this field of the table instead of using trackDb. hubCrawl has been changed to generate this additional column, refs #23812 diff --git src/lib/common.c src/lib/common.c index 34ddb6c..2dc4671 100644 --- src/lib/common.c +++ src/lib/common.c @@ -2112,30 +2112,78 @@ } ++in; } if (*in == 0) break; /* Tag end of word with zero. */ if (outArray != NULL) *in = 0; /* And skip over the zero. */ in += 1; } return recordCount; } +int chopByCharRespectDoubleQuotes(char *in, char sep, char *outArray[], int outSize) +/* Chop a string into sep delimited strings but honor double quotes */ +{ +int recordCount = 0; +char c; +boolean quoting = FALSE; +for (;;) + { + if (outArray != NULL && recordCount >= outSize) + break; + + // skip initial sep + while ((*in) == sep) ++in; + if (*in == 0) + break; + + if (outArray != NULL) + outArray[recordCount] = in; + recordCount += 1; + quoting = FALSE; + for (;;) + { + if ((c = *in) == 0) + break; + if (quoting) + { + if (c == '"') + quoting = FALSE; + } + else + { + quoting = (c == '"'); + if (c == sep) + break; + } + ++in; + } + if (*in == 0) + break; + + // Tag end of word with zero + if (outArray != NULL) + *in = 0; + in += 1; + } +return recordCount; +} + int chopByChar(char *in, char chopper, char *outArray[], int outSize) /* Chop based on a single character. */ { int i; char c; if (*in == 0) return 0; for (i=0; (i