]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fixes to 'configure' build system. Also extra coverage for main.c. (CVS 2204)
authordanielk1977 <danielk1977@noemail.net>
Thu, 13 Jan 2005 02:14:23 +0000 (02:14 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Thu, 13 Jan 2005 02:14:23 +0000 (02:14 +0000)
FossilOrigin-Name: 8378455f32c3010ccc28181048c746ecb8a9fa67

Makefile.in
manifest
manifest.uuid
src/expr.c
src/main.c
src/sqliteInt.h
src/test1.c
src/util.c
src/vdbemem.c
test/malloc.test

index 94f7af3f8ac2158b4885c9bfe2f023fd9fc08f58..039b5c41bd6387f14f1d45eb1639df8546f71f3b 100644 (file)
@@ -325,7 +325,7 @@ opcodes.lo: opcodes.c
        $(LTCOMPILE) -c opcodes.c
 
 opcodes.c:     opcodes.h $(TOP)/mkopcodec.awk
-       sort -n +2 opcodes.h | awk -f $(TOP)/mkopcodec.awk >opcodes.c
+       sort -n -b +2 opcodes.h | awk -f $(TOP)/mkopcodec.awk >opcodes.c
 
 opcodes.h:     parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
        cat parse.h $(TOP)/src/vdbe.c | awk -f $(TOP)/mkopcodeh.awk >opcodes.h
index f52cdb6c751e9dd840587a031d7f1f5e3e2d3dfa..6739ca4e51ecb92d13a2fc6c979b31a15d537326 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,6 +1,6 @@
-C Fix\sa\stest\sbug\sintroduce\swith\sthe\sprevious\scommit.\s(CVS\s2203)
-D 2005-01-12T13:04:55
-F Makefile.in ecf441ac5ca1ccfc8748a8a9537706e69893dfa4
+C Fixes\sto\s'configure'\sbuild\ssystem.\sAlso\sextra\scoverage\sfor\smain.c.\s(CVS\s2204)
+D 2005-01-13T02:14:24
+F Makefile.in 6ce51dde6a8fe82fc12f20dec750572f6a19f56a
 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
 F VERSION 342b6d5fde93b6d45023e2fee0163dda6464b9d6
@@ -35,13 +35,13 @@ F src/build.c af1296e8a21a406b4f4c4f1e1365e075071219f3
 F src/cursor.c f883813759742068890b1f699335872bfa8fdf41
 F src/date.c 65536e7ea04fdde6e0551264fca15966966e171f
 F src/delete.c 32277d2834e36c7538c047f14d643751c256c73b
-F src/expr.c d718509e56f58b06bc5f9b46afb295675334d544
+F src/expr.c ecfc8fd972e73650708e1109f97b1c5a785e0a0e
 F src/func.c dc188d862d7276ea897655b248e2cb17022686e3
 F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5
 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
 F src/insert.c f6b69e40e8938f63a2368cbcb5087a56098cf632
 F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
-F src/main.c 977c401767bce91952cd3c86f28c35efc1b50e75
+F src/main.c cbe5a05baabad9fabb733065d0fb00c0b36f6ef1
 F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
 F src/os.h c92a675533c75fea0f53559f34c7b91c5afe1a9d
 F src/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73
@@ -62,10 +62,10 @@ F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
 F src/select.c af6ffcf0201f8f4e2697eea25689077dc61c6109
 F src/shell.c e8f4f486cbf6e60d81173146ac8a6522c930fa51
 F src/sqlite.h.in 0d5e48e506845b74a845c9470e01d3f472b59611
-F src/sqliteInt.h 087d21946d79c6eec1b84a32122def5fd99ee03b
+F src/sqliteInt.h 641b348a109a080262d9f3603f2e94143d4383f2
 F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
 F src/tclsqlite.c 8419f424ebcc6ae0d391f21a991638cb20c2ffc6
-F src/test1.c 540e1f51cf37d5a05871562e87d976909ab517a1
+F src/test1.c 2e27b110ba5aa16977bad1cc2388553479d73793
 F src/test2.c b11fa244fff02190707dd0879987c37c75e61fc8
 F src/test3.c a72f20066cccd5a7b9f20b7b78fa9b05b47b3020
 F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
@@ -74,14 +74,14 @@ F src/tokenize.c c1d124ec41422c9ec14360ea3a1f98ca4acf7cf1
 F src/trigger.c 98f3b07c08ba01b34cff139ef9687883d325ae8e
 F src/update.c 0979397c41ac29c54fe0cc687a356d8629a633af
 F src/utf.c 9bece2c7b94d9002ab1bb900a7658c6f826b0f74
-F src/util.c 4511559caf83e70a036deb5c56f10ddf35a688fb
+F src/util.c 03ba0b0b83b14a2ddbc0aaac0681c92c8ebb0b0c
 F src/vacuum.c 1a9db113a027461daaf44724c71dd1ebbd064203
 F src/vdbe.c a89bb4eefa60226ddfdf8e708ea9352c0a124da3
 F src/vdbe.h 067ca8d6750ba4f69a50284765e5883dee860181
 F src/vdbeInt.h f2b5f54d9881bbc89fff02d95f3f825ade68bce2
 F src/vdbeapi.c 0cf3bdc1072616bedc8eec7fc22e3f5a169d33fd
 F src/vdbeaux.c 0675db9f7f801b36e2e71504f5380feeadba56bc
-F src/vdbemem.c 5d9fd8de5d4f5d1f3446c9a90a7b3f8c38557821
+F src/vdbemem.c 62fe89471b656a922e9879be005abf690509ead3
 F src/where.c 3a0d08505e298242f6f151f019a05129a4f8704c
 F tclinstaller.tcl 36478c3bbfc5b93ceac42d94e3c736937b808432
 F test/all.test 387e2e3bed9325bfdc538ebb7f2238cce69620e9
@@ -150,7 +150,7 @@ F test/lock.test a19aab9a963273fe61c1058e3d1b648d6a0a2425
 F test/lock2.test 59c3dd7d9b24d1bf7ec91b2d1541c37e97939d5f
 F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
 F test/main.test a60a1d234b5f5784097973bd395514ca56003ef1
-F test/malloc.test ad87a748a74026817ba09698b1fc9106fcab23c1
+F test/malloc.test 73fa135dac192bc47162c75089ad93db19640a72
 F test/memdb.test 532aac7128a3da494cddc4461d76c6e3988f771b
 F test/memleak.test f1fa233f8295dd1d955a00d5e5ee857850f27f29
 F test/minmax.test e7048476940df0af11d0f2cf687572f557cd0b29
@@ -268,7 +268,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc
 F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
 F www/whentouse.tcl c3b50d3ac31c54be2a1af9b488a89d22f1e6e746
-P 4e28c82adabb58ad9f79ed829734a2ff569a7c05
-R 91e64343b817051315eaf949a67a369a
+P 1c19e8bdca24484fcb9f068b38ebfbce3e24ada5
+R b76a833a2483450473314d802bbb9364
 U danielk1977
-Z 4c9e1226b7273b770b05a62249dc1ec1
+Z 5b30f3260cf2298fa7cd18908f9e112b
index f9fad84db66b8bd8e922b91ba2c75ebae8b4d089..eddebfcb78d2ad8b2266c49fd89c81ea2a1a7a5a 100644 (file)
@@ -1 +1 @@
-1c19e8bdca24484fcb9f068b38ebfbce3e24ada5
\ No newline at end of file
+8378455f32c3010ccc28181048c746ecb8a9fa67
\ No newline at end of file
index 95710f6355f33f685dd26302fba61bb1b60ab042..cc753be27d1146a2683046a5b9df690047559bce 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains routines used for analyzing expressions and
 ** for generating VDBE code that evaluates expressions in SQLite.
 **
-** $Id: expr.c,v 1.176 2004/12/18 18:40:27 drh Exp $
+** $Id: expr.c,v 1.177 2005/01/13 02:14:25 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -2031,7 +2031,10 @@ FuncDef *sqlite3FindFunction(
     pBest->iPrefEnc = enc;
     memcpy(pBest->zName, zName, nName);
     pBest->zName[nName] = 0;
-    sqlite3HashInsert(&db->aFunc, pBest->zName, nName, (void*)pBest);
+    if( pBest==sqlite3HashInsert(&db->aFunc,pBest->zName,nName,(void*)pBest) ){
+      sqliteFree(pBest);
+      return 0;
+    }
   }
 
   if( pBest && (pBest->xStep || pBest->xFunc || createFlag) ){
index 75d93956d80f0aacceb67a3320c5930306c8f55a..45072d2dc8ae664f7aea2461cbf87a7d4e7d81bc 100644 (file)
@@ -14,7 +14,7 @@
 ** other files are for internal use by SQLite and should not be
 ** accessed by users of the library.
 **
-** $Id: main.c,v 1.270 2005/01/12 12:44:04 danielk1977 Exp $
+** $Id: main.c,v 1.271 2005/01/13 02:14:25 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -378,7 +378,7 @@ const char *sqlite3_libversion(void){ return sqlite3_version; }
 ** This is the default collating function named "BINARY" which is always
 ** available.
 */
-static int binaryCollatingFunc(
+static int binCollFunc(
   void *NotUsed,
   int nKey1, const void *pKey1,
   int nKey2, const void *pKey2
@@ -1101,7 +1101,6 @@ static int openDatabase(
 ){
   sqlite3 *db;
   int rc, i;
-  char *zErrMsg = 0;
 
   /* Allocate the sqlite data structure */
   db = sqliteMalloc( sizeof(sqlite3) );
@@ -1126,11 +1125,9 @@ static int openDatabase(
   ** and UTF-16, so add a version for each to avoid any unnecessary
   ** conversions. The only error that can occur here is a malloc() failure.
   */
-  sqlite3_create_collation(db, "BINARY", SQLITE_UTF8, 0,binaryCollatingFunc);
-  sqlite3_create_collation(db, "BINARY", SQLITE_UTF16LE, 0,binaryCollatingFunc);
-  sqlite3_create_collation(db, "BINARY", SQLITE_UTF16BE, 0,binaryCollatingFunc);
-  db->pDfltColl = sqlite3FindCollSeq(db, db->enc, "BINARY", 6, 0);
-  if( !db->pDfltColl ){
+  if( sqlite3_create_collation(db, "BINARY", SQLITE_UTF8, 0,binCollFunc) ||
+      sqlite3_create_collation(db, "BINARY", SQLITE_UTF16, 0,binCollFunc) ||
+      !(db->pDfltColl = sqlite3FindCollSeq(db, db->enc, "BINARY", 6, 0)) ){
     rc = db->errCode;
     assert( rc!=SQLITE_OK );
     db->magic = SQLITE_MAGIC_CLOSED;
index 23300cc8c00b0d62aef1c23afb23380901409f68..de6cf04761a8a60214d3375d41f29dc6b418bd9c 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.352 2005/01/12 07:15:05 danielk1977 Exp $
+** @(#) $Id: sqliteInt.h,v 1.353 2005/01/13 02:14:25 danielk1977 Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -231,7 +231,7 @@ struct BusyHandler {
 ** each malloc() and free().  This output can be analyzed
 ** by an AWK script to determine if there are any leaks.
 */
-#ifdef SQLITE_TEST
+#ifdef SQLITE_MEMDEBUG
 # define sqliteMalloc(X)    sqlite3Malloc_(X,1,__FILE__,__LINE__)
 # define sqliteMallocRaw(X) sqlite3Malloc_(X,0,__FILE__,__LINE__)
 # define sqliteFree(X)      sqlite3Free_(X,__FILE__,__LINE__)
@@ -257,7 +257,7 @@ extern int sqlite3_malloc_failed;
 ** The following global variables are used for testing and debugging
 ** only.  They only work if SQLITE_DEBUG is defined.
 */
-#ifdef SQLITE_TEST
+#ifdef SQLITE_MEMDEBUG
 extern int sqlite3_nMalloc;      /* Number of sqliteMalloc() calls */
 extern int sqlite3_nFree;        /* Number of sqliteFree() calls */
 extern int sqlite3_iMallocFail;  /* Fail sqliteMalloc() after this many calls */
@@ -1280,7 +1280,7 @@ int sqlite3IsNumber(const char*, int*, u8);
 int sqlite3Compare(const char *, const char *);
 int sqlite3SortCompare(const char *, const char *);
 void sqlite3RealToSortable(double r, char *);
-#ifdef SQLITE_TEST
+#ifdef SQLITE_MEMDEBUG
   void *sqlite3Malloc_(int,int,char*,int);
   void sqlite3Free_(void*,char*,int);
   void *sqlite3Realloc_(void*,int,char*,int);
index 7db3615ab6ebda419c5999dd90d4be6ef7a93cd2..3684b6a1aea3578c4023873bd44c2a4d0875c815 100644 (file)
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test1.c,v 1.121 2005/01/12 12:44:04 danielk1977 Exp $
+** $Id: test1.c,v 1.122 2005/01/13 02:14:25 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -757,7 +757,7 @@ static int sqlite3_mprintf_stronly(
 **
 ** Turn off this mechanism and reset the sqlite3_malloc_failed variable is N==0.
 */
-#ifdef SQLITE_TEST
+#ifdef SQLITE_MEMDEBUG
 static int sqlite_malloc_fail(
   void *NotUsed,
   Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
@@ -788,7 +788,7 @@ static int sqlite_malloc_fail(
 **
 ** Return the number of prior calls to sqliteMalloc() and sqliteFree().
 */
-#ifdef SQLITE_TEST
+#ifdef SQLITE_MEMDEBUG
 static int sqlite_malloc_stat(
   void *NotUsed,
   Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
@@ -2754,7 +2754,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
      { "sqlite3_create_aggregate",      (Tcl_CmdProc*)test_create_aggregate },
      { "sqlite_register_test_function", (Tcl_CmdProc*)test_register_func    },
      { "sqlite_abort",                  (Tcl_CmdProc*)sqlite_abort          },
-#ifdef SQLITE_TEST
+#ifdef SQLITE_MEMDEBUG
      { "sqlite_malloc_fail",            (Tcl_CmdProc*)sqlite_malloc_fail    },
      { "sqlite_malloc_stat",            (Tcl_CmdProc*)sqlite_malloc_stat    },
 #endif
index ef3eb191e7a1cce11cf0f72e3c9140131aa03b9c..a9884ae6b67542b7dce47208f8ae09999b7c9730 100644 (file)
 ** This file contains functions for allocating memory, comparing
 ** strings, and stuff like that.
 **
-** $Id: util.c,v 1.125 2005/01/12 07:15:06 danielk1977 Exp $
+** $Id: util.c,v 1.126 2005/01/13 02:14:25 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <stdarg.h>
 #include <ctype.h>
 
-#if SQLITE_DEBUG>2 && defined(__GLIBC__)
+#if SQLITE_MEMDEBUG>2 && defined(__GLIBC__)
 #include <execinfo.h>
 void print_stack_trace(){
   void *bt[30];
@@ -44,10 +44,10 @@ void print_stack_trace(){
 int sqlite3_malloc_failed = 0;
 
 /*
-** If SQLITE_TEST is defined, then use versions of malloc() and
+** If SQLITE_MEMDEBUG is defined, then use versions of malloc() and
 ** free() that track memory usage and check for buffer overruns.
 */
-#ifdef SQLITE_TEST
+#ifdef SQLITE_MEMDEBUG
 
 /*
 ** For keeping track of the number of mallocs and frees.   This
@@ -60,7 +60,7 @@ int sqlite3_nMalloc;         /* Number of sqliteMalloc() calls */
 int sqlite3_nFree;           /* Number of sqliteFree() calls */
 int sqlite3_iMallocFail;     /* Fail sqliteMalloc() after this many calls */
 int sqlite3_iMallocReset = -1; /* When iMallocFail reaches 0, set to this */
-#if SQLITE_DEBUG>1
+#if SQLITE_MEMDEBUG>1
 static int memcnt = 0;
 #endif
 
@@ -81,7 +81,7 @@ void *sqlite3Malloc_(int n, int bZero, char *zFile, int line){
     sqlite3_iMallocFail--;
     if( sqlite3_iMallocFail==0 ){
       sqlite3_malloc_failed++;
-#if SQLITE_DEBUG>1
+#if SQLITE_MEMDEBUG>1
       fprintf(stderr,"**** failed to allocate %d bytes at %s:%d\n",
               n, zFile,line);
 #endif
@@ -102,7 +102,7 @@ void *sqlite3Malloc_(int n, int bZero, char *zFile, int line){
   for(i=0; i<N_GUARD; i++) pi[k+1+N_GUARD+i] = 0xdead3344;
   p = &pi[N_GUARD+1];
   memset(p, bZero==0, n);
-#if SQLITE_DEBUG>1
+#if SQLITE_MEMDEBUG>1
   print_stack_trace();
   fprintf(stderr,"%06d malloc %d bytes at 0x%x from %s:%d\n",
       ++memcnt, n, (int)p, zFile,line);
@@ -156,7 +156,7 @@ void sqlite3Free_(void *p, char *zFile, int line){
       }
     }
     memset(pi, 0xff, (k+N_GUARD*2+1)*sizeof(int));
-#if SQLITE_DEBUG>1
+#if SQLITE_MEMDEBUG>1
     fprintf(stderr,"%06d free %d bytes at 0x%x from %s:%d\n",
          ++memcnt, n, (int)p, zFile,line);
 #endif
@@ -210,7 +210,7 @@ void *sqlite3Realloc_(void *oldP, int n, char *zFile, int line){
   }
   memset(oldPi, 0xab, (oldK+N_GUARD+2)*sizeof(int));
   free(oldPi);
-#if SQLITE_DEBUG>1
+#if SQLITE_MEMDEBUG>1
   print_stack_trace();
   fprintf(stderr,"%06d realloc %d to %d bytes at 0x%x to 0x%x at %s:%d\n",
     ++memcnt, oldN, n, (int)oldP, (int)p, zFile, line);
@@ -245,13 +245,13 @@ char *sqlite3StrNDup_(const char *z, int n, char *zFile, int line){
 void sqlite3FreeX(void *p){
   sqliteFree(p);
 }
-#endif /* SQLITE_DEBUG */
+#endif /* SQLITE_MEMDEBUG */
 
 /*
 ** The following versions of malloc() and free() are for use in a
 ** normal build.
 */
-#if !defined(SQLITE_TEST)
+#if !defined(SQLITE_MEMDEBUG)
 
 /*
 ** Allocate new memory and set it to zero.  Return NULL if
@@ -329,7 +329,7 @@ char *sqlite3StrNDup(const char *z, int n){
   }
   return zNew;
 }
-#endif /* !defined(SQLITE_TEST) */
+#endif /* !defined(SQLITE_MEMDEBUG) */
 
 /*
 ** Create a string from the 2nd and subsequent arguments (up to the
index 04a617130b757eab465c7096175142c51b6e748c..23da9ced9e518fea94db8a3e7988b2e6789bf8ba 100644 (file)
 ** between formats.
 */
 int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
+  int rc;
   if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
     return SQLITE_OK;
   }
 #ifdef SQLITE_OMIT_UTF16
   return SQLITE_ERROR;
 #else
-  return sqlite3VdbeMemTranslate(pMem, desiredEnc);
+  rc = sqlite3VdbeMemTranslate(pMem, desiredEnc);
+  if( rc==SQLITE_NOMEM ){
+    sqlite3VdbeMemRelease(pMem);
+    pMem->flags = MEM_Null;
+    pMem->z = 0;
+  }
+  return rc;
 #endif
 }
 
index cd42a1dd1d975ed17049fe9e53fbf78752be871a..33e2b630898b795d0cb48a3bebc177a7339849d9 100644 (file)
@@ -14,7 +14,7 @@
 # special feature is used to see what happens in the library if a malloc
 # were to really fail due to an out-of-memory situation.
 #
-# $Id: malloc.test,v 1.17 2005/01/12 13:04:55 danielk1977 Exp $
+# $Id: malloc.test,v 1.18 2005/01/13 02:14:25 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -485,7 +485,8 @@ do_malloc_test 10 -sqlprep {
 # This block tests malloc() failures that occur within calls to
 # sqlite3_create_function().
 do_malloc_test 11  -tclbody {
-  if {[string match [sqlite3_create_function $::DB] SQLITE_NOMEM]==0} {
+  set rc [sqlite3_create_function $::DB]
+  if {[string match $rc SQLITE_NOMEM]} {
     error "out of memory"
   }
 }