]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the SQLITE_WITHOUT_MSIZE and SQLITE_WITHOUT_ZONEMALLOC macros in mem1.c
authordrh <drh@noemail.net>
Wed, 18 Jan 2012 12:46:47 +0000 (12:46 +0000)
committerdrh <drh@noemail.net>
Wed, 18 Jan 2012 12:46:47 +0000 (12:46 +0000)
to disable the use of _msize() on windows and the zone memory allocator
on Apple products, respectively.

FossilOrigin-Name: 238e35a4411a5b2231576254dba39b802947d4f3

manifest
manifest.uuid
src/mem1.c

index d996b05ebf4e20e5bfe22890b0b4d983772e8834..c6b2d7e54938507c12c231715d81ba82a6500f36 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sa\sredundant\sassignment\sfrom\sthe\sVM.
-D 2012-01-18T01:14:42.982
+C Add\sthe\sSQLITE_WITHOUT_MSIZE\sand\sSQLITE_WITHOUT_ZONEMALLOC\smacros\sin\smem1.c\nto\sdisable\sthe\suse\sof\s_msize()\son\swindows\sand\sthe\szone\smemory\sallocator\non\sApple\sproducts,\srespectively.
+D 2012-01-18T12:46:47.040
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 3f79a373e57c3b92dabf76f40b065e719d31ac34
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -150,7 +150,7 @@ F src/loadext.c f20382fbaeec832438a1ba7797bee3d3c8a6d51d
 F src/main.c e60abee4a7ca3da31b67745ccf02b8d29f138614
 F src/malloc.c 15afac5e59b6584efe072e9933aefb4230e74f97
 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
-F src/mem1.c 7998e7003a3047e323c849a26dda004debc04d03
+F src/mem1.c 3137fd0e24d55554028a0a07d01240dc506101ee
 F src/mem2.c e307323e86b5da1853d7111b68fd6b84ad6f09cf
 F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534
 F src/mem5.c c2c63b7067570b00bf33d751c39af24182316f7f
@@ -987,7 +987,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
-P 199edb6869977ccd7abf886af5cf9b344c857d1e
-R 8b52b1a8cfe111f7da7f61e6df78ea28
+P d0dabe2f37b5fa7c2c6bb728b8591af00cdd835b
+R 0cad542fee6809889fa727063bfca9db
 U drh
-Z f117d6ca2550ce95a5e0fc5cae8dc0b7
+Z cc476ae956a6554c8c6b5581c191930f
index 9bf36d35016ced1b797e8a96dd7c0e2f302ae56b..d65e63212723dc56f386db75da56fe6a66b1ef37 100644 (file)
@@ -1 +1 @@
-d0dabe2f37b5fa7c2c6bb728b8591af00cdd835b
\ No newline at end of file
+238e35a4411a5b2231576254dba39b802947d4f3
\ No newline at end of file
index bf84ce090981702e27eeada83fc45f705adadaf3..48e1367695a23eaeb869865ff9bc785802c5d89a 100644 (file)
 ** to obtain the memory it needs.
 **
 ** This file contains implementations of the low-level memory allocation
-** routines specified in the sqlite3_mem_methods object.
+** routines specified in the sqlite3_mem_methods object.  The content of
+** this file is only used if SQLITE_SYSTEM_MALLOC is defined.  The
+** SQLITE_SYSTEM_MALLOC macro is defined automatically if neither the
+** SQLITE_MEMDEBUG nor the SQLITE_WIN32_MALLOC macros are defined.  The
+** default configuration is to use memory allocation routines in this
+** file.
+**
+** C-preprocessor macro summary:
+**
+**    HAVE_MALLOC_USABLE_SIZE     The configure script sets this symbol if
+**                                the malloc_usable_size() interface exists
+**                                on the target platform.  Or, this symbol
+**                                can be set manually, if desired.
+**                                If an equivalent interface exists by
+**                                a different name, using a separate -D
+**                                option to rename it.  This symbol will
+**                                be enabled automatically on windows
+**                                systems, and malloc_usable_size() will
+**                                be redefined to _msize(), unless the
+**                                SQLITE_WITHOUT_MSIZE macro is defined.
+**    
+**    SQLITE_WITHOUT_ZONEMALLOC   Some older macs lack support for the zone
+**                                memory allocator.  Set this symbol to enable
+**                                building on older macs.
+**
+**    SQLITE_WITHOUT_MSIZE        Set this symbol to disable the use of
+**                                _msize() on windows systems.  This might
+**                                be necessary when compiling for Delphi,
+**                                for example.
 */
 #include "sqliteInt.h"
 
 #ifdef SQLITE_SYSTEM_MALLOC
 
 /*
-** Windows systems have malloc_usable_size() but it is called _msize()
+** Windows systems have malloc_usable_size() but it is called _msize().
+** The use of _msize() is automatic, but can be disabled by compiling
+** with -DSQLITE_WITHOUT_MSIZE
 */
-#if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN
+#if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN \
+      && !defined(SQLITE_WITHOUT_MSIZE)
 # define HAVE_MALLOC_USABLE_SIZE 1
 # define malloc_usable_size _msize
 #endif
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)
 
 /*
-** Use the zone allocator available on apple products
+** Use the zone allocator available on apple products unless the
+** SQLITE_WITHOUT_ZONEMALLOC symbol is defined.
 */
 #include <sys/sysctl.h>
 #include <malloc/malloc.h>
@@ -52,7 +84,8 @@ static malloc_zone_t* _sqliteZone_;
 #else /* if not __APPLE__ */
 
 /*
-** Use standard C library malloc and free on non-Apple systems.
+** Use standard C library malloc and free on non-Apple systems.  
+** Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined.
 */
 #define SQLITE_MALLOC(x)    malloc(x)
 #define SQLITE_FREE(x)      free(x)
@@ -184,7 +217,7 @@ static int sqlite3MemRoundup(int n){
 ** Initialize this module.
 */
 static int sqlite3MemInit(void *NotUsed){
-#if defined(__APPLE__)
+#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)
   int cpuCount;
   size_t len;
   if( _sqliteZone_ ){