Convert an always-true condition in hash.c into an assert(). (CVS 6624)

FossilOrigin-Name: 4237299935b8bf8c346aacba021113224813bcb9
This commit is contained in:
drh 2009-05-09 23:29:12 +00:00
parent f3af63f941
commit 782b873bf5
3 changed files with 10 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Add\sthe\sSQLITE_TESTCTRL_ASSERT\sand\sSQLITE_TESTCTRL_ALWAYS\scodes\sfor\sthe\nsqlite3_test_control()\sinterface.\s(CVS\s6623)
D 2009-05-09T18:59:42
C Convert\san\salways-true\scondition\sin\shash.c\sinto\san\sassert().\s(CVS\s6624)
D 2009-05-09T23:29:12
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -118,7 +118,7 @@ F src/expr.c d2297420722d6ce17f967f22401233b3af878bb3
F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff
F src/func.c f667fe886309707c7178542073bb0ced00a9fae7
F src/global.c 448419c44ce0701104c2121b0e06919b44514c0c
F src/hash.c 7e90268f62662dc8ccb9da1e93090ea64481e4f8
F src/hash.c ebcaa921ffd9d86f7ea5ae16a0a29d1c871130a7
F src/hash.h 35b216c13343d0b4f87d9f21969ac55ad72174e1
F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb
F src/insert.c 050536ea91c6cf74d87a2386b5da241141943c94
@ -729,7 +729,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 999d507b4432b518cfc7e02e5b0a2473cf1980f6
R 7622fe4047e835c720d8ae4c0e1b4dfb
P 38df91c2edebee22d02b5f84260ee9e5e14db48e
R 32e092e7dc953c9fbb0f589e2f5e3cb3
U drh
Z 722579f0a12a6ae69b7dcb4fb246cb46
Z 7d43c43fd9901e26747295890c55279b

View File

@ -1 +1 @@
38df91c2edebee22d02b5f84260ee9e5e14db48e
4237299935b8bf8c346aacba021113224813bcb9

View File

@ -12,7 +12,7 @@
** This is the implementation of generic hash-tables
** used in SQLite.
**
** $Id: hash.c,v 1.37 2009/05/02 13:29:38 drh Exp $
** $Id: hash.c,v 1.38 2009/05/09 23:29:12 drh Exp $
*/
#include "sqliteInt.h"
#include <assert.h>
@ -265,7 +265,8 @@ void *sqlite3HashInsert(Hash *pH, const char *pKey, int nKey, void *data){
new_elem->data = data;
pH->count++;
if( pH->count>=10 && pH->count > 2*pH->htsize ){
if( rehash(pH, pH->count*2) && pH->htsize ){
if( rehash(pH, pH->count*2) ){
assert( pH->htsize>0 );
h = strHash(pKey, nKey) % pH->htsize;
}
}