From: drh Date: Sun, 31 May 2009 21:21:40 +0000 (+0000) Subject: Code simplifications to facilitate coverage testing following the recent X-Git-Tag: version-3.6.15~63 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d6b8c43474a71c0796f0c4a9478ae6102bfa9098;p=thirdparty%2Fsqlite.git Code simplifications to facilitate coverage testing following the recent changes to the Expr object. (CVS 6697) FossilOrigin-Name: ee9a144d448a76f29c3ca03851c1aeef539068e2 --- diff --git a/manifest b/manifest index 7642639cb2..8934a52dfc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\s".genfkey"\scommand\sof\sthe\sCLI\sso\sthat\sit\sdoes\snot\sleak\smemory\nif\ssqlite3_realloc()\sfails.\s\sTicket\s#3891.\s(CVS\s6696) -D 2009-05-31T17:16:10 +C Code\ssimplifications\sto\sfacilitate\scoverage\stesting\sfollowing\sthe\srecent\nchanges\sto\sthe\sExpr\sobject.\s(CVS\s6697) +D 2009-05-31T21:21:41 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -101,7 +101,7 @@ F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad F src/alter.c 88b8cc66c09853b5723f66cfd0103dbebb62c562 F src/analyze.c e239496cfb5394ac8867f1c112905ddab8d01cd9 -F src/attach.c ad7eeae19c0844d3b329781c5a35ccda0a2010d2 +F src/attach.c 13995348fc5a26cdd136a50806faf292aabc173f F src/auth.c 98db07c2088455797678eb1031f42d4d94d18a71 F src/backup.c 437efc2c3371b52bbb943b8c9dfabba774adcf86 F src/bitvec.c ef370407e03440b0852d05024fb016b14a471d3d @@ -158,7 +158,7 @@ F src/printf.c 3f4dca207a88258d37af5a7a03e800a825fe6456 F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628 F src/resolve.c 42065c05d4dd56894d1ae232974668674435e468 F src/rowset.c c64dafba1f9fd876836c8db8682966b9d197eb1f -F src/select.c a3d8a0185e437e10adf82b69cd41c987bb2e58bb +F src/select.c 66de3fa81a0f7188ce180f30268f5e440992e260 F src/shell.c db2643650b9268df89a4bedca3f1c6d9e786f1bb F src/sqlite.h.in 79210c4d8905cfb4b038486dde5f36fabb796a86 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 @@ -201,7 +201,7 @@ F src/tokenize.c 75367c7e4d2aee39a3b0496911284b73de5b4363 F src/trigger.c c07c5157c58fcdb704f65d5f5e4775276e45bb8b F src/update.c 6ae6c26adff8dc34532d578f66e6cfde04b5d177 F src/utf.c 9541d28f40441812c0b40f00334372a0542c00ff -F src/util.c bb2bdd6dd0b51d13301dfb5bfba7abf070aef1dd +F src/util.c a9719d309f6c65b3b79fa3ca8512fa8e3947a391 F src/vacuum.c 981686c910b2ff9fe3db814e01da31cf9dbd48c7 F src/vdbe.c b859cb274024e5755aa03625251ff859e3e95158 F src/vdbe.h 35a648bc3279a120da24f34d9a25213ec15daf8a @@ -731,7 +731,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 164adf261d2536f16c83e44f6482dfb3d04a45d5 -R a7d342339bf9c4576f32028873e7110a +P a028d69c70ae961f418052a91aa1518e80a8ddf5 +R 577a8738dfa877f205c1813029ca8e55 U drh -Z 32569af168e17e03e21cd2b706954073 +Z f22ba38fbdb959a75c9eb1ef4191ba85 diff --git a/manifest.uuid b/manifest.uuid index ffd52e511c..7d15cfee9e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a028d69c70ae961f418052a91aa1518e80a8ddf5 \ No newline at end of file +ee9a144d448a76f29c3ca03851c1aeef539068e2 \ No newline at end of file diff --git a/src/attach.c b/src/attach.c index 9af765973e..d79f6e6022 100644 --- a/src/attach.c +++ b/src/attach.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the ATTACH and DETACH commands. ** -** $Id: attach.c,v 1.92 2009/05/28 01:00:55 drh Exp $ +** $Id: attach.c,v 1.93 2009/05/31 21:21:41 drh Exp $ */ #include "sqliteInt.h" @@ -313,7 +313,7 @@ static void codeAttach( #ifndef SQLITE_OMIT_AUTHORIZATION if( pAuthArg ){ char *zAuthArg = pAuthArg->u.zToken; - if( zAuthArg==0 ){ + if( NEVER(zAuthArg==0) ){ goto attach_end; } rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0); diff --git a/src/select.c b/src/select.c index ae9be5a10f..b40d3d205a 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.521 2009/05/30 20:49:20 drh Exp $ +** $Id: select.c,v 1.522 2009/05/31 21:21:41 drh Exp $ */ #include "sqliteInt.h" @@ -2818,7 +2818,7 @@ static int flattenSubquery( for(i=0; inExpr; i++){ if( pList->a[i].zName==0 ){ const char *zSpan = pList->a[i].zSpan; - if( zSpan ){ + if( ALWAYS(zSpan) ){ pList->a[i].zName = sqlite3DbStrDup(db, zSpan); } } diff --git a/src/util.c b/src/util.c index 00d13dd0c6..6d4ca2f441 100644 --- a/src/util.c +++ b/src/util.c @@ -14,7 +14,7 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.256 2009/05/28 01:00:55 drh Exp $ +** $Id: util.c,v 1.257 2009/05/31 21:21:41 drh Exp $ */ #include "sqliteInt.h" #include @@ -108,7 +108,7 @@ int sqlite3IsNaN(double x){ */ int sqlite3Strlen30(const char *z){ const char *z2 = z; - if( z==0 ) return 0; + if( NEVER(z==0) ) return 0; while( *z2 ){ z2++; } return 0x3fffffff & (int)(z2 - z); } @@ -171,14 +171,11 @@ void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){ va_list ap; sqlite3 *db = pParse->db; pParse->nErr++; - testcase( pParse->zErrMsg!=0 ); sqlite3DbFree(db, pParse->zErrMsg); va_start(ap, zFormat); pParse->zErrMsg = sqlite3VMPrintf(db, zFormat, ap); va_end(ap); - if( pParse->rc==SQLITE_OK ){ - pParse->rc = SQLITE_ERROR; - } + pParse->rc = SQLITE_ERROR; } /* @@ -450,9 +447,12 @@ int sqlite3Atoi64(const char *zNum, i64 *pNum){ } /* -** The string zNum represents an unsigned integer. There might be some other -** information following the integer too, but that part is ignored. -** If the integer that the prefix of zNum represents will fit in a +** The string zNum represents an unsigned integer. The zNum string +** consists of one or more digit characters and is terminated by +** a zero character. Any stray characters in zNum result in undefined +** behavior. +** +** If the unsigned integer that zNum represents will fit in a ** 64-bit signed integer, return TRUE. Otherwise return FALSE. ** ** If the negFlag parameter is true, that means that zNum really represents @@ -464,7 +464,7 @@ int sqlite3Atoi64(const char *zNum, i64 *pNum){ ** Leading zeros are ignored. */ int sqlite3FitsIn64Bits(const char *zNum, int negFlag){ - int i, c; + int i; int neg = 0; assert( zNum[0]>='0' && zNum[0]<='9' ); /* zNum is an unsigned number */ @@ -473,7 +473,7 @@ int sqlite3FitsIn64Bits(const char *zNum, int negFlag){ while( *zNum=='0' ){ zNum++; /* Skip leading zeros. Ticket #2454 */ } - for(i=0; (c=zNum[i])>='0' && c<='9'; i++){} + for(i=0; zNum[i]; i++){ assert( zNum[i]>='0' && zNum[i]<='9' ); } if( i<19 ){ /* Guaranteed to fit if less than 19 digits */ return 1;