From b65cff3d7e5f385546f1e201aeb2f94fcb9d2f45 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 20 Dec 2010 15:14:06 +0100 Subject: text-channel: don't define useless variables if debug is disabled --- telepathy-glib/text-channel.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/telepathy-glib/text-channel.c b/telepathy-glib/text-channel.c index 9eae11cc6..5d090a2d0 100644 --- a/telepathy-glib/text-channel.c +++ b/telepathy-glib/text-channel.c @@ -380,16 +380,19 @@ got_sender_contact_by_id_cb (TpConnection *connection, } else if (n_contacts != 1) { - GHashTableIter iter; - gpointer key, value; - - g_hash_table_iter_init (&iter, failed_id_errors); - while (g_hash_table_iter_next (&iter, &key, &value)) + if (DEBUGGING) { - const gchar *id = key; - GError *err = value; + GHashTableIter iter; + gpointer key, value; - DEBUG ("Failed to get a TpContact for %s: %s", id, err->message); + g_hash_table_iter_init (&iter, failed_id_errors); + while (g_hash_table_iter_next (&iter, &key, &value)) + { + const gchar *id = key; + GError *err = value; + + DEBUG ("Failed to get a TpContact for %s: %s", id, err->message); + } } sender = contacts[0]; @@ -594,8 +597,6 @@ got_pending_senders_contact_by_id_cb (TpConnection *connection, { TpTextChannel *self = (TpTextChannel *) weak_object; GList *parts_list = user_data; - GHashTableIter iter; - gpointer key, value; if (error != NULL) { @@ -603,13 +604,19 @@ got_pending_senders_contact_by_id_cb (TpConnection *connection, goto out; } - g_hash_table_iter_init (&iter, failed_id_errors); - while (g_hash_table_iter_next (&iter, &key, &value)) + if (DEBUGGING) { - const gchar *id = key; - GError *err = value; + GHashTableIter iter; + gpointer key, value; + + g_hash_table_iter_init (&iter, failed_id_errors); + while (g_hash_table_iter_next (&iter, &key, &value)) + { + const gchar *id = key; + GError *err = value; - DEBUG ("Failed to get a TpContact for %s: %s", id, err->message); + DEBUG ("Failed to get a TpContact for %s: %s", id, err->message); + } } got_pending_senders_contact (self, parts_list, n_contacts, contacts); -- cgit v1.2.3