git » nmdb » commit 758f64b

Move the global structures definitions from common.h to main.c.

author Alberto Bertogli
2007-03-30 02:39:56 UTC
committer Alberto Bertogli
2007-03-30 02:39:56 UTC
parent b1c18cc8554ab0b72bc9ff1881587c5fe7e530dc

Move the global structures definitions from common.h to main.c.

Thanks to a sparse run, I noticed that the definition of several shared
structures is inside the header, which isn't quite nice.
This patch moves them to main.c.

nmdb/common.h +8 -6
nmdb/main.c +7 -0

diff --git a/nmdb/common.h b/nmdb/common.h
index 81a220d..210ca4a 100644
--- a/nmdb/common.h
+++ b/nmdb/common.h
@@ -6,27 +6,29 @@
 
 /* The cache table */
 #include "cache.h"
-struct cache *cache_table;
+extern struct cache *cache_table;
 
 /* The queue for database operations */
 #include "queue.h"
-struct queue *op_queue;
+extern struct queue *op_queue;
 
 /* Settings */
-struct  {
+struct settings {
 	int tipc_lower;
 	int tipc_upper;
 	int numobjs;
 	int foreground;
 	int passive;
 	char *dbname;
-} settings;
+};
+extern struct settings settings;
 
 /* Statistics */
-struct {
+struct stats {
 	unsigned long net_version_mismatch;
 	unsigned long net_broken_req;
 	unsigned long net_unk_req;
-} stats;
+};
+extern struct stats stats;
 #endif
 
diff --git a/nmdb/main.c b/nmdb/main.c
index eae7f3a..2eb2fa2 100644
--- a/nmdb/main.c
+++ b/nmdb/main.c
@@ -15,6 +15,13 @@
 #define DEFDBNAME "database"
 
 
+/* Define the common structures that are used throughout the whole server. */
+struct settings settings;
+struct stats stats;
+struct cache *cache_table;
+struct queue *op_queue;
+
+
 static void help() {
 	char h[] = \
 	  "nmdb [options]\n"