main: Use gboolean type in GOptionEntry
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 26 Aug 2013 10:03:48 +0000 (13:03 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 2 Sep 2013 11:57:25 +0000 (13:57 +0200)
The GOptionEntry options need to be of gboolean type as they are passed
as pointers. When the size of gboolean is different from the size of
bool, it will cause option variables to be overwritten by each other.

src/log.c
src/main.c
src/near.h

index 0b6c136..74e748a 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -96,7 +96,7 @@ static bool is_enabled(struct near_debug_desc *desc)
        return false;
 }
 
-int __near_log_init(const char *debug, bool detach)
+int __near_log_init(const char *debug, gboolean detach)
 {
        int option = LOG_NDELAY | LOG_PID;
        struct near_debug_desc *desc;
index 46dba44..9d5ac02 100644 (file)
@@ -170,8 +170,8 @@ static void disconnect_callback(DBusConnection *conn, void *user_data)
 static gchar *option_debug = NULL;
 static gchar *option_plugin = NULL;
 static gchar *option_noplugin = NULL;
-static bool option_detach = true;
-static bool option_version = false;
+static gboolean option_detach = TRUE;
+static gboolean option_version = FALSE;
 
 static bool parse_debug(const char *key, const char *value,
                                        gpointer user_data, GError **error)
index 14a8586..5459702 100644 (file)
@@ -35,7 +35,7 @@ struct near_device_driver;
 
 #include <near/log.h>
 
-int __near_log_init(const char *debug, bool detach);
+int __near_log_init(const char *debug, gboolean detach);
 void __near_log_cleanup(void);
 
 #include <near/dbus.h>