From: danielk1977 Date: Tue, 2 Sep 2008 17:52:51 +0000 (+0000) Subject: Explicitly initialize at least the first field of every struct. This is to work aroun... X-Git-Tag: version-3.6.10~511 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=23bf0f41ea0d0f9703be53f02742be47ce5eb2dd;p=thirdparty%2Fsqlite.git Explicitly initialize at least the first field of every struct. This is to work around compilers that don't like the syntax "struct XXX { ... } yyy = {};". (CVS 5666) FossilOrigin-Name: 88bfdc87471e65ac5a262a794b8cdf3e563eb327 --- diff --git a/manifest b/manifest index 58af336302..06e3e94b1d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sposition\sof\sthe\sSQLITE_WSD\smacro\sin\sthe\sdeclaration\sof\sglobal\svariable\svfsList.\s(CVS\s5665) -D 2008-09-02T17:18:52 +C Explicitly\sinitialize\sat\sleast\sthe\sfirst\sfield\sof\severy\sstruct.\sThis\sis\sto\swork\saround\scompilers\sthat\sdon't\slike\sthe\ssyntax\s"struct\sXXX\s{\s...\s}\syyy\s=\s{};".\s(CVS\s5666) +D 2008-09-02T17:52:52 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 689e14735f862a5553bceef206d8c13e29504e44 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -117,13 +117,13 @@ F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3 F src/loadext.c 6581a5bbc4d74fcd46dbbcfd695a6a5417f778a2 F src/main.c a679dd3e0f040d13d72b9800840e07bedd6aa2d4 -F src/malloc.c fb23bfbcc5c93180b787bd746c7387289028d482 +F src/malloc.c 9aa2ef805287017ed16a9e3809d275b8af26b762 F src/mem1.c 5a529ff121c55ab067be14de00f86f6dcc4f4fb9 F src/mem2.c f87e681d0d1ed8436870d089332ed0d27d885b5c -F src/mem3.c 0d9341b01ebbed7bce59a94236620f20bce2efd4 +F src/mem3.c 1594f117fde4cf11a6c16521f3f30af8d04bbe68 F src/mem4.c 6703adb1717b26d9d70a1c2586b4b7b7ffee7909 -F src/mem5.c 6ec2795f5c328d8560ce500dad56a2aaedddb2d4 -F src/mem6.c 95d19a2e76c9173b1366f0a08a9f79fa34c697f2 +F src/mem5.c 706d462c13a9819dfec7c10d9dccedf8d199960c +F src/mem6.c febe4db9ddef73df500989e68a9d4ac68602a075 F src/mutex.c 81174f600553c25832e9a8705b609f16c73a4c01 F src/mutex.h e52ffa1dfc6a6077e8b1823d2c2b7dfcbcf85594 F src/mutex_os2.c 9c5637aa4c307c552566d0f0b3bd206245b54a97 @@ -630,7 +630,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P af5763eb65baa791a38f7e235624e4f63beac104 -R 614d8789ebf6e763073894eea03bb50c +P e869446119724b9b1568b1f8e56e9f29ff6d3816 +R 9d15214be0d8a6dfee557461b3e13e4a U danielk1977 -Z 89924553a58b9babc004b5df11c6ef86 +Z a4210662dddf1b4f707bdd6daa55e785 diff --git a/manifest.uuid b/manifest.uuid index 7376f0e758..35dd0fd74f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e869446119724b9b1568b1f8e56e9f29ff6d3816 \ No newline at end of file +88bfdc87471e65ac5a262a794b8cdf3e563eb327 \ No newline at end of file diff --git a/src/malloc.c b/src/malloc.c index 1fc8b4f933..61e1c1dbff 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -12,7 +12,7 @@ ** ** Memory allocation functions used throughout sqlite. ** -** $Id: malloc.c,v 1.39 2008/09/02 10:22:01 danielk1977 Exp $ +** $Id: malloc.c,v 1.40 2008/09/02 17:52:52 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -77,6 +77,10 @@ int sqlite3_release_memory(int n){ ** State information local to the memory allocation subsystem. */ static SQLITE_WSD struct Mem0Global { + /* Number of free pages for scratch and page-cache memory */ + u32 nScratchFree; + u32 nPageFree; + sqlite3_mutex *mutex; /* Mutex to serialize access */ /* @@ -98,11 +102,7 @@ static SQLITE_WSD struct Mem0Global { */ u32 *aScratchFree; u32 *aPageFree; - - /* Number of free pages for scratch and page-cache memory */ - u32 nScratchFree; - u32 nPageFree; -} mem0 = {}; +} mem0 = { 62560955 }; #define mem0 GLOBAL(struct Mem0Global, mem0) diff --git a/src/mem3.c b/src/mem3.c index 0379ade8a2..1c2c9511c2 100644 --- a/src/mem3.c +++ b/src/mem3.c @@ -23,7 +23,7 @@ ** This version of the memory allocation subsystem is included ** in the build only if SQLITE_ENABLE_MEMSYS3 is defined. ** -** $Id: mem3.c,v 1.22 2008/09/02 10:22:01 danielk1977 Exp $ +** $Id: mem3.c,v 1.23 2008/09/02 17:52:52 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -100,6 +100,13 @@ struct Mem3Block { ** when this module is combined with other in the amalgamation. */ static SQLITE_WSD struct Mem3Global { + /* + ** Memory available for allocation. nPool is the size of the array + ** (in Mem3Blocks) pointed to by aPool less 2. + */ + u32 nPool; + Mem3Block *aPool; + /* ** True if we are evaluating an out-of-memory callback. */ @@ -131,14 +138,7 @@ static SQLITE_WSD struct Mem3Global { */ u32 aiSmall[MX_SMALL-1]; /* For sizes 2 through MX_SMALL, inclusive */ u32 aiHash[N_HASH]; /* For sizes MX_SMALL+1 and larger */ - - /* - ** Memory available for allocation. nPool is the size of the array - ** (in Mem3Blocks) pointed to by aPool less 2. - */ - u32 nPool; - Mem3Block *aPool; -} mem3 = {}; +} mem3 = { 97535575 }; #define mem3 GLOBAL(struct Mem3Global, mem3) diff --git a/src/mem5.c b/src/mem5.c index 1ce0442480..6044bd8abc 100644 --- a/src/mem5.c +++ b/src/mem5.c @@ -23,7 +23,7 @@ ** This version of the memory allocation subsystem is included ** in the build only if SQLITE_ENABLE_MEMSYS5 is defined. ** -** $Id: mem5.c,v 1.13 2008/09/02 10:22:01 danielk1977 Exp $ +** $Id: mem5.c,v 1.14 2008/09/02 17:52:52 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -87,16 +87,11 @@ struct Mem5Link { */ static SQLITE_WSD struct Mem5Global { /* - ** The alarm callback and its arguments. The mem5.mutex lock will - ** be held while the callback is running. Recursive calls into - ** the memory subsystem are allowed, but no new callbacks will be - ** issued. The alarmBusy variable is set to prevent recursive - ** callbacks. + ** Memory available for allocation */ - sqlite3_int64 alarmThreshold; - void (*alarmCallback)(void*, sqlite3_int64,int); - void *alarmArg; - int alarmBusy; + int nAtom; /* Smallest possible allocation in bytes */ + int nBlock; /* Number of nAtom sized blocks in zPool */ + u8 *zPool; /* ** Mutex to control access to the memory allocation subsystem. @@ -126,13 +121,7 @@ static SQLITE_WSD struct Mem5Global { */ u8 *aCtrl; - /* - ** Memory available for allocation - */ - int nAtom; /* Smallest possible allocation in bytes */ - int nBlock; /* Number of nAtom sized blocks in zPool */ - u8 *zPool; -} mem5 = {}; +} mem5 = { 19804167 }; #define mem5 GLOBAL(struct Mem5Global, mem5) diff --git a/src/mem6.c b/src/mem6.c index 168262fbae..8a1be5ee73 100644 --- a/src/mem6.c +++ b/src/mem6.c @@ -32,7 +32,7 @@ ** fragmentation. On some systems, heap fragmentation can cause a ** significant real-time slowdown. ** -** $Id: mem6.c,v 1.9 2008/09/02 10:22:01 danielk1977 Exp $ +** $Id: mem6.c,v 1.10 2008/09/02 17:52:52 danielk1977 Exp $ */ #ifdef SQLITE_ENABLE_MEMSYS6 @@ -110,7 +110,7 @@ static SQLITE_WSD struct Mem6Global { int nLogThreshold; /* log2 of (nThreshold/nMinAlloc) */ sqlite3_mutex *mutex; Mem6Chunk *pChunk; /* Singly linked list of all memory chunks */ -} mem6 = {}; +} mem6 = { 48642791 }; #define mem6 GLOBAL(struct Mem6Global, mem6)