[Telepathy-commits] [telepathy-glib/master] Use g_strv_length to count the ContactAttributeInterfaces

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Oct 7 06:38:01 PDT 2008


---
 telepathy-glib/connection.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index d6c7360..b5348d1 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -232,17 +232,11 @@ got_contact_attribute_interfaces (TpProxy *proxy,
       if (G_VALUE_HOLDS (value, G_TYPE_STRV))
         {
           GArray *arr;
-          guint i = 0;
           gchar **interfaces = g_value_get_boxed (value);
           gchar **iter;
 
-          if (interfaces != NULL)
-            {
-              for (iter = interfaces; *iter != NULL; iter++)
-                i++;
-            }
-
-          arr = g_array_sized_new (FALSE, FALSE, sizeof (GQuark), i);
+          arr = g_array_sized_new (FALSE, FALSE, sizeof (GQuark),
+              interfaces == NULL ? 0 : g_strv_length (interfaces));
 
           if (interfaces != NULL)
             {
-- 
1.5.6.5




More information about the Telepathy-commits mailing list