| | @@ -15796,20 +15796,10 @@ |
| 15796 | 15796 | ** This version of the memory allocator is the default. It is |
| 15797 | 15797 | ** used when no other memory allocator is specified using compile-time |
| 15798 | 15798 | ** macros. |
| 15799 | 15799 | */ |
| 15800 | 15800 | #ifdef SQLITE_SYSTEM_MALLOC |
| 15801 | | - |
| 15802 | | -/* |
| 15803 | | -** The MSVCRT has malloc_usable_size() but it is called _msize(). |
| 15804 | | -** The use of _msize() is automatic, but can be disabled by compiling |
| 15805 | | -** with -DSQLITE_WITHOUT_MSIZE |
| 15806 | | -*/ |
| 15807 | | -#if defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE) |
| 15808 | | -# define SQLITE_MALLOCSIZE _msize |
| 15809 | | -#endif |
| 15810 | | - |
| 15811 | 15801 | #if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC) |
| 15812 | 15802 | |
| 15813 | 15803 | /* |
| 15814 | 15804 | ** Use the zone allocator available on apple products unless the |
| 15815 | 15805 | ** SQLITE_WITHOUT_ZONEMALLOC symbol is defined. |
| | @@ -15828,25 +15818,51 @@ |
| 15828 | 15818 | |
| 15829 | 15819 | /* |
| 15830 | 15820 | ** Use standard C library malloc and free on non-Apple systems. |
| 15831 | 15821 | ** Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined. |
| 15832 | 15822 | */ |
| 15833 | | -#define SQLITE_MALLOC(x) malloc(x) |
| 15834 | | -#define SQLITE_FREE(x) free(x) |
| 15835 | | -#define SQLITE_REALLOC(x,y) realloc((x),(y)) |
| 15836 | | - |
| 15837 | | -#if (defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE)) \ |
| 15838 | | - || (defined(HAVE_MALLOC_H) && defined(HAVE_MALLOC_USABLE_SIZE)) |
| 15839 | | -# include <malloc.h> /* Needed for malloc_usable_size on linux */ |
| 15840 | | -#endif |
| 15841 | | -#ifdef HAVE_MALLOC_USABLE_SIZE |
| 15842 | | -# ifndef SQLITE_MALLOCSIZE |
| 15843 | | -# define SQLITE_MALLOCSIZE(x) malloc_usable_size(x) |
| 15844 | | -# endif |
| 15845 | | -#else |
| 15846 | | -# undef SQLITE_MALLOCSIZE |
| 15847 | | -#endif |
| 15823 | +#define SQLITE_MALLOC(x) malloc(x) |
| 15824 | +#define SQLITE_FREE(x) free(x) |
| 15825 | +#define SQLITE_REALLOC(x,y) realloc((x),(y)) |
| 15826 | + |
| 15827 | +/* |
| 15828 | +** The malloc.h header file is needed for malloc_usable_size() function |
| 15829 | +** on some systems (e.g. Linux). |
| 15830 | +*/ |
| 15831 | +#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLOC_USABLE_SIZE) |
| 15832 | +# define SQLITE_USE_MALLOC_H |
| 15833 | +# define SQLITE_USE_MALLOC_USABLE_SIZE |
| 15834 | +/* |
| 15835 | +** The MSVCRT has malloc_usable_size(), but it is called _msize(). The |
| 15836 | +** use of _msize() is automatic, but can be disabled by compiling with |
| 15837 | +** -DSQLITE_WITHOUT_MSIZE. Using the _msize() function also requires |
| 15838 | +** the malloc.h header file. |
| 15839 | +*/ |
| 15840 | +#elif defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE) |
| 15841 | +# define SQLITE_USE_MALLOC_H |
| 15842 | +# define SQLITE_USE_MSIZE |
| 15843 | +#endif |
| 15844 | + |
| 15845 | +/* |
| 15846 | +** Include the malloc.h header file, if necessary. Also set define macro |
| 15847 | +** SQLITE_MALLOCSIZE to the appropriate function name, which is _msize() |
| 15848 | +** for MSVC and malloc_usable_size() for most other systems (e.g. Linux). |
| 15849 | +** The memory size function can always be overridden manually by defining |
| 15850 | +** the macro SQLITE_MALLOCSIZE to the desired function name. |
| 15851 | +*/ |
| 15852 | +#if defined(SQLITE_USE_MALLOC_H) |
| 15853 | +# include <malloc.h> |
| 15854 | +# if defined(SQLITE_USE_MALLOC_USABLE_SIZE) |
| 15855 | +# if !defined(SQLITE_MALLOCSIZE) |
| 15856 | +# define SQLITE_MALLOCSIZE(x) malloc_usable_size(x) |
| 15857 | +# endif |
| 15858 | +# elif defined(SQLITE_USE_MSIZE) |
| 15859 | +# if !defined(SQLITE_MALLOCSIZE) |
| 15860 | +# define SQLITE_MALLOCSIZE _msize |
| 15861 | +# endif |
| 15862 | +# endif |
| 15863 | +#endif /* defined(SQLITE_USE_MALLOC_H) */ |
| 15848 | 15864 | |
| 15849 | 15865 | #endif /* __APPLE__ or not __APPLE__ */ |
| 15850 | 15866 | |
| 15851 | 15867 | /* |
| 15852 | 15868 | ** Like malloc(), but remember the size of the allocation |
| 15853 | 15869 | |