Bring the amalgamation builder up to date with the latest changes.
Remove some vestigial code. (CVS 4303)

FossilOrigin-Name: 0ae30e5c76d9094307ea086a9993a953631ab9da
diff --git a/manifest b/manifest
index 97f8b94..bfe1bc5 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Added\sthe\s34to35.html\sdocument\sdescribing\sthe\schanges\sbetween\s3.4.2\sand\n3.5.0.\s\sMinor\sinterface\scleanups.\s(CVS\s4302)
-D 2007-08-27T21:10:36
+C Bring\sthe\samalgamation\sbuilder\sup\sto\sdate\swith\sthe\slatest\schanges.\nRemove\ssome\svestigial\scode.\s(CVS\s4303)
+D 2007-08-27T21:49:34
 F Makefile.in 938f2769921fa1b30c633548f153804021eb1512
 F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -82,7 +82,7 @@
 F src/auth.c 083c1205b45e3f52291ec539d396b4fc557856b3
 F src/btree.c dbb8ec48e619fc4900f42cafffc7de90b4b21250
 F src/btree.h 76c89673981cb77575300c0b78a76eaa00a28743
-F src/btreeInt.h 7fc6e51dc3d4bbed15639a8ea1aae737631d6670
+F src/btreeInt.h c1ba892252bc4dd76ad66da056536c64b23456e3
 F src/build.c bc7406e2ea5bfa8276ee1abeae1db27a98fd0b33
 F src/callback.c a542236a68060caad378efa30006ca46cf77b1b2
 F src/complete.c b6dea59fb6d7b3201fa1e0e552cda8c2258a4f50
@@ -106,7 +106,7 @@
 F src/mutex.c adbad5e138e8caef8d3763280c75bfe2167812f6
 F src/os.c a8ed3c495161475dbce255f7003144144fb425f1
 F src/os.h 2bfbbad126a775e4d8c7d59eb4d9585a5fd7dfb5
-F src/os_common.h a5c446d3b93f09f369d13bf217de4bed3437dd1c
+F src/os_common.h 98862f120ca6bf7a48ce8b16f158b77d00bc9d2f
 F src/os_os2.c 8769301bff502de642ad2634cedcb77d967ce199
 F src/os_os2.h c3f7d0af7e3453d1d7aa81b06c0a56f5a226530b
 F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
@@ -127,7 +127,7 @@
 F src/shell.c ac29402b538515fa4697282387be9c1205e6e9eb
 F src/sqlite.h.in 4cf42ce749e4bdf13b9bb4959e91439c3ce8a054
 F src/sqlite3ext.h 9a26028378c288af500d8b94ed079666fed5806b
-F src/sqliteInt.h 13c908f5f156a192fcd247f993ac513bfaf81f53
+F src/sqliteInt.h 9c9dd856c473df112db821120ccc67081ec668e0
 F src/sqliteLimit.h 1bcbbdfa856f8b71b561abb31edb864b0eca1d12
 F src/table.c c725e47f6f3092b9a7b569fc58e408e2173ee008
 F src/tclsqlite.c d76af53f45c9e9f7f7d39531fa4c7bee7d0adad6
@@ -492,7 +492,7 @@
 F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf
 F tool/mkkeywordhash.c ef93810fc41fb3d3dbacf9a33a29be88ea99ffa9
 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
-F tool/mksqlite3c.tcl 9780738c0198f3708d5eb1790164aa2d56d096fc
+F tool/mksqlite3c.tcl bd66c13d7bc413678c027d68813d1d652916bac7
 F tool/mksqlite3internalh.tcl 47737a925fb02fce43e2c0a14b3cc17574a4d44a
 F tool/omittest.tcl e6b3d6a1285f9813bc1dea53bb522b4b72774710
 F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
@@ -562,7 +562,7 @@
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 5626ce0b5e249d48b56fdc4561ef663941eb23dc
-R 53f45ea77bc4d4516f85c7437592148c
+P 0791f917bb18d7305b805b9cbcb308bdd7b3a1f5
+R 064fae407176325cd808fe3b95f120b8
 U drh
-Z edf7af5b96ec397985d0784a02a0916d
+Z 10fbc2602f2fa4444b8003b4d5615f4f
diff --git a/manifest.uuid b/manifest.uuid
index 350afa3..90b5ecb 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-0791f917bb18d7305b805b9cbcb308bdd7b3a1f5
\ No newline at end of file
+0ae30e5c76d9094307ea086a9993a953631ab9da
\ No newline at end of file
diff --git a/src/btreeInt.h b/src/btreeInt.h
index d67a7cf..a491c8a 100644
--- a/src/btreeInt.h
+++ b/src/btreeInt.h
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btreeInt.h,v 1.9 2007/08/22 00:39:20 drh Exp $
+** $Id: btreeInt.h,v 1.10 2007/08/27 21:49:34 drh Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** For a detailed discussion of BTrees, refer to
@@ -623,7 +623,9 @@
 int sqlite3BtreeInitPage(MemPage *pPage, MemPage *pParent);
 void sqlite3BtreeParseCellPtr(MemPage*, u8*, CellInfo*);
 void sqlite3BtreeParseCell(MemPage*, int, CellInfo*);
+#ifdef SQLITE_TEST
 u8 *sqlite3BtreeFindCell(MemPage *pPage, int iCell);
+#endif
 int sqlite3BtreeRestoreOrClearCursorPosition(BtCursor *pCur);
 void sqlite3BtreeGetTempCursor(BtCursor *pCur, BtCursor *pTempCur);
 void sqlite3BtreeReleaseTempCursor(BtCursor *pCur);
diff --git a/src/os_common.h b/src/os_common.h
index 0c54405..8de4be9 100644
--- a/src/os_common.h
+++ b/src/os_common.h
@@ -125,74 +125,3 @@
 #else
 #define OpenCounter(X)
 #endif
-
-/*
-** sqlite3GenericMalloc
-** sqlite3GenericRealloc
-** sqlite3GenericOsFree
-** sqlite3GenericAllocationSize
-**
-** Implementation of the os level dynamic memory allocation interface in terms
-** of the standard malloc(), realloc() and free() found in many operating
-** systems. No rocket science here.
-**
-** There are two versions of these four functions here. The version
-** implemented here is only used if memory-management or memory-debugging is
-** enabled. This version allocates an extra 8-bytes at the beginning of each
-** block and stores the size of the allocation there.
-**
-** If neither memory-management or debugging is enabled, the second
-** set of implementations is used instead.
-*/
-#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || defined (SQLITE_MEMDEBUG)
-void *sqlite3GenericMalloc(int n){
-  char *p = (char *)malloc(n+8);
-  assert(n>0);
-  assert(sizeof(int)<=8);
-  if( p ){
-    *(int *)p = n;
-    p += 8;
-  }
-  return (void *)p;
-}
-void *sqlite3GenericRealloc(void *p, int n){
-  char *p2 = ((char *)p - 8);
-  assert(n>0);
-  p2 = (char*)realloc(p2, n+8);
-  if( p2 ){
-    *(int *)p2 = n;
-    p2 += 8;
-  }
-  return (void *)p2;
-}
-void sqlite3GenericFree(void *p){
-  assert(p);
-  free((void *)((char *)p - 8));
-}
-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);
-}
-/* Never actually used, but needed for the linker */
-int sqlite3GenericAllocationSize(void *p){ return 0; }
-#endif
-
-/*
-** The default size of a disk sector
-*/
-#ifndef PAGER_SECTOR_SIZE
-# define PAGER_SECTOR_SIZE 512
-#endif
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 7e0c59f..86951a3 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.600 2007/08/25 14:39:46 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.601 2007/08/27 21:49:34 drh Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -280,7 +280,6 @@
 typedef struct Parse Parse;
 typedef struct Select Select;
 typedef struct SrcList SrcList;
-typedef struct ThreadData ThreadData;
 typedef struct Table Table;
 typedef struct TableLock TableLock;
 typedef struct Token Token;
@@ -1533,11 +1532,11 @@
 void *sqlite3MallocZero(unsigned);
 void *sqlite3DbMallocZero(sqlite3*, unsigned);
 void *sqlite3DbMallocRaw(sqlite3*, unsigned);
-void *sqlite3ReallocOrFree(sqlite3*,void*,int);
 char *sqlite3StrDup(const char*);
 char *sqlite3StrNDup(const char*, int);
 char *sqlite3DbStrDup(sqlite3*,const char*);
 char *sqlite3DbStrNDup(sqlite3*,const char*, int);
+void *sqlite3DbReallocOrFree(sqlite3 *, void *, int);
 
 char *sqlite3MPrintf(sqlite3*,const char*, ...);
 char *sqlite3VMPrintf(sqlite3*,const char*, va_list);
@@ -1779,9 +1778,6 @@
 void sqlite3DefaultRowEst(Index*);
 void sqlite3RegisterLikeFunctions(sqlite3*, int);
 int sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*);
-ThreadData *sqlite3ThreadData(void);
-const ThreadData *sqlite3ThreadDataReadOnly(void);
-void sqlite3ReleaseThreadData(void);
 void sqlite3AttachFunctions(sqlite3 *);
 void sqlite3MinimumFileFormat(Parse*, int, int);
 void sqlite3SchemaFree(void *);
@@ -1792,12 +1788,9 @@
   void (*)(sqlite3_context*,int,sqlite3_value **),
   void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*));
 int sqlite3ApiExit(sqlite3 *db, int);
-void sqlite3FailedMalloc(void);
 void sqlite3AbortOtherActiveVdbes(sqlite3 *, Vdbe *);
 int sqlite3OpenTempDatabase(Parse *);
 
-void *sqlite3DbReallocOrFree(sqlite3 *, void *, int);
-sqlite3 *sqlite3DbOfVdbe(Vdbe *);
 
 /*
 ** The interface to the LEMON-generated parser
diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl
index d1e957d..9c4f291 100644
--- a/tool/mksqlite3c.tcl
+++ b/tool/mksqlite3c.tcl
@@ -199,6 +199,9 @@
    date.c
    os.c
 
+   mem1.c
+   mem2.c
+   mutex.c
    malloc.c
    printf.c
    random.c
@@ -221,6 +224,7 @@
    vdbeapi.c
    vdbe.c
    vdbeblob.c
+   journal.c
 
    expr.c
    alter.c