From: drh Date: Mon, 8 Mar 2010 21:40:13 +0000 (+0000) Subject: Add NEVER and assert macros and explanatory comments for unreachable X-Git-Tag: version-3.7.2~550 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3517324ddcbb9f2d3b1aaa95d9e254071ca8ca08;p=thirdparty%2Fsqlite.git Add NEVER and assert macros and explanatory comments for unreachable conditions. FossilOrigin-Name: ffb6596e6c80e284c1542b03f2c7bbfce0bd87d9 --- diff --git a/manifest b/manifest index 42d3b8e174..f39cf0ce33 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,8 @@ -C Correct\san\sassert()\sin\smem2.c\s(test\scode\sonly). -D 2010-03-08T15:17:53 +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +C Add\sNEVER\sand\sassert\smacros\sand\sexplanatory\scomments\sfor\sunreachable\nconditions. +D 2010-03-08T21:40:14 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -152,7 +155,7 @@ F src/os_common.h 240c88b163b02c21a9f21f87d49678a0aa21ff30 F src/os_os2.c 75a8c7b9a00a2cf1a65f9fa4afbc27d46634bb2f F src/os_unix.c 148d2f625db3727250c0b880481ae7630b6d0eb0 F src/os_win.c 1c7453c2df4dab26d90ff6f91272aea18bcf7053 -F src/pager.c aafc314dee6e55be6cd6b4b1f9f8de62f0e1dfcc +F src/pager.c 80688c6fee918b7d9aa1c4911a0094d0ebbde31e F src/pager.h 1b32faf2e578ac3e7bcf9c9d11217128261c5c54 F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e F src/pcache.c 4956b41d6ba913f7a8a56fbf32be78caed0e45c2 @@ -215,7 +218,7 @@ F src/vdbe.c 8acca6dab2505e9650f6f014ada6ef30570cba99 F src/vdbe.h 471f6a3dcec4817ca33596fe7f6654d56c0e75f3 F src/vdbeInt.h ae1e6ba0dd3fb4a886898d2829d748be701b01f8 F src/vdbeapi.c 74c25680046a116b24b95393914d3669c23305dc -F src/vdbeaux.c 9089e0cdcc7ed3bc4564f2684ce84f5911973ea9 +F src/vdbeaux.c 0f352f63be78138bd94275aa3c8361e760ecc639 F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 @@ -792,7 +795,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 049cadf92bca5645a6f398eb83940344643fcacf -R 44531d6e0649c8c2f5ca2e5b3e312dbd -U dan -Z c0272962af3309a07b6881e16dadde1c +P 1a88e31b03e090732243a70bec082b32ecf77c43 +R f3874b1be973c593eaa7992a12823374 +U drh +Z dbb001cd92997e4a6d2ebb439d68c75a +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQFLlW7EoxKgR168RlERAlkoAJ0fWhVbW4P9ob39rp8EbDS9DHV3owCeML1P +pajE+dcM1CcoUySPiJbTQ40= +=fH93 +-----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 3c1d23795c..b09c126b13 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1a88e31b03e090732243a70bec082b32ecf77c43 \ No newline at end of file +ffb6596e6c80e284c1542b03f2c7bbfce0bd87d9 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 38c24df338..9844dafcd6 100644 --- a/src/pager.c +++ b/src/pager.c @@ -5007,6 +5007,7 @@ int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){ /* Only truncate if it is an in-memory sub-journal. */ if( sqlite3IsMemJournal(pPager->sjfd) ){ rc = sqlite3OsTruncate(pPager->sjfd, 0); + assert( rc==SQLITE_OK ); } pPager->nSubRec = 0; } diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 3612a1aa86..40a46ff673 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -2127,12 +2127,17 @@ int sqlite3VdbeHalt(Vdbe *p){ /* If eStatementOp is non-zero, then a statement transaction needs to ** be committed or rolled back. Call sqlite3VdbeCloseStatement() to ** do so. If this operation returns an error, and the current statement - ** error code is SQLITE_OK or SQLITE_CONSTRAINT, then set the error - ** code to the new value. + ** error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the + ** current statement error code. + ** + ** Note that sqlite3VdbeCloseStatement() can only fail if eStatementOp + ** is SAVEPOINT_ROLLBACK. But if p->rc==SQLITE_OK then eStatementOp + ** must be SAVEPOINT_RELEASE. Hence the NEVER(p->rc==SQLITE_OK) in + ** the following code. */ if( eStatementOp ){ rc = sqlite3VdbeCloseStatement(p, eStatementOp); - if( rc && (p->rc==SQLITE_OK || p->rc==SQLITE_CONSTRAINT) ){ + if( rc && (NEVER(p->rc==SQLITE_OK) || p->rc==SQLITE_CONSTRAINT) ){ p->rc = rc; sqlite3DbFree(db, p->zErrMsg); p->zErrMsg = 0;