[Telepathy-commits] [telepathy-glib/master] DBusPropertiesMixin: move mixin->interfaces != NULL checks out of loops

Will Thompson will.thompson at collabora.co.uk
Tue Sep 9 09:51:25 PDT 2008


---
 telepathy-glib/dbus-properties-mixin.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/telepathy-glib/dbus-properties-mixin.c b/telepathy-glib/dbus-properties-mixin.c
index 4394c72..8a9b235 100644
--- a/telepathy-glib/dbus-properties-mixin.c
+++ b/telepathy-glib/dbus-properties-mixin.c
@@ -481,10 +481,10 @@ tp_dbus_properties_mixin_implement_interface (GObjectClass *cls,
 
       /* assert that we're not trying to implement the same interface via
        * this function and the static data */
-      if (mixin != NULL)
+      if (mixin != NULL && mixin->interfaces != NULL)
         {
           for (iter = mixin->interfaces;
-               iter != NULL && iter->name != NULL;
+               iter->name != NULL;
                iter++)
             {
               TpDBusPropertiesMixinIfaceInfo *other_info = iter->mixin_priv;
@@ -565,10 +565,13 @@ tp_dbus_properties_mixin_class_init (GObjectClass *cls,
 
   mixin = &G_STRUCT_MEMBER (TpDBusPropertiesMixinClass, cls, offset);
 
+  if (mixin->interfaces == NULL)
+    return;
+
   interfaces = g_type_interfaces (type, NULL);
 
   for (iface_impl = mixin->interfaces;
-       iface_impl != NULL && iface_impl->name != NULL;
+       iface_impl->name != NULL;
        iface_impl++)
     {
       GQuark iface_quark = g_quark_try_string (iface_impl->name);
@@ -619,17 +622,18 @@ _tp_dbus_properties_mixin_find_iface_impl (GObject *self,
        type = g_type_parent (type))
     {
       gpointer offset = g_type_get_qdata (type, offset_quark);
-      TpDBusPropertiesMixinClass *mixin;
+      TpDBusPropertiesMixinClass *mixin = NULL;
       TpDBusPropertiesMixinIfaceImpl *iface_impl;
       TpDBusPropertiesMixinIfaceInfo *iface_info;
 
       if (offset != NULL)
-        {
-          mixin = &G_STRUCT_MEMBER (TpDBusPropertiesMixinClass,
-              G_OBJECT_GET_CLASS (self), GPOINTER_TO_SIZE (offset));
+        mixin = &G_STRUCT_MEMBER (TpDBusPropertiesMixinClass,
+            G_OBJECT_GET_CLASS (self), GPOINTER_TO_SIZE (offset));
 
+      if (mixin != NULL && mixin->interfaces != NULL)
+        {
           for (iface_impl = mixin->interfaces;
-               iface_impl != NULL && iface_impl->name != NULL;
+               iface_impl->name != NULL;
                iface_impl++)
             {
               iface_info = iface_impl->mixin_priv;
-- 
1.5.6.3




More information about the Telepathy-commits mailing list