telepathy-gabble: Don't use add_child_with_content with NULL/"" content

Will Thompson wjt at kemper.freedesktop.org
Thu Dec 6 04:32:25 PST 2012


Module: telepathy-gabble
Branch: master
Commit: 6bc2931e859d9c23b8d81fede23c0a962514dfae
URL:    http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=6bc2931e859d9c23b8d81fede23c0a962514dfae

Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Tue Nov 27 15:40:29 2012 +0000

Don't use add_child_with_content with NULL/"" content

This is harmless, but looks messy. It's leftover clutter from the
loudmouth era.

---

 src/ft-channel.c              |    4 ++--
 src/jingle-content.c          |    2 +-
 src/jingle-media-rtp.c        |    4 ++--
 src/jingle-session.c          |    4 ++--
 src/jingle-share.c            |   12 ++++++------
 src/jingle-transport-google.c |    2 +-
 src/jingle-transport-iceudp.c |    2 +-
 src/jingle-transport-rawudp.c |    2 +-
 src/muc-channel.c             |    2 +-
 src/search-channel.c          |    6 +++---
 src/util.c                    |    2 +-
 11 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/ft-channel.c b/src/ft-channel.c
index 69451ec..43860f5 100644
--- a/src/ft-channel.c
+++ b/src/ft-channel.c
@@ -1256,7 +1256,7 @@ offer_bytestream (GabbleFileTransferChannel *self, const gchar *jid,
   wocky_node_add_child_with_content (file_node, "desc", self->priv->description);
 
   /* we support resume */
-  wocky_node_add_child_with_content (file_node, "range", NULL);
+  wocky_node_add_child (file_node, "range");
 
   result = gabble_bytestream_factory_negotiate_stream (
       conn->bytestream_factory, msg, stream_id,
@@ -1655,7 +1655,7 @@ augment_si_reply (WockyNode *si,
       WockyNode *range;
       gchar *offset_str;
 
-      range = wocky_node_add_child_with_content (file, "range", NULL);
+      range = wocky_node_add_child (file, "range");
       offset_str = g_strdup_printf ("%" G_GUINT64_FORMAT,
           self->priv->initial_offset);
       wocky_node_set_attribute (range, "offset", offset_str);
diff --git a/src/jingle-content.c b/src/jingle-content.c
index 0c8fd78..a57e2cf 100644
--- a/src/jingle-content.c
+++ b/src/jingle-content.c
@@ -835,7 +835,7 @@ gabble_jingle_content_produce_node (GabbleJingleContent *c,
     }
   else
     {
-      content_node = wocky_node_add_child_with_content (parent, "content", NULL);
+      content_node = wocky_node_add_child (parent, "content");
       wocky_node_set_attributes (content_node,
           "name", priv->name,
           "senders", produce_senders (priv->senders),
diff --git a/src/jingle-media-rtp.c b/src/jingle-media-rtp.c
index 63284e8..65ad46b 100644
--- a/src/jingle-media-rtp.c
+++ b/src/jingle-media-rtp.c
@@ -883,7 +883,7 @@ _produce_extra_param (gpointer key, gpointer value, gpointer user_data)
   gchar *param_name = key;
   gchar *param_value = value;
 
-  param = wocky_node_add_child_with_content (pt_node, "parameter", NULL);
+  param = wocky_node_add_child (pt_node, "parameter");
   wocky_node_set_attribute (param, "name", param_name);
   wocky_node_set_attribute (param, "value", param_value);
 }
@@ -931,7 +931,7 @@ produce_payload_type (GabbleJingleContent *content,
   WockyNode *pt_node;
   gchar buf[16];
 
-  pt_node = wocky_node_add_child_with_content (desc_node, "payload-type", NULL);
+  pt_node = wocky_node_add_child (desc_node, "payload-type");
 
   /* id: required */
   sprintf (buf, "%d", p->id);
diff --git a/src/jingle-session.c b/src/jingle-session.c
index 4a9cea9..67fc3c4 100644
--- a/src/jingle-session.c
+++ b/src/jingle-session.c
@@ -823,7 +823,7 @@ fire_idle_content_reject (GabbleJingleSession *sess, const gchar *name,
 
   g_debug ("name = %s, initiator = %s", name, creator);
 
-  node = wocky_node_add_child_with_content (sess_node, "content", NULL);
+  node = wocky_node_add_child (sess_node, "content");
   wocky_node_set_attributes (node,
       "name", name, "creator", creator, NULL);
 
@@ -2131,7 +2131,7 @@ gabble_jingle_session_terminate (GabbleJingleSession *sess,
           WockyNode *r = wocky_node_add_child_with_content (session_node, "reason",
               NULL);
 
-          wocky_node_add_child_with_content (r, reason_elt, NULL);
+          wocky_node_add_child (r, reason_elt);
 
           if (text != NULL && *text != '\0')
             wocky_node_add_child_with_content (r, "text", text);
diff --git a/src/jingle-share.c b/src/jingle-share.c
index 2e9698c..b5fd9c6 100644
--- a/src/jingle-share.c
+++ b/src/jingle-share.c
@@ -461,7 +461,7 @@ produce_description (GabbleJingleContent *content, WockyNode *content_node)
   desc_node = wocky_node_add_child_ns (content_node, "description",
       NS_GOOGLE_SESSION_SHARE);
 
-  manifest_node = wocky_node_add_child_with_content (desc_node, "manifest", NULL);
+  manifest_node = wocky_node_add_child (desc_node, "manifest");
 
   for (i = priv->manifest->entries; i; i = i->next)
     {
@@ -471,9 +471,9 @@ produce_description (GabbleJingleContent *content, WockyNode *content_node)
       gchar *size_str, *width_str, *height_str;
 
       if (m->folder)
-        file_node = wocky_node_add_child_with_content (manifest_node, "folder", NULL);
+        file_node = wocky_node_add_child (manifest_node, "folder");
       else
-        file_node = wocky_node_add_child_with_content (manifest_node, "file", NULL);
+        file_node = wocky_node_add_child (manifest_node, "file");
 
       if (m->size > 0)
         {
@@ -486,7 +486,7 @@ produce_description (GabbleJingleContent *content, WockyNode *content_node)
       if (m->image &&
           (m->image_width > 0 || m->image_height > 0))
         {
-          image_node = wocky_node_add_child_with_content (file_node, "image", NULL);
+          image_node = wocky_node_add_child (file_node, "image");
           if (m->image_width > 0)
             {
               width_str = g_strdup_printf ("%d", m->image_width);
@@ -503,8 +503,8 @@ produce_description (GabbleJingleContent *content, WockyNode *content_node)
         }
     }
 
-  protocol_node = wocky_node_add_child_with_content (desc_node, "protocol", NULL);
-  http_node = wocky_node_add_child_with_content (protocol_node, "http", NULL);
+  protocol_node = wocky_node_add_child (desc_node, "protocol");
+  http_node = wocky_node_add_child (protocol_node, "http");
   url_node = wocky_node_add_child_with_content (http_node, "url",
       priv->manifest->source_url);
   wocky_node_set_attribute (url_node, "name", "source-path");
diff --git a/src/jingle-transport-google.c b/src/jingle-transport-google.c
index 491036d..1e6d888 100644
--- a/src/jingle-transport-google.c
+++ b/src/jingle-transport-google.c
@@ -434,7 +434,7 @@ transmit_candidates (GabbleJingleTransportGoogle *transport,
           g_assert_not_reached ();
       }
 
-      cnode = wocky_node_add_child_with_content (trans_node, "candidate", NULL);
+      cnode = wocky_node_add_child (trans_node, "candidate");
       wocky_node_set_attributes (cnode,
           "address", c->address,
           "port", port_str,
diff --git a/src/jingle-transport-iceudp.c b/src/jingle-transport-iceudp.c
index cd7f3a1..e7eb41f 100644
--- a/src/jingle-transport-iceudp.c
+++ b/src/jingle-transport-iceudp.c
@@ -479,7 +479,7 @@ inject_candidates (GabbleJingleTransportIface *obj,
           "pwd", c->password,
           NULL);
 
-      cnode = wocky_node_add_child_with_content (transport_node, "candidate", NULL);
+      cnode = wocky_node_add_child (transport_node, "candidate");
       wocky_node_set_attributes (cnode,
           "ip", c->address,
           "port", port_str,
diff --git a/src/jingle-transport-rawudp.c b/src/jingle-transport-rawudp.c
index 17b1b1f..711cc68 100644
--- a/src/jingle-transport-rawudp.c
+++ b/src/jingle-transport-rawudp.c
@@ -310,7 +310,7 @@ inject_candidates (GabbleJingleTransportIface *obj,
       sprintf (port_str, "%d", c->port);
       sprintf (comp_str, "%d", c->component);
 
-      cnode = wocky_node_add_child_with_content (transport_node, "candidate", NULL);
+      cnode = wocky_node_add_child (transport_node, "candidate");
       wocky_node_set_attributes (cnode,
           "ip", c->address,
           "port", port_str,
diff --git a/src/muc-channel.c b/src/muc-channel.c
index c93c262..a685b07 100644
--- a/src/muc-channel.c
+++ b/src/muc-channel.c
@@ -3312,7 +3312,7 @@ gabble_muc_channel_send_invite (GabbleMucChannel *self,
 
   if (continue_)
     {
-      wocky_node_add_child_with_content (invite_node, "continue", NULL);
+      wocky_node_add_child (invite_node, "continue");
     }
 
   DEBUG ("sending MUC invitation for room %s to contact %s with reason "
diff --git a/src/search-channel.c b/src/search-channel.c
index 8ce5edf..0c253ba 100644
--- a/src/search-channel.c
+++ b/src/search-channel.c
@@ -885,7 +885,7 @@ build_extended_query (GabbleSearchChannel *self,
   wocky_node_set_attribute (x, "type", "submit");
 
   /* add FORM_TYPE */
-  field = wocky_node_add_child_with_content (x, "field", "");
+  field = wocky_node_add_child (x, "field");
   wocky_node_set_attributes (field,
       "type", "hidden",
       "var", "FORM_TYPE",
@@ -902,7 +902,7 @@ build_extended_query (GabbleSearchChannel *self,
 
       g_assert (xmpp_field != NULL);
 
-      field = wocky_node_add_child_with_content (x, "field", "");
+      field = wocky_node_add_child (x, "field");
       wocky_node_set_attribute (field, "var", xmpp_field);
       wocky_node_add_child_with_content (field, "value", value);
 
@@ -915,7 +915,7 @@ build_extended_query (GabbleSearchChannel *self,
             {
               xmpp_field = g_ptr_array_index (self->priv->boolean_keys, i);
 
-              field = wocky_node_add_child_with_content (x, "field", "");
+              field = wocky_node_add_child (x, "field");
               wocky_node_set_attributes (field,
                   "var", xmpp_field,
                   "type", "boolean",
diff --git a/src/util.c b/src/util.c
index 9b70860..099f7d8 100644
--- a/src/util.c
+++ b/src/util.c
@@ -502,7 +502,7 @@ set_child_from_property (gpointer key,
       return;
     }
 
-  child = wocky_node_add_child_with_content (data->node, data->prop, "");
+  child = wocky_node_add_child (data->node, data->prop);
 
   if (G_VALUE_TYPE (gvalue) == G_TYPE_STRING)
     {



More information about the telepathy-commits mailing list