diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2007-02-16 08:01:00 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2007-02-16 08:01:00 -0800 |
commit | 607c253cd2712bacce21ca9b98a848f331ea03a9 (patch) | |
tree | f1189c20d24fec46f4fef155de11d347144c59f3 /src/base/ver/verStream.c | |
parent | 5f3e4c0fe21ba5e24db0c187a616a28afc0dabae (diff) | |
download | abc-607c253cd2712bacce21ca9b98a848f331ea03a9.tar.gz abc-607c253cd2712bacce21ca9b98a848f331ea03a9.tar.bz2 abc-607c253cd2712bacce21ca9b98a848f331ea03a9.zip |
Version abc70216
Diffstat (limited to 'src/base/ver/verStream.c')
-rw-r--r-- | src/base/ver/verStream.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/base/ver/verStream.c b/src/base/ver/verStream.c index 0edbcdcb..eed322b9 100644 --- a/src/base/ver/verStream.c +++ b/src/base/ver/verStream.c @@ -307,9 +307,6 @@ void Ver_StreamSkipChars( Ver_Stream_t * p, char * pCharsToSkip ) // skip the symbols for ( pChar = p->pBufferCur; pChar < p->pBufferEnd; pChar++ ) { - // count the lines - if ( *pChar == '\n' ) - p->nLineCounter++; // skip symbols as long as they are in the list for ( pTemp = pCharsToSkip; *pTemp; pTemp++ ) if ( *pChar == *pTemp ) @@ -319,6 +316,9 @@ void Ver_StreamSkipChars( Ver_Stream_t * p, char * pCharsToSkip ) p->pBufferCur = pChar; return; } + // count the lines + if ( *pChar == '\n' ) + p->nLineCounter++; } // the file is finished or the last part continued // through VER_OFFSET_SIZE chars till the end of the buffer @@ -352,19 +352,18 @@ void Ver_StreamSkipToChars( Ver_Stream_t * p, char * pCharsToStop ) // skip the symbols for ( pChar = p->pBufferCur; pChar < p->pBufferEnd; pChar++ ) { - // count the lines - if ( *pChar == '\n' ) - p->nLineCounter++; // skip symbols as long as they are NOT in the list for ( pTemp = pCharsToStop; *pTemp; pTemp++ ) if ( *pChar == *pTemp ) break; if ( *pTemp == 0 ) // pChar is not found in the list + { + // count the lines + if ( *pChar == '\n' ) + p->nLineCounter++; continue; + } // the symbol is found - move position and return - if ( *pChar == '\n' ) - p->nLineCounter--; - // update buffer p->pBufferCur = pChar; return; } @@ -403,9 +402,6 @@ char * Ver_StreamGetWord( Ver_Stream_t * p, char * pCharsToStop ) p->nChars = 0; for ( pChar = p->pBufferCur; pChar < p->pBufferEnd; pChar++ ) { - // count the lines - if ( *pChar == '\n' ) - p->nLineCounter++; // skip symbols as long as they are NOT in the list for ( pTemp = pCharsToStop; *pTemp; pTemp++ ) if ( *pChar == *pTemp ) @@ -415,6 +411,9 @@ char * Ver_StreamGetWord( Ver_Stream_t * p, char * pCharsToStop ) p->pChars[p->nChars++] = *pChar; if ( p->nChars == VER_WORD_SIZE ) return NULL; + // count the lines + if ( *pChar == '\n' ) + p->nLineCounter++; continue; } // the symbol is found - move the position, set the word end, return the word |