Commit b3b9fc03 authored by Simon McVittie's avatar Simon McVittie
parents 44f25310 2829a599
......@@ -144,10 +144,10 @@ out_all:
static dbus_bool_t
clear_environment (DBusError *error)
{
const char *debug_env = NULL;
const char *starter_env = NULL;
#ifdef DBUS_ENABLE_VERBOSE_MODE
const char *debug_env = NULL;
/* are we debugging */
debug_env = _dbus_getenv ("DBUS_VERBOSE");
#endif
......
......@@ -2538,14 +2538,18 @@ bus_activation_service_reload_test (const DBusString *test_data_dir)
_dbus_assert_not_reached ("could not initiate service reload test");
if (!do_service_reload_test (&directory, FALSE))
; /* Do nothing? */
{
/* Do nothing? */
}
/* Do OOM tests */
if (!init_service_reload_test (&directory))
_dbus_assert_not_reached ("could not initiate service reload test");
if (!do_service_reload_test (&directory, TRUE))
; /* Do nothing? */
{
/* Do nothing? */
}
/* Cleanup test directory */
if (!cleanup_service_reload_test (&directory))
......
......@@ -403,14 +403,6 @@ free_connection_data (void *data)
dbus_free (d);
}
static void
call_timeout_callback (DBusTimeout *timeout,
void *data)
{
/* can return FALSE on OOM but we just let it fire again later */
dbus_timeout_handle (timeout);
}
BusConnections*
bus_connections_new (BusContext *context)
{
......@@ -838,12 +830,7 @@ bus_connection_get_unix_groups (DBusConnection *connection,
int *n_groups,
DBusError *error)
{
BusConnectionData *d;
unsigned long uid;
d = BUS_CONNECTION_DATA (connection);
_dbus_assert (d != NULL);
*groups = NULL;
*n_groups = 0;
......@@ -1459,13 +1446,7 @@ bus_connections_check_limits (BusConnections *connections,
DBusConnection *requesting_completion,
DBusError *error)
{
BusConnectionData *d;
unsigned long uid;
d = BUS_CONNECTION_DATA (requesting_completion);
_dbus_assert (d != NULL);
_dbus_assert (d->name == NULL);
if (connections->n_completed >=
bus_context_get_max_completed_connections (connections->context))
......
......@@ -827,7 +827,6 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
DBusMessageIter iter;
DBusMessageIter dict_iter;
DBusMessageIter dict_entry_iter;
int msg_type;
int array_type;
int key_type;
DBusList *keys, *key_link;
......@@ -842,9 +841,13 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
/* The message signature has already been checked for us,
* so let's just assert it's right.
*/
msg_type = dbus_message_iter_get_arg_type (&iter);
#ifndef DBUS_DISABLE_ASSERT
{
int msg_type = dbus_message_iter_get_arg_type (&iter);
_dbus_assert (msg_type == DBUS_TYPE_ARRAY);
_dbus_assert (msg_type == DBUS_TYPE_ARRAY);
}
#endif
dbus_message_iter_recurse (&iter, &dict_iter);
......@@ -1930,7 +1933,7 @@ bus_driver_handle_message (DBusConnection *connection,
DBusMessage *message,
DBusError *error)
{
const char *name, *sender, *interface;
const char *name, *interface;
const InterfaceHandler *ih;
const MessageHandler *mh;
dbus_bool_t found_interface = FALSE;
......@@ -1957,13 +1960,17 @@ bus_driver_handle_message (DBusConnection *connection,
_dbus_assert (dbus_message_get_member (message) != NULL);
name = dbus_message_get_member (message);
sender = dbus_message_get_sender (message);
_dbus_verbose ("Driver got a method call: %s\n",
dbus_message_get_member (message));
_dbus_verbose ("Driver got a method call: %s\n", name);
/* security checks should have kept this from getting here */
_dbus_assert (sender != NULL || strcmp (name, "Hello") == 0);
#ifndef DBUS_DISABLE_ASSERT
{
const char *sender = dbus_message_get_sender (message);
_dbus_assert (sender != NULL || strcmp (name, "Hello") == 0);
}
#endif
for (ih = interface_handlers; ih->name != NULL; ih++)
{
......@@ -2009,7 +2016,6 @@ bus_driver_handle_message (DBusConnection *connection,
}
}
unknown:
_dbus_verbose ("No driver handler for message \"%s\"\n",
name);
......
......@@ -385,7 +385,6 @@ bus_registry_acquire_service (BusRegistry *registry,
{
dbus_bool_t retval;
DBusConnection *old_owner_conn;
DBusConnection *current_owner_conn;
BusClientPolicy *policy;
BusService *service;
BusActivation *activation;
......@@ -510,12 +509,10 @@ bus_registry_acquire_service (BusRegistry *registry,
primary_owner = bus_service_get_primary_owner (service);
if (primary_owner == NULL)
goto out;
current_owner_conn = primary_owner->conn;
if (old_owner_conn == NULL)
{
_dbus_assert (current_owner_conn == connection);
_dbus_assert (primary_owner->conn == connection);
*result = DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER;
}
......
......@@ -40,8 +40,6 @@ static dbus_bool_t
add_client_watch (DBusWatch *watch,
void *data)
{
DBusConnection *connection = data;
return _dbus_loop_add_watch (client_loop, watch);
}
......@@ -49,8 +47,6 @@ static void
remove_client_watch (DBusWatch *watch,
void *data)
{
DBusConnection *connection = data;
_dbus_loop_remove_watch (client_loop, watch);
}
......@@ -58,8 +54,6 @@ static dbus_bool_t
add_client_timeout (DBusTimeout *timeout,
void *data)
{
DBusConnection *connection = data;
return _dbus_loop_add_timeout (client_loop, timeout);
}
......@@ -67,8 +61,6 @@ static void
remove_client_timeout (DBusTimeout *timeout,
void *data)
{
DBusConnection *connection = data;
_dbus_loop_remove_timeout (client_loop, timeout);
}
......
......@@ -3884,7 +3884,8 @@ dbus_connection_steal_borrowed_message (DBusConnection *connection,
pop_message = _dbus_list_pop_first (&connection->incoming_messages);
_dbus_assert (message == pop_message);
(void) pop_message; /* unused unless asserting */
connection->n_incoming -= 1;
_dbus_verbose ("Incoming message %p stolen from queue, %d incoming\n",
......
......@@ -108,20 +108,20 @@ dbus_bool_t _dbus_is_verbose_real (void);
# define _dbus_is_verbose _dbus_is_verbose_real
#else
# ifdef HAVE_ISO_VARARGS
# define _dbus_verbose(...)
# define _dbus_verbose(...) do { } while (0)
# elif defined (HAVE_GNUC_VARARGS)
# define _dbus_verbose(format...)
# define _dbus_verbose(format...) do { } while (0)
# else
static void _dbus_verbose(const char * x,...) {;}
# endif
# define _dbus_verbose_reset()
# define _dbus_verbose_reset() do { } while (0)
# define _dbus_is_verbose() FALSE
#endif /* !DBUS_ENABLE_VERBOSE_MODE */
const char* _dbus_strerror (int error_number);
#ifdef DBUS_DISABLE_ASSERT
#define _dbus_assert(condition)
#define _dbus_assert(condition) do { } while (0)
#else
void _dbus_real_assert (dbus_bool_t condition,
const char *condition_text,
......@@ -133,7 +133,7 @@ void _dbus_real_assert (dbus_bool_t condition,
#endif /* !DBUS_DISABLE_ASSERT */
#ifdef DBUS_DISABLE_ASSERT
#define _dbus_assert_not_reached(explanation)
#define _dbus_assert_not_reached(explanation) do { } while (0)
#else
void _dbus_real_assert_not_reached (const char *explanation,
const char *file,
......@@ -181,8 +181,8 @@ extern const char *_dbus_return_if_fail_warning_format;
/* this is an assert and not an error, but in the typical --disable-checks case (you're trying
* to really minimize code size), disabling these assertions makes sense.
*/
#define _DBUS_ASSERT_ERROR_IS_SET(error)
#define _DBUS_ASSERT_ERROR_IS_CLEAR(error)
#define _DBUS_ASSERT_ERROR_IS_SET(error) do { } while (0)
#define _DBUS_ASSERT_ERROR_IS_CLEAR(error) do { } while (0)
#else
#define _DBUS_ASSERT_ERROR_IS_SET(error) _dbus_assert ((error) == NULL || dbus_error_is_set ((error)))
#define _DBUS_ASSERT_ERROR_IS_CLEAR(error) _dbus_assert ((error) == NULL || !dbus_error_is_set ((error)))
......
......@@ -99,7 +99,6 @@ watch_flags_from_poll_revents (short revents)
typedef struct
{
int refcount;
DBusTimeout *timeout;
unsigned long last_tv_sec;
unsigned long last_tv_usec;
......@@ -119,31 +118,13 @@ timeout_callback_new (DBusTimeout *timeout)
cb->timeout = timeout;
_dbus_get_current_time (&cb->last_tv_sec,
&cb->last_tv_usec);
cb->refcount = 1;
return cb;
}
static TimeoutCallback *
timeout_callback_ref (TimeoutCallback *cb)
{
_dbus_assert (cb->refcount > 0);
cb->refcount += 1;
return cb;
}
static void
timeout_callback_unref (TimeoutCallback *cb)
timeout_callback_free (TimeoutCallback *cb)
{
_dbus_assert (cb->refcount > 0);
cb->refcount -= 1;
if (cb->refcount == 0)
{
dbus_free (cb);
}
dbus_free (cb);
}
static void
......@@ -253,7 +234,6 @@ cull_watches_for_invalid_fd (DBusLoop *loop,
int fd)
{
DBusList *link;
DBusList *next;
DBusList **watches;
_dbus_warn ("invalid request, socket fd %d not open\n", fd);
......@@ -379,7 +359,7 @@ _dbus_loop_add_timeout (DBusLoop *loop,
}
else
{
timeout_callback_unref (tcb);
timeout_callback_free (tcb);
return FALSE;
}
......@@ -403,7 +383,7 @@ _dbus_loop_remove_timeout (DBusLoop *loop,
_dbus_list_remove_link (&loop->timeouts, link);
loop->callback_list_serial += 1;
loop->timeout_count -= 1;
timeout_callback_unref (this);
timeout_callback_free (this);
return;
}
......
......@@ -2267,12 +2267,14 @@ dbus_message_iter_get_fixed_array (DBusMessageIter *iter,
int *n_elements)
{
DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
#ifndef DBUS_DISABLE_CHECKS
int subtype = _dbus_type_reader_get_current_type(&real->u.reader);
_dbus_return_if_fail (_dbus_message_iter_check (real));
_dbus_return_if_fail (value != NULL);
_dbus_return_if_fail ((subtype == DBUS_TYPE_INVALID) ||
(dbus_type_is_fixed (subtype) && subtype != DBUS_TYPE_UNIX_FD));
#endif
_dbus_type_reader_read_fixed_multi (&real->u.reader,
value, n_elements);
......@@ -2824,12 +2826,14 @@ dbus_message_iter_abandon_container (DBusMessageIter *iter,
DBusMessageIter *sub)
{
DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
#ifndef DBUS_DISABLE_CHECKS
DBusMessageRealIter *real_sub = (DBusMessageRealIter *)sub;
_dbus_return_if_fail (_dbus_message_iter_append_check (real));
_dbus_return_if_fail (real->iter_type == DBUS_MESSAGE_ITER_TYPE_WRITER);
_dbus_return_if_fail (_dbus_message_iter_append_check (real_sub));
_dbus_return_if_fail (real_sub->iter_type == DBUS_MESSAGE_ITER_TYPE_WRITER);
#endif
_dbus_message_iter_abandon_signature (real);
}
......@@ -4701,6 +4705,7 @@ dbus_message_demarshal_bytes_needed(const char *buf,
if (validity == DBUS_VALID)
{
_dbus_assert (have_message || (header_len + body_len) > len);
(void) have_message; /* unused unless asserting */
return header_len + body_len;
}
else
......
......@@ -502,8 +502,7 @@ compose_string (char **strings, char separator)
int n = 0;
char *buf;
char *p;
const char *ptr;
if (!strings || !strings[0])
return 0;
for (i = 0; strings[i]; i++)
......@@ -583,7 +582,7 @@ static DWORD __stdcall
babysitter (void *parameter)
{
DBusBabysitter *sitter = (DBusBabysitter *) parameter;
int fd;
PING();
_dbus_babysitter_ref (sitter);
......
......@@ -1103,7 +1103,9 @@ babysit (pid_t grandchild_pid,
{
char b;
if (read (sigchld_pipe[READ_END], &b, 1) == -1)
/* ignore */;
{
/* ignore */
}
/* do waitpid check */
check_babysit_events (grandchild_pid, parent_pipe, 0);
}
......
......@@ -75,6 +75,7 @@ _DBUS_STATIC_ASSERT (sizeof (DBusRealString) == sizeof (DBusString));
*/
#define DBUS_GENERIC_STRING_PREAMBLE(real) \
do { \
(void) real; /* might be unused unless asserting */ \
_dbus_assert ((real) != NULL); \
_dbus_assert (!(real)->invalid); \
_dbus_assert ((real)->len >= 0); \
......
......@@ -820,9 +820,6 @@ _dbus_full_duplex_pipe (int *fd1,
struct sockaddr_in saddr;
int len;
u_long arg;
fd_set read_set, write_set;
struct timeval tv;
int res;
_dbus_win_startup_winsock ();
......@@ -958,7 +955,6 @@ _dbus_poll (DBusPollFD *fds,
msgp += sprintf (msgp, "WSAEventSelect: to=%d\n\t", timeout_milliseconds);
for (i = 0; i < n_fds; i++)
{
static dbus_bool_t warned = FALSE;
DBusPollFD *fdp = &fds[i];
......@@ -1096,7 +1092,6 @@ _dbus_poll (DBusPollFD *fds,
msgp += sprintf (msgp, "select: to=%d\n\t", timeout_milliseconds);
for (i = 0; i < n_fds; i++)
{
static dbus_bool_t warned = FALSE;
DBusPollFD *fdp = &fds[i];
......@@ -2623,9 +2618,7 @@ dbus_bool_t
_dbus_daemon_is_session_bus_address_published (const char *scope)
{
HANDLE lock;
HANDLE mutex;
DBusString mutex_name;
DWORD ret;
if (!_dbus_get_mutex_name(&mutex_name,scope))
{
......@@ -2670,8 +2663,6 @@ _dbus_daemon_publish_session_bus_address (const char* address, const char *scope
{
HANDLE lock;
char *shared_addr = NULL;
DWORD ret;
char addressInfo[1024];
DBusString shm_name;
DBusString mutex_name;
......@@ -3131,8 +3122,6 @@ dbus_bool_t
_dbus_get_install_root(char *prefix, int len)
{
//To find the prefix, we cut the filename and also \bin\ if present
char* p = 0;
int i;
DWORD pathLength;
char *lastSlash;
SetLastError( 0 );
......@@ -3286,7 +3275,6 @@ _dbus_append_keyring_directory_for_credentials (DBusString *directory,
{
DBusString homedir;
DBusString dotdir;
dbus_uid_t uid;
const char *homepath;
const char *homedrive;
......
......@@ -184,7 +184,6 @@ connect_to_bus (const gchar *address)
static DBusHandlerResult
sender_send_unicast_to_sender (Fixture *f)
{
DBusError error = DBUS_ERROR_INIT;
DBusMessage *signal;
signal = dbus_message_new_signal (SENDER_PATH, SENDER_IFACE,
......@@ -207,7 +206,6 @@ sender_send_unicast_to_sender (Fixture *f)
static DBusHandlerResult
sender_send_unicast_to_receiver (Fixture *f)
{
DBusError error = DBUS_ERROR_INIT;
DBusMessage *signal;
signal = dbus_message_new_signal (SENDER_PATH, SENDER_IFACE, SENDER_SIGNAL_NAME);
......@@ -227,7 +225,6 @@ sender_send_unicast_to_receiver (Fixture *f)
static DBusHandlerResult
sender_send_broadcast (Fixture *f)
{
DBusError error = DBUS_ERROR_INIT;
DBusMessage *signal;
signal = dbus_message_new_signal (SENDER_PATH, SENDER_IFACE, SENDER_SIGNAL_NAME);
......@@ -252,7 +249,6 @@ sender_send_broadcast (Fixture *f)
static DBusHandlerResult
sender_send_stopper (Fixture *f)
{
DBusError error = DBUS_ERROR_INIT;
DBusMessage *signal;
signal = dbus_message_new_signal (SENDER_PATH, SENDER_IFACE, SENDER_STOPPER_NAME);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment