8acbd9b00d2ab8ffe06111a08903aacc475e8edf kent Thu Oct 24 17:17:36 2013 -0700 Adding lineFileNextRealWithSize. diff --git src/lib/linefile.c src/lib/linefile.c index c1a6291..a614d1e 100644 --- src/lib/linefile.c +++ src/lib/linefile.c @@ -812,45 +812,52 @@ *retFullSize = dyStringLen(lf->fullLine); if (retRaw != NULL && dyStringLen(lf->rawLines) > 0) // Only if actually requested & continued { // This is the final line which doesn't have a continuation char dyStringAppendN(lf->rawLines,line,(end - line)); *retRaw = dyStringContents(lf->rawLines); if (retRawSize) *retRawSize = dyStringLen(lf->rawLines); } return TRUE; } return FALSE; } -boolean lineFileNextReal(struct lineFile *lf, char **retStart) +boolean lineFileNextRealWithSize(struct lineFile *lf, char **retStart, int *retSize) /* Fetch next line from file that is not blank and - * does not start with a '#'. */ + * does not start with a '#'. Return size of line. */ { char *s, c; -while (lineFileNext(lf, retStart, NULL)) +while (lineFileNext(lf, retStart, retSize)) { s = skipLeadingSpaces(*retStart); c = s[0]; if (c != 0 && c != '#') return TRUE; } return FALSE; } +boolean lineFileNextReal(struct lineFile *lf, char **retStart) +/* Fetch next line from file that is not blank and + * does not start with a '#'. */ +{ +return lineFileNextRealWithSize(lf, retStart, NULL); +} + boolean lineFileNextFullReal(struct lineFile *lf, char **retStart) // Fetch next line from file that is not blank and does not start with a '#'. // Continuation lines (ending in '\') are joined into a single line. { while (lineFileNextFull(lf, retStart, NULL, NULL, NULL)) { char *clippedText = skipLeadingSpaces(*retStart); if (clippedText[0] != '\0' && clippedText[0] != '#') return TRUE; } return FALSE; } int lineFileChopNext(struct lineFile *lf, char *words[], int maxWords)