From: danielk1977 Date: Tue, 21 Apr 2009 18:20:45 +0000 (+0000) Subject: Move RowHashBlock.nUsed to RowHash.nUsed. Fix a typo in a comment in test_async.c... X-Git-Tag: version-3.6.15~217 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcc1f44020da1ee775354154fef7afc0b127c9db;p=thirdparty%2Fsqlite.git Move RowHashBlock.nUsed to RowHash.nUsed. Fix a typo in a comment in test_async.c. (CVS 6533) FossilOrigin-Name: 799d31d99fd18a6f99862433384e37d6747ee5b3 --- diff --git a/manifest b/manifest index 413b613cf6..de805fa934 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\ssegfault\sthat\sfollowed\sa\smalloc\sfailure\sintroduced\sby\s(6527).\s(CVS\s6532) -D 2009-04-21T17:23:05 +C Move\sRowHashBlock.nUsed\sto\sRowHash.nUsed.\sFix\sa\stypo\sin\sa\scomment\sin\stest_async.c.\s(CVS\s6533) +D 2009-04-21T18:20:45 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in fa5998fe08bd8c0fdc7f9f66cea16c0279f39da8 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -154,7 +154,7 @@ F src/prepare.c 72d74e6d3b9c8eb0663b33ec6438aa718096ac79 F src/printf.c ea2d76000cc5f4579d7e9cb2f5460433eec0d384 F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628 F src/resolve.c 094e44450371fb27869eb8bf679aacbe51fdc56d -F src/rowhash.c a62040abf905884c57d9a1e087287177d069b79a +F src/rowhash.c d1c45cce6d915c3fc161d7ca4110b2605bad471b F src/rowset.c badb9f36b3a2ced9ee9551f4ce730f5fab442791 F src/select.c 35225756c247484f473678e5bd191d70a6e4dba0 F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7 @@ -174,7 +174,7 @@ F src/test6.c 1a0a7a1f179469044b065b4a88aab9faee114101 F src/test7.c b94e68c2236de76889d82b8d7d8e00ad6a4d80b1 F src/test8.c b1061548f7ce3aeedea3cc4d649ee1487c2b4eaf F src/test9.c 963d380922f25c1c323712d05db01b19197ee6f7 -F src/test_async.c c820a2d21ef910cbef613ca55938fc8d7545c84a +F src/test_async.c 636451da68b7ff4a6d19b266441b2f28790967db F src/test_autoext.c f53b0cdf7bf5f08100009572a5d65cdb540bd0ad F src/test_backup.c 1384a18985a5a2d275c2662e48473bf1542ebd08 F src/test_btree.c d7b8716544611c323860370ee364e897c861f1b0 @@ -721,7 +721,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 72e1680904a354811cd2956bd57769ee2482c8bb -R 989dcd34a963ff2705fb442db350d830 +P 08e71b114087cfddd36c066265982172fcb41c9a +R b77c29ef28868f89dd8f3d82b37ff6ef U danielk1977 -Z ceeb6f394d7e82b624a231b4a7205ad5 +Z ca07415a779404049319849fe8aa519d diff --git a/manifest.uuid b/manifest.uuid index df568266c1..9c142827ad 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -08e71b114087cfddd36c066265982172fcb41c9a \ No newline at end of file +799d31d99fd18a6f99862433384e37d6747ee5b3 \ No newline at end of file diff --git a/src/rowhash.c b/src/rowhash.c index c1569ed297..28c344707c 100644 --- a/src/rowhash.c +++ b/src/rowhash.c @@ -31,7 +31,7 @@ ** The caller is responsible for insuring that there are no duplicate ** INSERTs. ** -** $Id: rowhash.c,v 1.3 2009/04/21 16:15:15 drh Exp $ +** $Id: rowhash.c,v 1.4 2009/04/21 18:20:45 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -125,7 +125,6 @@ struct RowHashElem { */ struct RowHashBlock { struct RowHashBlockData { - int nUsed; /* Num of aElem[] currently used in this block */ RowHashBlock *pNext; /* Next RowHashBlock object in list of them all */ } data; RowHashElem aElem[ROWHASH_ELEM_PER_BLOCK]; /* Available RowHashElem objects */ @@ -136,6 +135,7 @@ struct RowHashBlock { ** around and used as opaque handles by code in other modules. */ struct RowHash { + int nUsed; /* Number of used entries in first RowHashBlock */ int nEntry; /* Number of used entries over all RowHashBlocks */ int iBatch; /* The current insert batch number */ u8 nHeight; /* Height of tree of hash pages */ @@ -270,7 +270,9 @@ static int makeHashTable(RowHash *p, int iBatch){ /* Insert all values into the hash-table. */ for(pBlock=p->pBlock; pBlock; pBlock=pBlock->data.pNext){ - RowHashElem * const pEnd = &pBlock->aElem[pBlock->data.nUsed]; + RowHashElem * const pEnd = &pBlock->aElem[ + pBlock==p->pBlock?p->nUsed:ROWHASH_ELEM_PER_BLOCK + ]; RowHashElem *pIter; for(pIter=pBlock->aElem; pIteriVal); @@ -354,19 +356,20 @@ int sqlite3RowhashInsert(sqlite3 *db, RowHash **pp, i64 iVal){ /* If the current RowHashBlock is full, or if the first RowHashBlock has ** not yet been allocated, allocate one now. */ - if( !p->pBlock || p->pBlock->data.nUsed==ROWHASH_ELEM_PER_BLOCK ){ + if( !p->pBlock || p->nUsed==ROWHASH_ELEM_PER_BLOCK ){ RowHashBlock *pBlock = (RowHashBlock*)sqlite3Malloc(sizeof(RowHashBlock)); if( !pBlock ){ return SQLITE_NOMEM; } - pBlock->data.nUsed = 0; pBlock->data.pNext = p->pBlock; p->pBlock = pBlock; + p->nUsed = 0; } + assert( p->nUsed==(p->nEntry % ROWHASH_ELEM_PER_BLOCK) ); /* Add iVal to the current RowHashBlock. */ - p->pBlock->aElem[p->pBlock->data.nUsed].iVal = iVal; - p->pBlock->data.nUsed++; + p->pBlock->aElem[p->nUsed].iVal = iVal; + p->nUsed++; p->nEntry++; return SQLITE_OK; } diff --git a/src/test_async.c b/src/test_async.c index 40cd65d16b..9825279266 100644 --- a/src/test_async.c +++ b/src/test_async.c @@ -10,7 +10,7 @@ ** ************************************************************************* ** -** $Id: test_async.c,v 1.57 2009/04/07 11:21:29 danielk1977 Exp $ +** $Id: test_async.c,v 1.58 2009/04/21 18:20:45 danielk1977 Exp $ ** ** This file contains an example implementation of an asynchronous IO ** backend for SQLite. @@ -73,7 +73,7 @@ ** between the concurrency offered by "normal" SQLite and SQLite ** using the asynchronous backend. ** -** If connections from within multiple database files may access the +** If connections from within multiple processes may access the ** database file, the ENABLE_FILE_LOCKING symbol (see below) must be ** defined. If it is not defined, then no locks are established on ** the database file. In this case, if multiple processes access