From eb3b99e7c610988823804f5e6c92aa13459605c7 Mon Sep 17 00:00:00 2001 From: Kjartan Maraas Date: Tue, 21 Apr 2009 12:52:22 -0400 Subject: Bug 19502 - Sparse warning cleanups 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 --- bus/desktop-file.c | 2 +- bus/driver.c | 2 +- dbus/dbus-connection.c | 4 ++-- dbus/dbus-keyring.c | 4 ++-- dbus/dbus-string.c | 2 +- dbus/dbus-sysdeps-util-unix.c | 3 ++- dbus/dbus-transport.c | 2 +- test/name-test/test-names.c | 2 +- test/name-test/test-shutdown.c | 2 +- tools/dbus-launch.c | 2 +- tools/dbus-monitor.c | 2 +- 11 files changed, 14 insertions(+), 13 deletions(-) diff --git a/bus/desktop-file.c b/bus/desktop-file.c index 2fe26a11..2ba77292 100644 --- a/bus/desktop-file.c +++ b/bus/desktop-file.c @@ -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 , diff --git a/bus/driver.c b/bus/driver.c index c97bff5d..b5138067 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -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; diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index ae07adf0..d44d728b 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -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 diff --git a/dbus/dbus-keyring.c b/dbus/dbus-keyring.c index de6a5ea4..8cc4048f 100644 --- a/dbus/dbus-keyring.c +++ b/dbus/dbus-keyring.c @@ -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) diff --git a/dbus/dbus-string.c b/dbus/dbus-string.c index 6b9b2bfe..85812c48 100644 --- a/dbus/dbus-string.c +++ b/dbus/dbus-string.c @@ -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); diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index 03928044..d31e1441 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -1233,4 +1233,5 @@ fail: _dbus_string_free (&cmdline); _dbus_string_free (&path); return FALSE; -} \ No newline at end of file +} + diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c index 90291980..35b7027d 100644 --- a/dbus/dbus-transport.c +++ b/dbus/dbus-transport.c @@ -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++) { diff --git a/test/name-test/test-names.c b/test/name-test/test-names.c index f4b0ba08..b09f3638 100644 --- a/test/name-test/test-names.c +++ b/test/name-test/test-names.c @@ -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, diff --git a/test/name-test/test-shutdown.c b/test/name-test/test-shutdown.c index c50ef4b6..e76c1ea2 100644 --- a/test/name-test/test-shutdown.c +++ b/test/name-test/test-shutdown.c @@ -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; diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c index 139d0aaf..9c47d7e3 100644 --- a/tools/dbus-launch.c +++ b/tools/dbus-launch.c @@ -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); diff --git a/tools/dbus-monitor.c b/tools/dbus-monitor.c index ee03d854..cbd7a489 100644 --- a/tools/dbus-monitor.c +++ b/tools/dbus-monitor.c @@ -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) -- cgit