From 5f82e3cc3ad403f26ee89a27d1b9af30dbc613a5 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 6 Jul 2009 00:44:08 +0000 Subject: [PATCH] Simplifications and comment cleanup in vdbeaux.c. (CVS 6849) FossilOrigin-Name: 1636e7831a21d401a48aa74d884444a287f14f72 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/vdbeaux.c | 34 +++++++++++++++------------------- 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/manifest b/manifest index 983f2c002d..acec4ddbc4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sunreachable\scode\sfrom\sfunction\sbtreeCursor()\sin\sbtree.c.\s(CVS\s6848) -D 2009-07-04T17:16:01 +C Simplifications\sand\scomment\scleanup\sin\svdbeaux.c.\s(CVS\s6849) +D 2009-07-06T00:44:09 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -208,7 +208,7 @@ F src/vdbe.c bdf25930bddbf57b18a0be7b1127b357306d2094 F src/vdbe.h 35a648bc3279a120da24f34d9a25213ec15daf8a F src/vdbeInt.h 831c254a6eef237ef4664c8381a0137586567007 F src/vdbeapi.c 0ab8ada7260b32031ca97f338caecf0812460624 -F src/vdbeaux.c 3773217a73f93fb292d264b3b1da98c179a0f2f0 +F src/vdbeaux.c f62c8c83e9f21e13df6acaace8851f1de17cadc0 F src/vdbeblob.c a3f3e0e877fc64ea50165eec2855f5ada4477611 F src/vdbemem.c 1618f685d19b4bcc96e40b3c478487bafd2ae246 F src/vtab.c 00902f289521041712fb0293d0bf8688c7af8e48 @@ -740,7 +740,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 -P 133357d2f070ba303deddff59beead1ec8d10521 -R 59d54d3f3ef42572419a3b06be70cd73 -U danielk1977 -Z 270b59a313a8b2cb36f6d34f9f7ea02b +P c76a366ed4dc63604ff695b3ee9c183e430a367e +R ad4ffc2a251f0cb49d86125eb3a3f81a +U drh +Z 7f4c0366c55a62863a847bc059dca81a diff --git a/manifest.uuid b/manifest.uuid index e4d09636f6..c585d95171 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c76a366ed4dc63604ff695b3ee9c183e430a367e \ No newline at end of file +1636e7831a21d401a48aa74d884444a287f14f72 \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 455e725bf8..466b850436 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -14,7 +14,7 @@ ** to version 2.8.7, all this code was combined into the vdbe.c source file. ** But that file was getting too big so this subroutines were split out. ** -** $Id: vdbeaux.c,v 1.467 2009/06/26 16:32:13 shane Exp $ +** $Id: vdbeaux.c,v 1.468 2009/07/06 00:44:09 drh Exp $ */ #include "sqliteInt.h" #include "vdbeInt.h" @@ -869,7 +869,7 @@ int sqlite3VdbeList( Mem *pMem = p->pResultSet = &p->aMem[1]; assert( p->explain ); - if( p->magic!=VDBE_MAGIC_RUN ) return SQLITE_MISUSE; + assert( p->magic==VDBE_MAGIC_RUN ); assert( db->magic==SQLITE_MAGIC_BUSY ); assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY || p->rc==SQLITE_NOMEM ); @@ -1117,7 +1117,7 @@ void sqlite3VdbeMakeReady( ** first time this function is called for a given VDBE, not when it is ** being called from sqlite3_reset() to reset the virtual machine. */ - if( nVar>=0 && !db->mallocFailed ){ + if( nVar>=0 && ALWAYS(db->mallocFailed==0) ){ u8 *zCsr = (u8 *)&p->aOp[p->nOp]; u8 *zEnd = (u8 *)&p->aOp[p->nOpAlloc]; int nByte; @@ -1222,15 +1222,14 @@ void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){ } /* -** Close all cursors except for VTab cursors that are currently -** in use. +** Close all cursors. */ -static void closeAllCursorsExceptActiveVtabs(Vdbe *p){ +static void closeAllCursors(Vdbe *p){ int i; if( p->apCsr==0 ) return; for(i=0; inCursor; i++){ VdbeCursor *pC = p->apCsr[i]; - if( pC && (!p->inVtabMethod || !pC->pVtabCursor) ){ + if( pC ){ sqlite3VdbeFreeCursor(p, pC); p->apCsr[i] = 0; } @@ -1248,7 +1247,7 @@ static void Cleanup(Vdbe *p){ int i; sqlite3 *db = p->db; Mem *pMem; - closeAllCursorsExceptActiveVtabs(p); + closeAllCursors(p); for(pMem=&p->aMem[1], i=1; i<=p->nMem; i++, pMem++){ if( pMem->flags & MEM_RowSet ){ sqlite3RowSetClear(pMem->u.pRowSet); @@ -1709,7 +1708,7 @@ int sqlite3VdbeHalt(Vdbe *p){ if( p->db->mallocFailed ){ p->rc = SQLITE_NOMEM; } - closeAllCursorsExceptActiveVtabs(p); + closeAllCursors(p); if( p->magic!=VDBE_MAGIC_RUN ){ return SQLITE_OK; } @@ -2633,8 +2632,8 @@ int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){ goto idx_rowid_corruption; } lenRowid = sqlite3VdbeSerialTypeLen(typeRowid); - testcase( m.n-lenRowid==szHdr ); - if( unlikely(m.n-lenRowid