[babl] get rid of hack_hack(), use NEEDS_BABL_DB instead



commit e46c1706f34c32093143585f58da9c119686035f
Author: Nils Philippsen <nils redhat com>
Date:   Thu May 26 16:04:54 2011 +0200

    get rid of hack_hack(), use NEEDS_BABL_DB instead

 babl/babl-component.c  |    1 +
 babl/babl-conversion.c |    1 +
 babl/babl-db.h         |    3 +++
 babl/babl-extension.c  |    1 +
 babl/babl-fish.c       |    2 ++
 babl/babl-format.c     |    1 +
 babl/babl-internal.h   |   11 -----------
 babl/babl-model.c      |    1 +
 babl/babl-type.c       |    1 +
 9 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/babl/babl-component.c b/babl/babl-component.c
index 0d03647..65e8767 100644
--- a/babl/babl-component.c
+++ b/babl/babl-component.c
@@ -17,6 +17,7 @@
  */
 
 #include "config.h"
+#define NEEDS_BABL_DB
 #include "babl-internal.h"
 #include "babl-db.h"
 #include <string.h>
diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c
index 99a1e34..446979d 100644
--- a/babl/babl-conversion.c
+++ b/babl/babl-conversion.c
@@ -21,6 +21,7 @@
 #include <string.h>
 #include <stdarg.h>
 #include <math.h>
+#define NEEDS_BABL_DB
 #include "babl-internal.h"
 #include "babl-db.h"
 
diff --git a/babl/babl-db.h b/babl/babl-db.h
index a07a17b..d576e6c 100644
--- a/babl/babl-db.h
+++ b/babl/babl-db.h
@@ -38,6 +38,9 @@ typedef struct _BablDb
   BablMutex     *mutex;
 } _BablDb;
 
+#ifdef NEEDS_BABL_DB
+static BablDb *db = NULL;
+#endif /* NEEDS_BABL_DB */
 
 BablDb *
 babl_db_init (void);
diff --git a/babl/babl-extension.c b/babl/babl-extension.c
index 9c05e53..d021914 100644
--- a/babl/babl-extension.c
+++ b/babl/babl-extension.c
@@ -27,6 +27,7 @@
 #define BABL_INIT_HOOK    init_hook (); dynamic_init_hook ();
 #endif
 
+#define NEEDS_BABL_DB
 #include "babl-internal.h"
 #include "babl-db.h"
 #include "babl-base.h"
diff --git a/babl/babl-fish.c b/babl/babl-fish.c
index dad518b..67e53fb 100644
--- a/babl/babl-fish.c
+++ b/babl/babl-fish.c
@@ -17,7 +17,9 @@
  */
 
 #include "config.h"
+#define NEEDS_BABL_DB
 #include "babl-internal.h"
+#include "babl-db.h"
 #include <stddef.h>
 #include <string.h>
 #include <stdarg.h>
diff --git a/babl/babl-format.c b/babl/babl-format.c
index 830d95f..af7af69 100644
--- a/babl/babl-format.c
+++ b/babl/babl-format.c
@@ -21,6 +21,7 @@
 #include <stdarg.h>
 #include <math.h>
 
+#define NEEDS_BABL_DB
 #include "babl-internal.h"
 #include "babl-db.h"
 
diff --git a/babl/babl-internal.h b/babl/babl-internal.h
index da5f923..fbc45c3 100644
--- a/babl/babl-internal.h
+++ b/babl/babl-internal.h
@@ -112,16 +112,6 @@ Babl   * babl_format_with_model_as_type (Babl           *model,
 int      babl_formats_count             (void);                                     /* should maybe be templated? */
 int      babl_type_is_symmetric         (Babl           *babl);
 
-/* FIXME: nasty,. including the symbol even in files where it is
- * not needed,. and a dummy function to use it in those cases
- */
-static BablDb *db=NULL;
-static void hack_hack (void)
-{
-  if (db==NULL)
-    db=NULL;
-}
-
 /**** LOGGER ****/
 #include <stdarg.h>
 
@@ -152,7 +142,6 @@ real_babl_log (const char *file,
   fprintf (stdout, "\n");
   fflush (NULL);
   return;
-  hack_hack ();
 }
 
 /* Provide a string identifying the current function, non-concatenatable */
diff --git a/babl/babl-model.c b/babl/babl-model.c
index 38bbfc3..df71be4 100644
--- a/babl/babl-model.c
+++ b/babl/babl-model.c
@@ -20,6 +20,7 @@
 #include <string.h>
 #include <stdarg.h>
 #include <math.h>
+#define NEEDS_BABL_DB
 #include "babl-internal.h"
 #include "babl-db.h"
 
diff --git a/babl/babl-type.c b/babl/babl-type.c
index 1bf7a07..b838860 100644
--- a/babl/babl-type.c
+++ b/babl/babl-type.c
@@ -21,6 +21,7 @@
 #include <stdarg.h>
 #include <math.h>
 
+#define NEEDS_BABL_DB
 #include "babl-internal.h"
 #include "babl-db.h"
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]