From: mistachkin Date: Fri, 8 Nov 2013 20:10:57 +0000 (+0000) Subject: Add more assert() statements and fix compilation issues when the Win32 native heap... X-Git-Tag: version-3.8.2~120^3~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7f9d179884df77e5efdb291b03ae9b1f6f6c9aea;p=thirdparty%2Fsqlite.git Add more assert() statements and fix compilation issues when the Win32 native heap is not enabled. FossilOrigin-Name: fbf8c3828327d19bbce0d7f6735e7577abfd54b3 --- diff --git a/manifest b/manifest index 505ab3a546..6514cd4712 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Disable\suse\sof\sHeapCompact\son\sWindows\sCE\sas\sit\sis\snot\savailable\son\sall\sversions. -D 2013-11-08T19:51:12.210 +C Add\smore\sassert()\sstatements\sand\sfix\scompilation\sissues\swhen\sthe\sWin32\snative\sheap\sis\snot\senabled. +D 2013-11-08T20:10:57.541 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d12e4455cf7a36e42d3949876c1c3b88ff70867a F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -205,7 +205,7 @@ F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c 143624d9eabb3b997c59cf594e0d06c56edd43e9 -F src/os_win.c 1426ee90b58e5ea012c25e85489cf32b78019dd5 +F src/os_win.c 0b867befe5225413201099551d16f89359b514af F src/pager.c 2aa4444ffe86e9282d03bc349a4a5e49bd77c0e8 F src/pager.h f094af9f6ececfaa8a1e93876905a4f34233fb0c F src/parse.y 073a8294e1826f1b1656e84806b77e4199f4bb57 @@ -1135,7 +1135,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 37853665e75fc92b4d15e6db0b3346722527e799 -R 749df941a874c954c5ef5ef583b3e9df +P e9694b877178572665048d1015ca033c469160e7 +R 6187da53e4e28cbae46594a31b7f6cd9 U mistachkin -Z 5e51eb4044bf1101312438ecb7a0a945 +Z 404c44102da970339de3158c18d24f41 diff --git a/manifest.uuid b/manifest.uuid index 5f10fe9435..abdcd98c85 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e9694b877178572665048d1015ca033c469160e7 \ No newline at end of file +fbf8c3828327d19bbce0d7f6735e7577abfd54b3 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 9dcd052dd9..21f60a51d1 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1089,6 +1089,7 @@ static const char *winNextSystemCall(sqlite3_vfs *p, const char *zName){ return 0; } +#ifdef SQLITE_WIN32_MALLOC /* ** If a Win32 native heap has been configured, this function will attempt to ** compact it. Upon success, SQLITE_OK will be returned. Upon failure, one @@ -1144,7 +1145,8 @@ int sqlite3_win32_reset_heap(){ MUTEX_LOGIC( pMem = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); ) sqlite3_mutex_enter(pMaster); sqlite3_mutex_enter(pMem); - if( winMemGetOwned() && sqlite3_memory_used()==0 ){ + winMemAssertMagic(); + if( winMemGetHeap()!=NULL && winMemGetOwned() && sqlite3_memory_used()==0 ){ /* ** At this point, there should be no outstanding memory allocations on ** the heap. Also, since both the master and memsys locks are currently @@ -1152,8 +1154,17 @@ int sqlite3_win32_reset_heap(){ ** be able to even access the heap. Attempt to destroy and recreate our ** isolated Win32 native heap now. */ + assert( winMemGetHeap()!=NULL ); + assert( winMemGetOwned() ); + assert( sqlite3_memory_used()==0 ); winMemShutdown(winMemGetDataPtr()); + assert( winMemGetHeap()==NULL ); + assert( !winMemGetOwned() ); + assert( sqlite3_memory_used()==0 ); rc = winMemInit(winMemGetDataPtr()); + assert( rc!=SQLITE_OK || winMemGetHeap()!=NULL ); + assert( rc!=SQLITE_OK || winMemGetOwned() ); + assert( rc!=SQLITE_OK || sqlite3_memory_used()==0 ); }else{ /* ** The Win32 native heap cannot be modified because it may be in use. @@ -1164,6 +1175,7 @@ int sqlite3_win32_reset_heap(){ sqlite3_mutex_leave(pMaster); return rc; } +#endif /* SQLITE_WIN32_MALLOC */ /* ** This function outputs the specified (ANSI) string to the Win32 debugger