Index: src/btree.c ================================================================== --- src/btree.c +++ src/btree.c @@ -7,11 +7,11 @@ ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.408 2007/08/22 02:56:43 drh Exp $ +** $Id: btree.c,v 1.409 2007/08/22 11:41:18 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. ** Including a description of file format and an overview of operation. */ @@ -1370,17 +1370,14 @@ sqlite3_free(pBt->pSchema); sqlite3_free(pBt); } #ifndef SQLITE_OMIT_SHARED_CACHE - else{ - assert( p->wantToLock==0 ); - assert( p->locked==0 ); - assert( p->sharable ); - if( p->pPrev ) p->pPrev->pNext = p->pNext; - if( p->pNext ) p->pNext->pPrev = p->pPrev; - } + assert( p->wantToLock==0 ); + assert( p->locked==0 ); + if( p->pPrev ) p->pPrev->pNext = p->pNext; + if( p->pNext ) p->pNext->pPrev = p->pPrev; #endif sqlite3_free(p); return SQLITE_OK; } @@ -1480,14 +1477,14 @@ #if SQLITE_THREADSAFE && !defined(SQLITE_OMIT_SHARED_CACHE) /* ** Short-cuts for entering and leaving mutexes on a cursor. */ static void cursorLeave(BtCursor *p){ - sqlite3BtreeLeave(p->pBt); + sqlite3BtreeLeave(p->pBtree); } static void cursorEnter(BtCursor *pCur){ - sqlite3BtreeEnter(pCur->pBt); + sqlite3BtreeEnter(pCur->pBtree); } #else # define cursorEnter(X) # define cursorLeave(X) #endif /* !SQLITE_OMIT_SHARED_CACHE */ @@ -3757,11 +3754,10 @@ } do{ if( sqlite3BtreeIsRootPage(pPage) ){ *pRes = 1; pCur->eState = CURSOR_INVALID; - cursorLeave(pCur); return SQLITE_OK; } sqlite3BtreeMoveToParent(pCur); pPage = pCur->pPage; }while( pCur->idx>=pPage->nCell ); Index: src/sqliteInt.h ================================================================== --- src/sqliteInt.h +++ src/sqliteInt.h @@ -9,11 +9,11 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.596 2007/08/22 11:22:04 danielk1977 Exp $ +** @(#) $Id: sqliteInt.h,v 1.597 2007/08/22 11:41:18 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ #include "sqliteLimit.h" @@ -40,11 +40,11 @@ */ #if !defined(SQLITE_THREADSAFE) #if defined(THREADSAFE) # define SQLITE_THREADSAFE THREADSAFE #else -# define SQLTIE_THREADSAFE 1 +# define SQLITE_THREADSAFE 1 #endif #endif /* ** These #defines should enable >2GB file support on Posix if the Index: src/test4.c ================================================================== --- src/test4.c +++ src/test4.c @@ -9,11 +9,11 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the the SQLite library in a multithreaded environment. ** -** $Id: test4.c,v 1.20 2007/08/21 10:44:16 drh Exp $ +** $Id: test4.c,v 1.21 2007/08/22 11:41:18 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" #if defined(OS_UNIX) && OS_UNIX==1 && SQLITE_THREADSAFE #include @@ -139,18 +139,18 @@ if( threadset[i].busy ){ Tcl_AppendResult(interp, "thread ", argv[1], " is already running", 0); return TCL_ERROR; } threadset[i].busy = 1; - sqliteFree(threadset[i].zFilename); + sqlite3_free(threadset[i].zFilename); threadset[i].zFilename = sqlite3StrDup(argv[2]); threadset[i].opnum = 1; threadset[i].completed = 0; rc = pthread_create(&x, 0, thread_main, &threadset[i]); if( rc ){ Tcl_AppendResult(interp, "failed to create the thread", 0); - sqliteFree(threadset[i].zFilename); + sqlite3_free(threadset[i].zFilename); threadset[i].busy = 0; return TCL_ERROR; } pthread_detach(x); return TCL_OK; @@ -197,13 +197,13 @@ static void stop_thread(Thread *p){ thread_wait(p); p->xOp = 0; p->opnum++; thread_wait(p); - sqliteFree(p->zArg); + sqlite3_free(p->zArg); p->zArg = 0; - sqliteFree(p->zFilename); + sqlite3_free(p->zFilename); p->zFilename = 0; p->busy = 0; } /* @@ -473,11 +473,11 @@ Tcl_AppendResult(interp, "no such thread", 0); return TCL_ERROR; } thread_wait(&threadset[i]); threadset[i].xOp = do_compile; - sqliteFree(threadset[i].zArg); + sqlite3_free(threadset[i].zArg); threadset[i].zArg = sqlite3StrDup(argv[2]); threadset[i].opnum++; return TCL_OK; } @@ -568,11 +568,11 @@ Tcl_AppendResult(interp, "no such thread", 0); return TCL_ERROR; } thread_wait(&threadset[i]); threadset[i].xOp = do_finalize; - sqliteFree(threadset[i].zArg); + sqlite3_free(threadset[i].zArg); threadset[i].zArg = 0; threadset[i].opnum++; return TCL_OK; } Index: src/test7.c ================================================================== --- src/test7.c +++ src/test7.c @@ -10,11 +10,11 @@ ** ************************************************************************* ** Code for testing the client/server version of the SQLite library. ** Derived from test4.c. ** -** $Id: test7.c,v 1.7 2007/08/21 10:44:16 drh Exp $ +** $Id: test7.c,v 1.8 2007/08/22 11:41:18 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" /* @@ -161,18 +161,18 @@ if( threadset[i].busy ){ Tcl_AppendResult(interp, "thread ", argv[1], " is already running", 0); return TCL_ERROR; } threadset[i].busy = 1; - sqliteFree(threadset[i].zFilename); + sqlite3_free(threadset[i].zFilename); threadset[i].zFilename = sqlite3StrDup(argv[2]); threadset[i].opnum = 1; threadset[i].completed = 0; rc = pthread_create(&x, 0, client_main, &threadset[i]); if( rc ){ Tcl_AppendResult(interp, "failed to create the thread", 0); - sqliteFree(threadset[i].zFilename); + sqlite3_free(threadset[i].zFilename); threadset[i].busy = 0; return TCL_ERROR; } pthread_detach(x); sqlite3_server_start(); @@ -220,13 +220,13 @@ static void stop_thread(Thread *p){ client_wait(p); p->xOp = 0; p->opnum++; client_wait(p); - sqliteFree(p->zArg); + sqlite3_free(p->zArg); p->zArg = 0; - sqliteFree(p->zFilename); + sqlite3_free(p->zFilename); p->zFilename = 0; p->busy = 0; } /* @@ -504,11 +504,11 @@ Tcl_AppendResult(interp, "no such thread", 0); return TCL_ERROR; } client_wait(&threadset[i]); threadset[i].xOp = do_compile; - sqliteFree(threadset[i].zArg); + sqlite3_free(threadset[i].zArg); threadset[i].zArg = sqlite3StrDup(argv[2]); threadset[i].opnum++; return TCL_OK; } @@ -599,11 +599,11 @@ Tcl_AppendResult(interp, "no such thread", 0); return TCL_ERROR; } client_wait(&threadset[i]); threadset[i].xOp = do_finalize; - sqliteFree(threadset[i].zArg); + sqlite3_free(threadset[i].zArg); threadset[i].zArg = 0; threadset[i].opnum++; return TCL_OK; } @@ -643,11 +643,11 @@ Tcl_AppendResult(interp, "no such thread", 0); return TCL_ERROR; } client_wait(&threadset[i]); threadset[i].xOp = do_reset; - sqliteFree(threadset[i].zArg); + sqlite3_free(threadset[i].zArg); threadset[i].zArg = 0; threadset[i].opnum++; return TCL_OK; }