Fix gcc gripe about parens in a ||/&& in mergePosList().

Drop unused pBlob/nBlob in index_insert_term().
Fix NULL deref in an assertion in docListUpdate() delete case.
Minor code tightening in docListUpdate(). (CVS 3367)

FossilOrigin-Name: a6fcf9101a831bf5f129c6045eabf30376d365dc
This commit is contained in:
shess 2006-08-25 19:20:26 +00:00
parent b8b1421963
commit 0de250e46f
3 changed files with 16 additions and 23 deletions

View File

@ -294,14 +294,13 @@ static int docListUpdate(DocList *d, sqlite_int64 iDocid, DocList *pUpdate){
DocListReader reader;
char *p;
assert( d->iType==pUpdate->iType);
if( pUpdate!=NULL ){
assert( d->iType==pUpdate->iType);
assert( iDocid==firstDocid(pUpdate) );
}
readerInit(&reader, d);
while( !readerAtEnd(&reader) ){
if( peekDocid(&reader) >= iDocid ) break;
while( !readerAtEnd(&reader) && peekDocid(&reader)<iDocid ){
skipDocument(&reader);
}
@ -316,19 +315,15 @@ static int docListUpdate(DocList *d, sqlite_int64 iDocid, DocList *pUpdate){
/* Insert if indicated. */
if( pUpdate!=NULL ){
int iDoclist;
int nNeed;
int iDoclist = p-d->pData;
docListAddEndPos(pUpdate);
nNeed = pUpdate->nData;
iDoclist = p - d->pData;
d->pData = realloc(d->pData, d->nData+nNeed);
d->pData = realloc(d->pData, d->nData+pUpdate->nData);
p = d->pData + iDoclist;
memmove(p+nNeed, p, docListEnd(d) - p);
memcpy(p, pUpdate->pData, nNeed);
p += nNeed;
d->nData += nNeed;
memmove(p+pUpdate->nData, p, docListEnd(d) - p);
memcpy(p, pUpdate->pData, pUpdate->nData);
d->nData += pUpdate->nData;
modified = 1;
}
@ -413,7 +408,7 @@ static void mergePosList(DocListMerge *m, sqlite_int64 iDocid,
}
block_pos = readPosition(pBlockReader);
in_pos = readPosition(&m->in);
} else if( in_pos==-1 || block_pos!=-1 && block_pos-m->iOffset<in_pos ){
} else if( in_pos==-1 || (block_pos!=-1 && block_pos-m->iOffset<in_pos) ){
block_pos = readPosition(pBlockReader);
} else {
in_pos = readPosition(&m->in);
@ -1338,8 +1333,6 @@ static int index_insert_term(fulltext_vtab *v, const char *zTerm, int nTerm,
sqlite_int64 iFirst;
sqlite_int64 iIndexRow;
DocList doclist;
char *pBlob = NULL;
int nBlob = 0;
int rc = term_chunk_select(v, zTerm, nTerm, iDocid, &iFirst);
if( rc==SQLITE_DONE ){

View File

@ -1,5 +1,5 @@
C Documentation\supdates\sfor\sthe\snew\sSQLITE_FUNCTION\sauthorization.\s(CVS\s3366)
D 2006-08-24T15:18:25
C Fix\sgcc\sgripe\sabout\sparens\sin\sa\s||/&&\sin\smergePosList().\nDrop\sunused\spBlob/nBlob\sin\sindex_insert_term().\nFix\sNULL\sderef\sin\san\sassertion\sin\sdocListUpdate()\sdelete\scase.\nMinor\scode\stightening\sin\sdocListUpdate().\s(CVS\s3367)
D 2006-08-25T19:20:26
F Makefile.in 8e7f9ecebab2c6e0f3db20ff129a8f9405ab64f8
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -21,7 +21,7 @@ F ext/README.txt 913a7bd3f4837ab14d7e063304181787658b14e1
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b
F ext/fts1/ft_hash.h 1a35e654a235c2c662d3ca0dfc3138ad60b8b7d5
F ext/fts1/fulltext.c 373ee2d9d79eb46f09e95ca01d88b6ce62f85821
F ext/fts1/fulltext.c 2bf058ab2835531fa5fee4242c51eda19cfe88a7
F ext/fts1/fulltext.h 08525a47852d1d62a0be81d3fc3fe2d23b094efd
F ext/fts1/simple_tokenizer.c 289b7f35bf692e85834a7b599fd0a136e415a9eb
F ext/fts1/tokenizer.h 0c53421b832366d20d720d21ea3e1f6e66a36ef9
@ -388,7 +388,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 4547c81f7da29b1490c6eba8d9c333218c5cb88f
R 4e02aebf9882923b83a6bdd556e1b24b
U drh
Z 0629764da6fb062720dc2a83a77f2d2f
P e029637e54e190c89206725a99e1ee7db6c23804
R 9ce35272ab9df42e9d49ed3b7fe1ef36
U shess
Z 3eca536fbc68da4d34c55754ff00f971

View File

@ -1 +1 @@
e029637e54e190c89206725a99e1ee7db6c23804
a6fcf9101a831bf5f129c6045eabf30376d365dc