[telepathy-mission-control/master] libmcclient: _mc_iface_update_props: remove unused parameters

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Jun 2 09:21:01 PDT 2009


This function is always called with iface_name = NULL and
iface_name_len = 0, in practice, so we can get rid of them. In the
process, delete some strcpy()ing that makes coverity complain.
---
 libmcclient/dbus-api.c         |   28 ++++------------------------
 libmcclient/dbus-api.h         |    3 +--
 libmcclient/mc-account-stats.c |    4 ++--
 libmcclient/mc-account.c       |    4 ++--
 4 files changed, 9 insertions(+), 30 deletions(-)

diff --git a/libmcclient/dbus-api.c b/libmcclient/dbus-api.c
index f9a9a8c..b3e0daa 100644
--- a/libmcclient/dbus-api.c
+++ b/libmcclient/dbus-api.c
@@ -32,10 +32,6 @@
 #include "_gen/gtypes-body.h"
 #include "_gen/interfaces-body.h"
 
-/* interface + dot + property name + zero terminator */
-#define MC_QUALIFIED_PROPERTY_NAME_LEN \
-    (DBUS_MAXIMUM_NAME_LENGTH + 1 + DBUS_MAXIMUM_NAME_LENGTH + 1)
-
 #define MC_IFACE_IS_READY(iface_data) (*(iface_data->props_data_ptr) != NULL)
 
 typedef struct _McIfaceStatus McIfaceStatus;
@@ -391,37 +387,21 @@ _mc_gtype_from_dbus_signature (const gchar *signature)
 
 void
 _mc_iface_update_props (const McIfaceProperty *props_definition,
-                        GHashTable *properties, gpointer proxy_props,
-                        const gchar *iface_name, gsize iface_name_len)
+                        GHashTable *properties, gpointer proxy_props)
 {
     const McIfaceProperty *prop;
-    gchar qualified_name[MC_QUALIFIED_PROPERTY_NAME_LEN], *name_ptr = NULL;
-
-    if (iface_name)
-    {
-        g_return_if_fail (iface_name_len <= DBUS_MAXIMUM_NAME_LENGTH);
-        strcpy (qualified_name, iface_name);
-        name_ptr = qualified_name + iface_name_len;
-        *name_ptr = '.';
-        name_ptr++;
-    }
 
     for (prop = props_definition; prop->name != NULL; prop++)
     {
         GValue *value;
         GType type;
 
-        g_return_if_fail (strlen (prop->name) <= DBUS_MAXIMUM_NAME_LENGTH);
-        if (name_ptr)
-        {
-            strcpy (name_ptr, prop->name);
-            value = g_hash_table_lookup (properties, qualified_name);
-        }
-        else
-            value = g_hash_table_lookup (properties, prop->name);
+        value = g_hash_table_lookup (properties, prop->name);
+
         if (!value) continue;
 
         type = _mc_gtype_from_dbus_signature (prop->dbus_signature);
+
         if (G_LIKELY (G_VALUE_HOLDS (value, type)))
         {
             prop->update_property (prop->name, value, proxy_props);
diff --git a/libmcclient/dbus-api.h b/libmcclient/dbus-api.h
index 93a27d2..79173fb 100644
--- a/libmcclient/dbus-api.h
+++ b/libmcclient/dbus-api.h
@@ -132,7 +132,6 @@ gboolean _mc_iface_is_ready (gpointer object, GQuark iface);
 GType _mc_gtype_from_dbus_signature (const gchar *signature);
 
 void _mc_iface_update_props (const McIfaceProperty *props_definition,
-                             GHashTable *properties, gpointer proxy_props,
-                             const gchar *iface_name, gsize iface_name_len);
+                             GHashTable *properties, gpointer proxy_props);
 
 #endif
diff --git a/libmcclient/mc-account-stats.c b/libmcclient/mc-account-stats.c
index 67d92ce..29b751c 100644
--- a/libmcclient/mc-account-stats.c
+++ b/libmcclient/mc-account-stats.c
@@ -122,7 +122,7 @@ create_props (TpProxy *proxy, GHashTable *props)
     McAccountPrivate *priv = account->priv;
 
     priv->stats_props = g_slice_new0 (McAccountStatsProps);
-    _mc_iface_update_props (account_stats_properties, props, account, NULL, 0);
+    _mc_iface_update_props (account_stats_properties, props, account);
 }
 
 static void
@@ -136,7 +136,7 @@ on_stats_changed (TpProxy *proxy, GHashTable *properties, gpointer user_data,
     if (G_UNLIKELY (!priv->stats_props)) return;
 
     _mc_iface_update_props (account_stats_properties, properties,
-                            account, NULL, 0);
+                            account);
 }
 
 static void
diff --git a/libmcclient/mc-account.c b/libmcclient/mc-account.c
index 5ae78a8..0f17881 100644
--- a/libmcclient/mc-account.c
+++ b/libmcclient/mc-account.c
@@ -636,7 +636,7 @@ create_props (TpProxy *proxy, GHashTable *props)
     McAccountPrivate *priv = account->priv;
 
     priv->props = g_malloc0 (sizeof (McAccountProps));
-    _mc_iface_update_props (account_properties, props, account, NULL, 0);
+    _mc_iface_update_props (account_properties, props, account);
     priv->props->emit_changed = TRUE;
 }
 
@@ -650,7 +650,7 @@ on_account_property_changed (TpProxy *proxy, GHashTable *props,
     /* if the GetAll method hasn't returned yet, we do nothing */
     if (G_UNLIKELY (!priv->props)) return;
 
-    _mc_iface_update_props (account_properties, props, account, NULL, 0);
+    _mc_iface_update_props (account_properties, props, account);
     if (priv->props->emit_connection_status_changed)
     {
 	g_signal_emit (account,
-- 
1.5.6.5




More information about the telepathy-commits mailing list