8cec4ba176d633ac375b32125ccebc9a3bdb883f tdreszer Fri Apr 15 22:52:50 2011 -0700 Checked in minor changes from Jim's review. Only think of consequence here is the dyStringLen macro had been using strlen, when the stringSize is part of the structure diff --git src/lib/linefile.c src/lib/linefile.c index b8ea9a6..5adc7a2 100644 --- src/lib/linefile.c +++ src/lib/linefile.c @@ -673,43 +673,43 @@ errAbort("Expecting at least %d words line %d of %s got %d", expecting, lf->lineIx, lf->fileName, got); } void lineFileShort(struct lineFile *lf) /* Complain that line is too short. */ { errAbort("Short line %d of %s", lf->lineIx, lf->fileName); } void lineFileReuseFull(struct lineFile *lf) // Reuse last full line read. Unlike lineFileReuse, // lineFileReuseFull only works with previous lineFileNextFull call { assert(lf->fullLine != NULL); -lf->fullLineResuse = TRUE; +lf->fullLineReuse = TRUE; } boolean lineFileNextFull(struct lineFile *lf, char **retStart, int *retSize) // Fetch next line from file joining up any that are continued by ending '\' // NOTE: comment lines can't be continued! ("# comment \ \n more comment" is 2 lines.) { // May have requested reusing the last full line. -if (lf->fullLineResuse) +if (lf->fullLineReuse) { assert(lf->fullLine != NULL); - lf->fullLineResuse = FALSE; + lf->fullLineReuse = FALSE; *retStart = dyStringContents(lf->fullLine); if (retSize) *retSize = dyStringLen(lf->fullLine); return TRUE; } *retStart = NULL; // Initialize memory if needed if (lf->fullLine == NULL) lf->fullLine = dyStringNew(1024); dyStringClear(lf->fullLine); char *line; while (lineFileNext(lf, &line, NULL)) @@ -717,36 +717,37 @@ char *clippedText = skipLeadingSpaces(line); // Fill lf memory in case of continued lines if (dyStringLen(lf->fullLine) == 0) { dyStringAppend(lf->fullLine,line); // includes first line's whitespace. *retStart = dyStringContents(lf->fullLine); } else if (clippedText[0] != '\0') dyStringAppend(lf->fullLine,clippedText); // don't include continued line's leading spaces // Will the next line continue this one? if (clippedText[0] != '\0' && clippedText[0] != '#') // Comment lines can't be continued! { line = dyStringContents(lf->fullLine); - char *lastChar = lastNonWhitespaceChar(line); + char *lastChar = lastNonwhitespaceChar(line); if (lastChar != NULL && *lastChar == '\\') { if (lastChar > line && *(lastChar - 1) != '\\') // Not an escaped continuation char { - dyStringResize(lf->fullLine,(lastChar - line)); // This clips off the last char and any trailing white-space in dyString + // This clips off the last char and any trailing white-space in dyString + dyStringResize(lf->fullLine,(lastChar - line)); continue; } } } if (retSize) *retSize = dyStringLen(lf->fullLine); 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 '#'. */ {