Bug 19502 - Sparse warning cleanups
authorKjartan Maraas <kmaraas@gnome.org>
Tue, 21 Apr 2009 16:52:22 +0000 (12:52 -0400)
committerColin Walters <walters@verbum.org>
Wed, 6 May 2009 16:51:18 +0000 (12:51 -0400)
This patch makes various things that should be static static,
corrects some "return FALSE" where it should be NULL, etc.

Signed-off-by: Colin Walters <walters@verbum.org>
bus/desktop-file.c
bus/driver.c
dbus/dbus-connection.c
dbus/dbus-keyring.c
dbus/dbus-string.c
dbus/dbus-sysdeps-util-unix.c
dbus/dbus-transport.c
test/name-test/test-names.c
test/name-test/test-shutdown.c
tools/dbus-launch.c
tools/dbus-monitor.c

index 2fe26a1..2ba7729 100644 (file)
@@ -66,7 +66,7 @@ typedef struct
 
 #define VALID_KEY_CHAR 1
 #define VALID_LOCALE_CHAR 2
-unsigned char valid[256] = { 
+static unsigned char valid[256] = { 
    0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 
    0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 
    0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x3 , 0x2 , 0x0 , 
index c97bff5..b513806 100644 (file)
@@ -1643,7 +1643,7 @@ bus_driver_handle_get_id (DBusConnection *connection,
  * frequency of use (but doesn't matter with only a few items
  * anyhow)
  */
-struct
+static struct
 {
   const char *name;
   const char *in_args;
index ae07adf..d44d728 100644 (file)
@@ -2927,7 +2927,7 @@ dbus_connection_get_server_id (DBusConnection *connection)
 {
   char *id;
 
-  _dbus_return_val_if_fail (connection != NULL, FALSE);
+  _dbus_return_val_if_fail (connection != NULL, NULL);
   
   CONNECTION_LOCK (connection);
   id = _dbus_strdup (_dbus_transport_get_server_id (connection->transport));
@@ -3340,7 +3340,7 @@ dbus_connection_send_with_reply_and_block (DBusConnection     *connection,
  * 
  * @param connection the connection.
  */
-DBusDispatchStatus
+static DBusDispatchStatus
 _dbus_connection_flush_unlocked (DBusConnection *connection)
 {
   /* We have to specify DBUS_ITERATION_DO_READING here because
index de6a5ea..8cc4048 100644 (file)
@@ -1075,7 +1075,7 @@ _dbus_keyring_test (void)
   dbus_error_init (&error);
   ring1 = _dbus_keyring_new_for_credentials (NULL, &context,
                                              &error);
-  _dbus_assert (ring1);
+  _dbus_assert (ring1 != NULL);
   _dbus_assert (error.name == NULL);
 
   id = _dbus_keyring_get_best_key (ring1, &error);
@@ -1087,7 +1087,7 @@ _dbus_keyring_test (void)
     }
 
   ring2 = _dbus_keyring_new_for_credentials (NULL, &context, &error);
-  _dbus_assert (ring2);
+  _dbus_assert (ring2 != NULL);
   _dbus_assert (error.name == NULL);
   
   if (ring1->n_keys != ring2->n_keys)
index 6b9b2bf..85812c4 100644 (file)
@@ -1245,7 +1245,7 @@ _dbus_string_append_printf_valist  (DBusString        *str,
                                     va_list            args)
 {
   int len;
-  va_list args_copy;
+  va_list args_copy = 0;
 
   DBUS_STRING_PREAMBLE (str);
 
index 0392804..d31e144 100644 (file)
@@ -1233,4 +1233,5 @@ fail:
   _dbus_string_free (&cmdline);
   _dbus_string_free (&path);
   return FALSE;
-}
\ No newline at end of file
+}
+
index 9029198..35b7027 100644 (file)
@@ -242,7 +242,7 @@ check_address (const char *address, DBusError *error)
   _dbus_assert (*address != '\0');
 
   if (!dbus_parse_address (address, &entries, &len, error))
-    return FALSE;              /* not a valid address */
+    return NULL;              /* not a valid address */
 
   for (i = 0; i < len; i++)
     {
index f4b0ba0..b09f363 100644 (file)
@@ -37,7 +37,7 @@ typedef struct {
   int expected_queue[NUM_CONN];
 } CommandAndResult;
 
-CommandAndResult test_data[] = {
+static CommandAndResult test_data[] = {
   {ADD_CONNECTION, 0, ALLOW_REPLACEMENT | REPLACE_EXISTING,
    PRIMARY_OWNER, {0,-1,-1,-1}},
   {ADD_CONNECTION, 0, REPLACE_EXISTING,
index c50ef4b..e76c1ea 100644 (file)
@@ -11,7 +11,7 @@ die (const char *message)
 }
 
 static void
-open_destroy_shared_session_bus_connection ()
+open_destroy_shared_session_bus_connection (void)
 {
   DBusError error;
   DBusConnection *connection;
index 139d0aa..9c47d7e 100644 (file)
@@ -335,7 +335,7 @@ do_waitpid (pid_t pid)
 static pid_t bus_pid_to_kill = -1;
 
 static void
-kill_bus()
+kill_bus(void)
 {
   verbose ("Killing message bus and exiting babysitter\n");
   kill (bus_pid_to_kill, SIGTERM);
index ee03d85..cbd7a48 100644 (file)
@@ -195,7 +195,7 @@ usage (char *name, int ecode)
   exit (ecode);
 }
 
-dbus_bool_t sigint_received = FALSE;
+static dbus_bool_t sigint_received = FALSE;
 
 static void
 sigint_handler (int signum)