d4228428913bd26a1031a2acc156a0b0d777ea45 kent Mon Jun 26 08:11:31 2017 -0700 Improving comments in csv.h. Make eraseTrailingSpaces keep track of number of spaces erased, and using this to keep a dyString->stringSize accurate. diff --git src/lib/common.c src/lib/common.c index c7cafb0..8f1921e 100644 --- src/lib/common.c +++ src/lib/common.c @@ -2131,45 +2131,51 @@ if (s == NULL) return NULL; for (;;) { c = *s; if (c == 0) return NULL; if (isspace(c)) return s; ++s; } } -void eraseTrailingSpaces(char *s) -/* Replace trailing white space with zeroes. */ +int eraseTrailingSpaces(char *s) +/* Replace trailing white space with zeroes. Returns number of + * spaces erased. */ { int len = strlen(s); int i; char c; +int erased = 0; for (i=len-1; i>=0; --i) { c = s[i]; if (isspace(c)) + { s[i] = 0; + ++erased; + } else break; } +return erased; } /* Remove white space from a string */ void eraseWhiteSpace(char *s) { char *in, *out; char c; in = out = s; for (;;) { c = *in++; if (c == 0) break; if (!isspace(c))