]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Allow the Win32 native heap flags to be overridden at compile-time.
authormistachkin <mistachkin@noemail.net>
Fri, 26 Aug 2011 01:32:24 +0000 (01:32 +0000)
committermistachkin <mistachkin@noemail.net>
Fri, 26 Aug 2011 01:32:24 +0000 (01:32 +0000)
FossilOrigin-Name: 1c2ecec8e7320bc5b532b3107005fb7f0370f25c

manifest
manifest.uuid
src/os_win.c

index 7e02d878dfc915b860411458c037eb3f1f7500bd..baf7f7a7a9fb5be65be1744be4badae69a93d101 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\scomments\sfor\sthe\svarious\sdebug\slevels.\s\sWhen\sdebugging,\sdisable\soptimizations.\s\sPrevent\sthe\swin32lock\stests\sfrom\sspinning\sforever.
-D 2011-08-25T04:09:12.308
+C Allow\sthe\sWin32\snative\sheap\sflags\sto\sbe\soverridden\sat\scompile-time.
+D 2011-08-26T01:32:24.991
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 8c930e7b493d59099ea1304bd0f2aed152eb3315
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -166,7 +166,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
 F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58
 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
 F src/os_unix.c 81341980c52a44106b10c1e28a0d5c5247476452
-F src/os_win.c 7d27ec1e65069d7ce8d698a475cc3550b8dbae15
+F src/os_win.c dc2e61b0727989a796482471e1e9caab890005ea
 F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41
 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
@@ -961,7 +961,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5
 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2
-P 4257e9b7ca78feb03df08fde56da947ae64c5c6f
-R 0448fba2024f79c072babb8ddd4d7080
+P 401859236b0d97bde82b11f32efce6eb9d490941
+R 35801e696f9647a4182ac9bf0b1942c5
 U mistachkin
-Z d666bad4d643507c471d1b757fa63134
+Z affee667f35124b9dd9a06a0543d989b
index e4a72c339e70c6a813eac61869d77176810a78d4..06e3e2ac8264e11d1c7290e16e5050191491d0c3 100644 (file)
@@ -1 +1 @@
-401859236b0d97bde82b11f32efce6eb9d490941
\ No newline at end of file
+1c2ecec8e7320bc5b532b3107005fb7f0370f25c
\ No newline at end of file
index 8a6a088df51a5264fcef3083a7225025aa10b05c..2af1dce8a5fc73cfc9a2a83cc449450356f48db3 100644 (file)
@@ -139,6 +139,14 @@ struct winFile {
 #  define SQLITE_WIN32_HEAP_MAX_SIZE  (0)
 #endif
 
+/*
+ * The extra flags to use in calls to the Win32 heap APIs.  This value may be
+ * zero for the default behavior.
+ */
+#ifndef SQLITE_WIN32_HEAP_FLAGS
+#  define SQLITE_WIN32_HEAP_FLAGS     (0)
+#endif
+
 /*
 ** The winMemData structure stores information required by the Win32-specific
 ** sqlite3_mem_methods implementation.
@@ -232,10 +240,10 @@ static void *winMemMalloc(int nBytes){
   assert( hHeap!=0 );
   assert( hHeap!=INVALID_HANDLE_VALUE );
 #ifdef SQLITE_WIN32_MALLOC_VALIDATE
-  assert ( HeapValidate(hHeap, 0, NULL) );
+  assert ( HeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
 #endif
   assert( nBytes>=0 );
-  p = HeapAlloc(hHeap, 0, (SIZE_T)nBytes);
+  p = HeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);
   if( !p ){
     sqlite3_log(SQLITE_NOMEM, "failed to HeapAlloc %u bytes (%d), heap=%p",
         nBytes, GetLastError(), (void*)hHeap);
@@ -254,10 +262,10 @@ static void winMemFree(void *pPrior){
   assert( hHeap!=0 );
   assert( hHeap!=INVALID_HANDLE_VALUE );
 #ifdef SQLITE_WIN32_MALLOC_VALIDATE
-  assert ( HeapValidate(hHeap, 0, pPrior) );
+  assert ( HeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
 #endif
   if( !pPrior ) return; /* Passing NULL to HeapFree is undefined. */
-  if( !HeapFree(hHeap, 0, pPrior) ){
+  if( !HeapFree(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ){
     sqlite3_log(SQLITE_NOMEM, "failed to HeapFree block %p (%d), heap=%p",
         pPrior, GetLastError(), (void*)hHeap);
   }
@@ -275,13 +283,13 @@ static void *winMemRealloc(void *pPrior, int nBytes){
   assert( hHeap!=0 );
   assert( hHeap!=INVALID_HANDLE_VALUE );
 #ifdef SQLITE_WIN32_MALLOC_VALIDATE
-  assert ( HeapValidate(hHeap, 0, pPrior) );
+  assert ( HeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
 #endif
   assert( nBytes>=0 );
   if( !pPrior ){
-    p = HeapAlloc(hHeap, 0, (SIZE_T)nBytes);
+    p = HeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);
   }else{
-    p = HeapReAlloc(hHeap, 0, pPrior, (SIZE_T)nBytes);
+    p = HeapReAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior, (SIZE_T)nBytes);
   }
   if( !p ){
     sqlite3_log(SQLITE_NOMEM, "failed to %s %u bytes (%d), heap=%p",
@@ -303,10 +311,10 @@ static int winMemSize(void *p){
   assert( hHeap!=0 );
   assert( hHeap!=INVALID_HANDLE_VALUE );
 #ifdef SQLITE_WIN32_MALLOC_VALIDATE
-  assert ( HeapValidate(hHeap, 0, NULL) );
+  assert ( HeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
 #endif
   if( !p ) return 0;
-  n = HeapSize(hHeap, 0, p);
+  n = HeapSize(hHeap, SQLITE_WIN32_HEAP_FLAGS, p);
   if( n==(SIZE_T)-1 ){
     sqlite3_log(SQLITE_NOMEM, "failed to HeapSize block %p (%d), heap=%p",
         p, GetLastError(), (void*)hHeap);
@@ -331,12 +339,13 @@ static int winMemInit(void *pAppData){
   if( !pWinMemData ) return SQLITE_ERROR;
   assert( pWinMemData->magic==WINMEM_MAGIC );
   if( !pWinMemData->hHeap ){
-    pWinMemData->hHeap = HeapCreate(0, SQLITE_WIN32_HEAP_INIT_SIZE,
+    pWinMemData->hHeap = HeapCreate(SQLITE_WIN32_HEAP_FLAGS,
+                                    SQLITE_WIN32_HEAP_INIT_SIZE,
                                     SQLITE_WIN32_HEAP_MAX_SIZE);
     if( !pWinMemData->hHeap ){
       sqlite3_log(SQLITE_NOMEM,
-          "failed to HeapCreate (%d), initSize=%u, maxSize=%u",
-          GetLastError(), SQLITE_WIN32_HEAP_INIT_SIZE,
+          "failed to HeapCreate (%d), flags=%u, initSize=%u, maxSize=%u",
+          GetLastError(), SQLITE_WIN32_HEAP_FLAGS, SQLITE_WIN32_HEAP_INIT_SIZE,
           SQLITE_WIN32_HEAP_MAX_SIZE);
       return SQLITE_NOMEM;
     }
@@ -345,7 +354,7 @@ static int winMemInit(void *pAppData){
   assert( pWinMemData->hHeap!=0 );
   assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
 #ifdef SQLITE_WIN32_MALLOC_VALIDATE
-  assert( HeapValidate(pWinMemData->hHeap, 0, NULL) );
+  assert( HeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
 #endif
   return SQLITE_OK;
 }
@@ -360,7 +369,7 @@ static void winMemShutdown(void *pAppData){
   if( pWinMemData->hHeap ){
     assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
 #ifdef SQLITE_WIN32_MALLOC_VALIDATE
-    assert( HeapValidate(pWinMemData->hHeap, 0, NULL) );
+    assert( HeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
 #endif
     if( pWinMemData->bOwned ){
       if( !HeapDestroy(pWinMemData->hHeap) ){