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/inc/common.h src/inc/common.h index a28e4cd..230d0a8 100644 --- src/inc/common.h +++ src/inc/common.h @@ -102,32 +102,33 @@ #endif #endif /* Some other type synonyms */ #define UBYTE unsigned char /* Wants to be unsigned 8 bits. */ #define BYTE signed char /* Wants to be signed 8 bits. */ #define UWORD unsigned short /* Wants to be unsigned 16 bits. */ #define WORD short /* Wants to be signed 16 bits. */ #define bits64 unsigned long long /* Wants to be unsigned 64 bits. */ #define bits32 unsigned /* Wants to be unsigned 32 bits. */ #define bits16 unsigned short /* Wants to be unsigned 16 bits. */ #define bits8 unsigned char /* Wants to be unsigned 8 bits. */ #define signed32 int /* Wants to be signed 32 bits. */ #define bits8 unsigned char /* Wants to be unsigned 8 bits. */ -#define BIGNUM 0x3fffffff /* A really big number */ +#define BIGNUM 0x3fffffff /* A really big number but most subtraction won't cause overflow */ #define BIGDOUBLE 1.7E+308 /* Close to biggest double-precision number */ +#define BIGLONGLONG 0x3fffffffffffffff /* A really big long long value safe for a subtraction */ #define LIMIT_2or8GB (2147483647 * ((sizeof(size_t)/4)*(sizeof(size_t)/4))) /* == 2 Gb for 32 bit machines, 8 Gb for 64 bit machines */ #define LIMIT_2or6GB (2147483647 + (2147483647 * ((sizeof(size_t)/4)-1)) + \ (2147483647 * ((sizeof(size_t)/4)-1))) /* == 2 Gb for 32 bit machines, 6 Gb for 64 bit machines */ /* Default size of directory path, file name and extension string buffers */ #define PATH_LEN 512 #define FILENAME_LEN 128 #define FILEEXT_LEN 64 /* inline functions: To declare a function inline, place the entire function * in a header file and prefix it with the INLINE macro. If used with a * compiler that doesn't support inline, change the INLINE marco to be simply @@ -564,34 +565,30 @@ struct slName *slNameAddTail(struct slName **pList, char *name); /* Add name to end of list (not efficient for long lists), * and return it. */ struct slName *slNameCloneList(struct slName *list); /* Return clone of list. */ struct slName *slNameListFromString(char *s, char delimiter); /* Return list of slNames gotten from parsing delimited string. * The final delimiter is optional. a,b,c and a,b,c, are equivalent * for comma-delimited lists. */ #define slNameListFromComma(s) slNameListFromString(s, ',') /* Parse out comma-separated 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 *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. */ char *slNameListToString(struct slName *list, char delimiter); /* Return string created by joining all names with the delimiter. */ struct slName *slNameLoadReal(char *fileName); /* load file lines that are not blank or start with a '#' into a slName * list */ struct slName *slNameIntersection(struct slName *a, struct slName *b); /* return intersection of two slName lists. */ @@ -1007,33 +1004,30 @@ /* Return TRUE if there is white space in string. */ char *firstWordInLine(char *line); /* Returns first word in line if any (white space separated). * Puts 0 in place of white space after word. */ char *lastWordInLine(char *line); /* Returns last word in line if any (white space separated). * Returns NULL if string is empty. Removes any terminating white space * from line. */ char *nextWord(char **pLine); /* Return next word in *pLine and advance *pLine to next * word. Returns NULL when no more words. */ -char *nextWordRespectingQuotes(char **pLine); -// return next word but respects single or double quotes surrounding sets of words. - char *cloneFirstWord(char *line); /* Clone first word in line */ char *cloneNotFirstWord(char *s); /* Clone part of string after first word. */ char *nextTabWord(char **pLine); /* Return next tab-separated word. */ char *cloneFirstWordByDelimiterNoSkip(char *line,char delimit); /* Returns a cloned first word, not harming the memory passed in. * Does not skip leading white space.*/ char *cloneFirstWordByDelimiter(char *line,char delimit); /* Returns a cloned first word, not harming the memory passed in