summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2010-04-29 18:41:19 -0400
committerDavid Zeuthen <davidz@redhat.com>2010-04-29 18:41:19 -0400
commit92a1663d1fdd4e6856af59663cddf21846b36da7 (patch)
treedb25936bdd2679e5a9e4575e82baf36f6e392f9b
parenta63fb2e3d331b2c72ad6420977f14c184284da01 (diff)
Turn the g_assert() with side-effects to g_warn_if_fail()
People can turn off assertions etc etc
-rw-r--r--gdbus/example-unix-fd-client.c2
-rw-r--r--gdbus/gdbusconnection.c24
-rw-r--r--gdbus/gdbuserror.c18
-rw-r--r--gdbus/gdbusprivate.c2
4 files changed, 23 insertions, 23 deletions
diff --git a/gdbus/example-unix-fd-client.c b/gdbus/example-unix-fd-client.c
index 9e9678d..2a27097 100644
--- a/gdbus/example-unix-fd-client.c
+++ b/gdbus/example-unix-fd-client.c
@@ -88,7 +88,7 @@ on_name_appeared (GDBusConnection *connection,
now_buf,
(gint) getpid ());
len = strlen (str);
- g_assert (write (fd, str, len) == len);
+ g_warn_if_fail (write (fd, str, len) == len);
close (fd);
g_print ("Wrote the following on server's stdout:\n%s", str);
diff --git a/gdbus/gdbusconnection.c b/gdbus/gdbusconnection.c
index 7f5a21a..10b2ec4 100644
--- a/gdbus/gdbusconnection.c
+++ b/gdbus/gdbusconnection.c
@@ -2341,22 +2341,22 @@ unsubscribe_id_internal (GDBusConnection *connection,
if (subscriber->id != subscription_id)
continue;
- g_assert (g_hash_table_remove (connection->priv->map_id_to_signal_data,
- GUINT_TO_POINTER (subscription_id)));
+ g_warn_if_fail (g_hash_table_remove (connection->priv->map_id_to_signal_data,
+ GUINT_TO_POINTER (subscription_id)));
g_array_append_val (out_removed_subscribers, *subscriber);
g_array_remove_index (signal_data->subscribers, n);
if (signal_data->subscribers->len == 0)
- g_assert (g_hash_table_remove (connection->priv->map_rule_to_signal_data, signal_data->rule));
+ g_warn_if_fail (g_hash_table_remove (connection->priv->map_rule_to_signal_data, signal_data->rule));
signal_data_array = g_hash_table_lookup (connection->priv->map_sender_to_signal_data_array,
signal_data->sender);
- g_assert (signal_data_array != NULL);
- g_assert (g_ptr_array_remove (signal_data_array, signal_data));
+ g_warn_if_fail (signal_data_array != NULL);
+ g_warn_if_fail (g_ptr_array_remove (signal_data_array, signal_data));
if (signal_data_array->len == 0)
{
- g_assert (g_hash_table_remove (connection->priv->map_sender_to_signal_data_array, signal_data->sender));
+ g_warn_if_fail (g_hash_table_remove (connection->priv->map_sender_to_signal_data_array, signal_data->sender));
/* remove the match rule from the bus unless NameLost or NameAcquired (see subscribe()) */
if (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION)
@@ -3672,13 +3672,13 @@ g_dbus_connection_unregister_object (GDBusConnection *connection,
eo = ei->eo;
- g_assert (g_hash_table_remove (connection->priv->map_id_to_ei, GUINT_TO_POINTER (ei->id)));
- g_assert (g_hash_table_remove (eo->map_if_name_to_ei, ei->interface_name));
+ g_warn_if_fail (g_hash_table_remove (connection->priv->map_id_to_ei, GUINT_TO_POINTER (ei->id)));
+ g_warn_if_fail (g_hash_table_remove (eo->map_if_name_to_ei, ei->interface_name));
/* unregister object path if we have no more exported interfaces */
if (g_hash_table_size (eo->map_if_name_to_ei) == 0)
{
- g_assert (g_hash_table_remove (connection->priv->map_object_path_to_eo,
- eo->object_path));
+ g_warn_if_fail (g_hash_table_remove (connection->priv->map_object_path_to_eo,
+ eo->object_path));
}
ret = TRUE;
@@ -4538,8 +4538,8 @@ g_dbus_connection_unregister_subtree (GDBusConnection *connection,
goto out;
}
- g_assert (g_hash_table_remove (connection->priv->map_id_to_es, GUINT_TO_POINTER (es->id)));
- g_assert (g_hash_table_remove (connection->priv->map_object_path_to_es, es->object_path));
+ g_warn_if_fail (g_hash_table_remove (connection->priv->map_id_to_es, GUINT_TO_POINTER (es->id)));
+ g_warn_if_fail (g_hash_table_remove (connection->priv->map_object_path_to_es, es->object_path));
ret = TRUE;
diff --git a/gdbus/gdbuserror.c b/gdbus/gdbuserror.c
index 91ff7c6..eebb545 100644
--- a/gdbus/gdbuserror.c
+++ b/gdbus/gdbuserror.c
@@ -187,9 +187,9 @@ g_dbus_error_register_error_domain (const gchar *error_domain_quark_na
for (n = 0; n < num_entries; n++)
{
- g_assert (g_dbus_error_register_error (quark,
- entries[n].error_code,
- entries[n].dbus_error_name));
+ g_warn_if_fail (g_dbus_error_register_error (quark,
+ entries[n].error_code,
+ entries[n].dbus_error_name));
}
g_once_init_leave (quark_volatile, quark);
}
@@ -422,19 +422,19 @@ g_dbus_error_unregister_error (GQuark error_domain,
QuarkCodePair pair;
pair.error_domain = error_domain;
pair.error_code = error_code;
- g_assert (g_hash_table_lookup (quark_code_pair_to_re, &pair) == NULL); /* check invariant */
+ g_warn_if_fail (g_hash_table_lookup (quark_code_pair_to_re, &pair) == NULL); /* check invariant */
goto out;
}
- g_assert (g_hash_table_lookup (quark_code_pair_to_re, &(re->pair)) == re); /* check invariant */
+ g_warn_if_fail (g_hash_table_lookup (quark_code_pair_to_re, &(re->pair)) == re); /* check invariant */
- g_assert (g_hash_table_remove (quark_code_pair_to_re, &(re->pair)));
- g_assert (g_hash_table_remove (dbus_error_name_to_re, re));
+ g_warn_if_fail (g_hash_table_remove (quark_code_pair_to_re, &(re->pair)));
+ g_warn_if_fail (g_hash_table_remove (dbus_error_name_to_re, re));
/* destroy hashes if empty */
hash_size = g_hash_table_size (dbus_error_name_to_re);
if (hash_size == 0)
{
- g_assert (g_hash_table_size (quark_code_pair_to_re) == 0); /* check invariant */
+ g_warn_if_fail (g_hash_table_size (quark_code_pair_to_re) == 0); /* check invariant */
g_hash_table_unref (dbus_error_name_to_re);
dbus_error_name_to_re = NULL;
@@ -443,7 +443,7 @@ g_dbus_error_unregister_error (GQuark error_domain,
}
else
{
- g_assert (g_hash_table_size (quark_code_pair_to_re) == hash_size); /* check invariant */
+ g_warn_if_fail (g_hash_table_size (quark_code_pair_to_re) == hash_size); /* check invariant */
}
out:
diff --git a/gdbus/gdbusprivate.c b/gdbus/gdbusprivate.c
index fad7b4d..68184d8 100644
--- a/gdbus/gdbusprivate.c
+++ b/gdbus/gdbusprivate.c
@@ -647,7 +647,7 @@ write_message (GDBusWorker *worker,
{
gboolean ret;
- g_assert (data->blob_size > 16);
+ g_return_val_if_fail (data->blob_size > 16, FALSE);
ret = FALSE;