aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/malloc.c8
-rw-r--r--src/mem3.c12
-rw-r--r--src/mem5.c8
-rw-r--r--src/mem6.c8
-rw-r--r--src/os.c5
5 files changed, 25 insertions, 16 deletions
diff --git a/src/malloc.c b/src/malloc.c
index 5a318b113..1fc8b4f93 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -12,7 +12,7 @@
**
** Memory allocation functions used throughout sqlite.
**
-** $Id: malloc.c,v 1.38 2008/09/01 18:34:20 danielk1977 Exp $
+** $Id: malloc.c,v 1.39 2008/09/02 10:22:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
@@ -76,7 +76,7 @@ int sqlite3_release_memory(int n){
/*
** State information local to the memory allocation subsystem.
*/
-static struct {
+static SQLITE_WSD struct Mem0Global {
sqlite3_mutex *mutex; /* Mutex to serialize access */
/*
@@ -102,7 +102,9 @@ static struct {
/* Number of free pages for scratch and page-cache memory */
u32 nScratchFree;
u32 nPageFree;
-} mem0;
+} mem0 = {};
+
+#define mem0 GLOBAL(struct Mem0Global, mem0)
/*
** Initialize the memory allocation subsystem.
diff --git a/src/mem3.c b/src/mem3.c
index 08f6e6e2a..0379ade8a 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.21 2008/09/01 18:34:20 danielk1977 Exp $
+** $Id: mem3.c,v 1.22 2008/09/02 10:22:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -99,7 +99,7 @@ struct Mem3Block {
** static variables organized and to reduce namespace pollution
** when this module is combined with other in the amalgamation.
*/
-static struct {
+static SQLITE_WSD struct Mem3Global {
/*
** True if we are evaluating an out-of-memory callback.
*/
@@ -138,7 +138,9 @@ static struct {
*/
u32 nPool;
Mem3Block *aPool;
-} mem3;
+} mem3 = {};
+
+#define mem3 GLOBAL(struct Mem3Global, mem3)
/*
** Unlink the chunk at mem3.aPool[i] from list it is currently
@@ -583,8 +585,8 @@ static void memsys3Shutdown(void *NotUsed){
** Open the file indicated and write a log of all unfreed memory
** allocations into that log.
*/
-#ifdef SQLITE_DEBUG
void sqlite3Memsys3Dump(const char *zFilename){
+#ifdef SQLITE_DEBUG
FILE *out;
int i, j;
u32 size;
@@ -651,8 +653,8 @@ void sqlite3Memsys3Dump(const char *zFilename){
}else{
fclose(out);
}
-}
#endif
+}
/*
** This routine is the only routine in this file with external
diff --git a/src/mem5.c b/src/mem5.c
index 9ee0adb28..1ce044248 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.12 2008/09/01 18:34:20 danielk1977 Exp $
+** $Id: mem5.c,v 1.13 2008/09/02 10:22:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -85,7 +85,7 @@ struct Mem5Link {
** static variables organized and to reduce namespace pollution
** when this module is combined with other in the amalgamation.
*/
-static struct {
+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
@@ -132,7 +132,9 @@ static struct {
int nAtom; /* Smallest possible allocation in bytes */
int nBlock; /* Number of nAtom sized blocks in zPool */
u8 *zPool;
-} mem5;
+} mem5 = {};
+
+#define mem5 GLOBAL(struct Mem5Global, mem5)
#define MEM5LINK(idx) ((Mem5Link *)(&mem5.zPool[(idx)*mem5.nAtom]))
diff --git a/src/mem6.c b/src/mem6.c
index 27ba307d8..168262fba 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.8 2008/09/01 18:34:20 danielk1977 Exp $
+** $Id: mem6.c,v 1.9 2008/09/02 10:22:01 danielk1977 Exp $
*/
#ifdef SQLITE_ENABLE_MEMSYS6
@@ -104,13 +104,15 @@ struct Mem6Chunk {
#define MEM6LINK(idx) ((Mem6Link *)(&pChunk->zPool[(idx)*pChunk->nAtom]))
-struct Mem6Global {
+static SQLITE_WSD struct Mem6Global {
int nMinAlloc; /* Minimum allowed allocation size */
int nThreshold; /* Allocs larger than this go to malloc() */
int nLogThreshold; /* log2 of (nThreshold/nMinAlloc) */
sqlite3_mutex *mutex;
Mem6Chunk *pChunk; /* Singly linked list of all memory chunks */
-} mem6;
+} mem6 = {};
+
+#define mem6 GLOBAL(struct Mem6Global, mem6)
/*
** Unlink the chunk at pChunk->aPool[i] from list it is currently
diff --git a/src/os.c b/src/os.c
index 0f141c378..d0a791cd3 100644
--- a/src/os.c
+++ b/src/os.c
@@ -13,7 +13,7 @@
** This file contains OS interface code that is common to all
** architectures.
**
-** $Id: os.c,v 1.120 2008/07/28 19:34:53 drh Exp $
+** $Id: os.c,v 1.121 2008/09/02 10:22:01 danielk1977 Exp $
*/
#define _SQLITE_OS_C_ 1
#include "sqliteInt.h"
@@ -190,7 +190,8 @@ int sqlite3OsCloseFree(sqlite3_file *pFile){
/*
** The list of all registered VFS implementations.
*/
-static sqlite3_vfs *vfsList = 0;
+static SQLITE_WSD sqlite3_vfs *vfsList = 0;
+#define vfsList GLOBAL(sqlite3_vfs *, vfsList)
/*
** Locate a VFS by name. If no name is given, simply return the