-C Additional\sspeed\senhancements\sin\sbtree.c.\s(CVS\s2935)
-D 2006-01-13T04:31:58
+C Minor\smodification\sto\srestoreOrClearCursorPosition()\sto\simprove\sefficiency.\sDo\snot\sallocate\sthe\sextra\s8-bytes\sif\smemory-management\sis\snot\senabled.\s(CVS\s2936)
+D 2006-01-13T06:33:24
F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a
F src/attach.c d4b9d8bd71d72409720946355be41cafb6c09079
F src/auth.c cdec356a5cd8b217c346f816c5912221537fe87f
-F src/btree.c 91943e07457ced1842ff93f331ab6bc1e277747e
+F src/btree.c 46061b59a71da48fb269a3ac318f560fe5c4f449
F src/btree.h 5663c4f43e8521546ccebc8fc95acb013b8f3184
-F src/build.c a055974683ddc465bdc8669d43d6ab35d3dbb55f
+F src/build.c 6db3dcb70ae17dcd303493c021e6dd233217828f
F src/callback.c ba3e6cc7a6beb562e7a66f92e26fabcb21aab1e2
F src/complete.c df1681cef40dec33a286006981845f87b194e7a4
F src/date.c 5b86bc41754ffffb2b5742fbd71ea687f01cc6ca
F src/delete.c c7bd5708a629585e073ce34cf3b1fcb52c2fef38
F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d
-F src/expr.c 3b6acdb4e254027fe72ce70054ea6b71c7d423a3
+F src/expr.c f885cfe73fb235635fba72e78bb858c64529771f
F src/func.c be4c026c1d2401f14c3186611e1131a895a3ca6e
F src/hash.c 8747cf51d12de46512880dfcf1b68b4e24072863
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
F src/os.c 1d1a61cdf150e9f9520a3bc787c8465148ea2e78
F src/os.h 9debc3d3ca4cdafde222a0ea74a4c8415aef4f22
-F src/os_common.h 78bcc34dded9b625b3c16d072b7e5b76d075a674
+F src/os_common.h 44783a37f78ab6e0dd5fa156530dbc58beadbba6
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
F src/os_unix.c bc35a237a10c2ecb5c5b038d31d20ecb098dcc7d
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
-F src/os_win.c 4ebb7e116e144d5bdfa4a0d4c31061d6f22b0736
+F src/os_win.c cd4ca2753aeaad11f5c9b9b6ef28752f45ed4529
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c a96b9c43664670576e41eac699277c7862d604d8
F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f
F src/parse.y 83df51fea35f68f7e07384d75dce83d1ed30434c
F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3
-F src/prepare.c 0f672b97f457a12aa775e46a90e40f71f1b7f680
+F src/prepare.c 1058dcb102005a880d757551d52a0a2830c05f27
F src/printf.c f47a2f4b5387cd2ebb12e9117a1a5d6bd9a2b812
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
-F src/select.c 7b19d350cb2a18ae4a59d6b87049aa2ce9c671ae
+F src/select.c 28d449c7762dd580aaba49a9c6c16e93ca951e49
F src/server.c e425729aa7ff374637033a38ba9fd9938c432244
F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da
F src/sqlite.h.in 492580f7e3ff71eb43193eb7bb98e2d549889ce3
-F src/sqliteInt.h e6f12c4a7393018715d4ffb71666f6799df44917
+F src/sqliteInt.h ed482d6de58fa79000f9c3bb00d7740126fb55fb
F src/table.c 486dcfce532685b53b5a2b5da8bba0ded6fb2316
F src/tclsqlite.c d650bea0248fc0a310ddc2cb94273a3a5021fddf
F src/test1.c 30ed0d4d594db0bb2beb98be7024cde1fe686f14
F src/tokenize.c 8b694d42b48f22c2037da7e1e716201aaaaa0f3a
F src/trigger.c 694b247476d2fc0dce003af564f79e8752fc1158
F src/update.c 261d75c702c2852d1a64274d7c414485e6f2d177
-F src/utf.c b7bffac4260177ae7f83c01d025fe0f5ed70ce71
-F src/util.c 1d751152ab36d2756deec68e576366f58b73968f
+F src/utf.c 5ab8ca05d4e9ec81174b010f01ab12a232f0087d
+F src/util.c b26be916edd1c991450cccc6503356c4f776598b
F src/vacuum.c 21a3c7f6f7be86bb1182fbc3df416ad702435b9e
-F src/vdbe.c f77826242cea1789990bc8ee590a30827d514475
+F src/vdbe.c 9e64780853ead129babe0c42462c7eb661e532f6
F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13
F src/vdbeInt.h 5451cf71f229e366ac543607c0a17f36e5737ea9
F src/vdbeapi.c afd3837cea0dec93dcb4724d073c84fa0da68e23
-F src/vdbeaux.c 23ff126058826a41405f1cd4bff800476d6c633c
+F src/vdbeaux.c 1d765d671ae31a067b2b064c3f193690f91eea62
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c dd08a0eea4868ac4a2d91fdec32424308b1db772
-F src/where.c a8ba7f4aa2f38166e9f89ecc5dafbdbf41942031
+F src/where.c a12b4542f6cee2f2180854c2e16bef84225866ec
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/all.test a23fcbbf1f53515bde840d78732a6d94c673b327
F test/alter.test b94b640063e725d062b2997bd2810ac39195c718
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P c780152f3cff9c0a13d231935ae3c2e2d28b4460
-R faee7b6f93f8c539141e3d35033db1a4
-U drh
-Z 5297e80bacccd6731d8a506f98111dd3
+P 48b550ce2ea43c7c1c59cd43d0008ba18fc0215b
+R 6c60b8d6c2a158ae481c8f06f49dfdff
+U danielk1977
+Z 1089e014c07372cc03784a37d45ba046
-48b550ce2ea43c7c1c59cd43d0008ba18fc0215b
\ No newline at end of file
+dd705955429d847af85ffaf248976bcd1d861852
\ No newline at end of file
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.295 2006/01/13 04:31:58 drh Exp $
+** $Id: btree.c,v 1.296 2006/01/13 06:33:24 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
** returning the cursor to it's saved position, any saved position is deleted
** and the cursor state set to CURSOR_INVALID.
*/
-static int restoreOrClearCursorPosition(BtCursor *pCur, int doSeek){
+static int restoreOrClearCursorPositionX(BtCursor *pCur, int doSeek){
int rc = SQLITE_OK;
- if( pCur->eState==CURSOR_REQUIRESEEK ){
- assert( sqlite3ThreadDataReadOnly()->useSharedData );
- if( doSeek ){
- rc = sqlite3BtreeMoveto(pCur, pCur->pKey, pCur->nKey, &pCur->skip);
- }else{
- pCur->eState = CURSOR_INVALID;
- }
- if( rc==SQLITE_OK ){
- sqliteFree(pCur->pKey);
- pCur->pKey = 0;
- assert( CURSOR_VALID==pCur->eState || CURSOR_INVALID==pCur->eState );
- }
+ assert( sqlite3ThreadDataReadOnly()->useSharedData );
+ assert( pCur->eState==CURSOR_REQUIRESEEK );
+ if( doSeek ){
+ rc = sqlite3BtreeMoveto(pCur, pCur->pKey, pCur->nKey, &pCur->skip);
+ }else{
+ pCur->eState = CURSOR_INVALID;
+ }
+ if( rc==SQLITE_OK ){
+ sqliteFree(pCur->pKey);
+ pCur->pKey = 0;
+ assert( CURSOR_VALID==pCur->eState || CURSOR_INVALID==pCur->eState );
}
return rc;
}
+#define restoreOrClearCursorPosition(p,x) \
+ (p->eState==CURSOR_REQUIRESEEK?restoreOrClearCursorPositionX(p,x):SQLITE_OK)
+
/*
** Query to see if btree handle p may obtain a lock of type eLock
** (READ_LOCK or WRITE_LOCK) on the table with root-page iTab. Return
** COMMIT
** ROLLBACK
**
-** $Id: build.c,v 1.378 2006/01/12 01:56:44 drh Exp $
+** $Id: build.c,v 1.379 2006/01/13 06:33:24 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
if( sqlite3LocateCollSeq(pParse, zType, nType) ){
Index *pIdx;
- p->aCol[i].zColl = sqlite3StrNDup(zType, nType);
+ p->aCol[i].zColl = sqliteStrNDup(zType, nType);
/* If the column is declared as "<name> PRIMARY KEY COLLATE <type>",
** then an index may have been created on this column before the
assert( pName1->z );
pColl = sqlite3FindCollSeq(db, ENC(db), (char*)pName1->z, pName1->n, 0);
if( pColl ){
- char *z = sqlite3StrNDup(pName1->z, pName1->n);
+ char *z = sqliteStrNDup(pName1->z, pName1->n);
if( z ){
reindexDatabases(pParse, z);
sqliteFree(z);
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.248 2006/01/11 21:41:22 drh Exp $
+** $Id: expr.c,v 1.249 2006/01/13 06:33:24 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
pExpr->iTable = ++pParse->nVar;
if( pParse->nVarExpr>=pParse->nVarExprAlloc-1 ){
pParse->nVarExprAlloc += pParse->nVarExprAlloc + 10;
- sqlite3ReallocOrFree((void**)&pParse->apVarExpr,
+ sqliteReallocOrFree((void**)&pParse->apVarExpr,
pParse->nVarExprAlloc*sizeof(pParse->apVarExpr[0]) );
}
if( !sqlite3ThreadDataReadOnly()->mallocFailed ){
** of the standard malloc(), realloc() and free() found in many operating
** systems. No rocket science here.
*/
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
void *sqlite3GenericMalloc(int n){
char *p = (char *)malloc(n+8);
assert(n>0);
int sqlite3GenericAllocationSize(void *p){
return p ? *(int *)((char *)p - 8) : 0;
}
+#else
+void *sqlite3GenericMalloc(int n){
+ char *p = (char *)malloc(n);
+ return (void *)p;
+}
+void *sqlite3GenericRealloc(void *p, int n){
+ assert(n>0);
+ p = realloc(p, n);
+ return p;
+}
+void sqlite3GenericFree(void *p){
+ assert(p);
+ free(p);
+}
+int sqlite3GenericAllocationSize(void *p){
+ assert(0);
+}
+#endif
if( cygwin_conv_to_full_win32_path(zRelative, zFull) ) return 0;
#elif OS_WINCE
/* WinCE has no concept of a relative pathname, or so I am told. */
- zFull = sqlite3StrDup(zRelative);
+ zFull = sqliteStrDup(zRelative);
#else
char *zNotUsed;
WCHAR *zWide;
** interface, and routines that contribute to loading the database schema
** from disk.
**
-** $Id: prepare.c,v 1.21 2006/01/12 12:43:36 drh Exp $
+** $Id: prepare.c,v 1.22 2006/01/13 06:33:24 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
** created using ATTACH statements. Return a success code. If an
** error occurs, write an error message into *pzErrMsg.
**
-** After the database is initialized, the SQLITE_Initialized
-** bit is set in the flags field of the sqlite structure.
+** After a database is initialized, the DB_SchemaLoaded bit is set
+** bit is set in the flags field of the Db structure. If the database
+** file was of zero-length, then the DB_Empty flag is also set.
*/
int sqlite3Init(sqlite3 *db, char **pzErrMsg){
int i, rc;
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
-** $Id: select.c,v 1.293 2006/01/11 21:41:22 drh Exp $
+** $Id: select.c,v 1.294 2006/01/13 06:33:24 danielk1977 Exp $
*/
#include "sqliteInt.h"
pCol->affinity = sqlite3ExprAffinity(p);
pColl = sqlite3ExprCollSeq(pParse, p);
if( pColl ){
- pCol->zColl = sqlite3StrDup(pColl->zName);
+ pCol->zColl = sqliteStrDup(pColl->zName);
}
}
pTab->iPKey = -1;
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.466 2006/01/12 17:20:51 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.467 2006/01/13 06:33:24 danielk1977 Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
#define sqliteFree(x) sqlite3FreeX(x)
#define sqliteAllocSize(x) sqlite3AllocSize(x)
+
/*
** An instance of this structure might be allocated to store information
** specific to a single thread.
** This file contains routines used to translate between UTF-8,
** UTF-16, UTF-16BE, and UTF-16LE.
**
-** $Id: utf.c,v 1.35 2005/12/15 22:34:01 drh Exp $
+** $Id: utf.c,v 1.36 2006/01/13 06:33:24 danielk1977 Exp $
**
** Notes on UTF-8:
**
sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8);
assert( m.flags & MEM_Term );
assert( m.flags & MEM_Str );
- return (m.flags & MEM_Dyn)!=0 ? m.z : sqlite3StrDup(m.z);
+ return (m.flags & MEM_Dyn)!=0 ? m.z : sqliteStrDup(m.z);
}
/*
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
-** $Id: util.c,v 1.169 2006/01/12 01:25:18 drh Exp $
+** $Id: util.c,v 1.170 2006/01/13 06:33:24 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
** is the number of bytes that were available to SQLite using pointer p,
** regardless of how much memory was actually allocated.
*/
+#if 0 /* This is never actually used */
int sqlite3AllocSize(void *p){
return OSSIZEOF(p);
}
+#endif
/*
** Make a copy of a string in memory obtained from sqliteMalloc(). These
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.526 2006/01/13 01:48:59 drh Exp $
+** $Id: vdbe.c,v 1.527 2006/01/13 06:33:24 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
/* FIX ME: This should be allocated as part of the vdbe at compile-time */
if( i>=p->contextStackDepth ){
p->contextStackDepth = i+1;
- sqlite3ReallocOrFree((void**)&p->contextStack, sizeof(Context)*(i+1));
+ sqliteReallocOrFree((void**)&p->contextStack, sizeof(Context)*(i+1));
if( p->contextStack==0 ) goto no_mem;
}
pContext = &p->contextStack[i];
assert( p->magic==VDBE_MAGIC_INIT );
if( i>=p->nLabelAlloc ){
p->nLabelAlloc = p->nLabelAlloc*2 + 10;
- sqlite3ReallocOrFree((void**)&p->aLabel,
+ sqliteReallocOrFree((void**)&p->aLabel,
p->nLabelAlloc*sizeof(p->aLabel[0]));
}
if( p->aLabel ){
** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
-** $Id: where.c,v 1.194 2006/01/11 21:41:22 drh Exp $
+** $Id: where.c,v 1.195 2006/01/13 06:33:25 danielk1977 Exp $
*/
#include "sqliteInt.h"
sqlite3VdbeAddOp(v, OP_Rewind, iTab, brk);
VdbeComment((v, "# %.*s", pX->span.n, pX->span.z));
pLevel->nIn++;
- sqlite3ReallocOrFree((void**)&pLevel->aInLoop,
+ sqliteReallocOrFree((void**)&pLevel->aInLoop,
sizeof(pLevel->aInLoop[0])*3*pLevel->nIn);
aIn = pLevel->aInLoop;
if( aIn ){