13f82230e99ae409f1128dd1d4a668af3110379e tdreszer Mon Apr 18 14:12:51 2011 -0700 Streamlined and optimized continuation line code as Jim's suggests this is critical path. diff --git src/inc/linefile.h src/inc/linefile.h index 9760691..6a3d1ab 100644 --- src/inc/linefile.h +++ src/inc/linefile.h @@ -43,30 +43,31 @@ int lineStart; /* Offset of line in buffer. */ int lineEnd; /* End of line in buffer. */ bool zTerm; /* Replace '\n' with zero? */ enum nlType nlType; /* type of line endings: dos, unix, mac or undet */ bool reuse; /* Set if reusing input. */ char *buf; /* Buffer. */ struct pipeline *pl; /* pipeline if reading compressed */ struct metaOutput *metaOutput; /* list of FILE handles to write metaData to */ bool isMetaUnique; /* if set, do not repeat comments in output */ struct hash *metaLines; /* save lines to suppress repetition */ #ifdef USE_TABIX tabix_t *tabix; /* A tabix-compressed file and its binary index file (.tbi) */ ti_iter_t tabixIter; /* An iterator to get decompressed indexed lines of text */ #endif struct dyString *fullLine; // Filled with full line when a lineFileNextFull is called + struct dyString *rawLines; // Filled with raw lines used to create the full line boolean fullLineReuse; // If TRUE, next call to lineFileNextFull will get already built fullLine }; char *getFileNameFromHdrSig(char *m); /* Check if header has signature of supported compression stream, and return a phoney filename for it, or NULL if no sig found. */ struct lineFile *lineFileDecompressFd(char *name, bool zTerm, int fd); /* open a linefile with decompression from a file or socket descriptor */ struct lineFile *lineFileDecompressMem(bool zTerm, char *mem, long size); /* open a linefile with decompression from a memory stream */ struct lineFile *lineFileMayOpen(char *fileName, bool zTerm); /* Try and open up a lineFile. If fileName ends in .gz, .Z, or .bz2, @@ -84,32 +85,34 @@ struct lineFile *lineFileOnString(char *name, bool zTerm, char *s); /* Wrap a line file object around string in memory. This buffer * have zeroes written into it if zTerm is non-zero. It will * be freed when the line file is closed. */ void lineFileClose(struct lineFile **pLf); /* Close up a line file. */ void lineFileCloseList(struct lineFile **pList); /* Close up a list of line files. */ boolean lineFileNext(struct lineFile *lf, char **retStart, int *retSize); /* Fetch next line from file. */ -boolean lineFileNextFull(struct lineFile *lf, char **retStart, int *retSize); +boolean lineFileNextFull(struct lineFile *lf, char **retFull, int *retFullSize, + char **retRaw, int *retRawSize); // Fetch next line from file joining up any that are continued by ending '\' +// If requested, and was joined, the unjoined raw lines are also returned // NOTE: comment lines can't be continued! ("# comment \ \n more comment" is 2 lines.) boolean lineFileNextReal(struct lineFile *lf, char **retStart); /* Fetch next line from file that is not blank and * does not start with a '#'. */ 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. void lineFileNeedNext(struct lineFile *lf, char **retStart, int *retSize); /* Fetch next line from file. Squawk and die if it's not there. */ void lineFileReuse(struct lineFile *lf); /* Reuse current line. */