[Telepathy-commits] [telepathy-glib/master] tp_base_connection_get_handles: use g_return_val_if_fail to check type

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Mar 3 06:27:39 PST 2009


Using G_TYPE_INSTANCE_GET_PRIVATE as an assertion about the argument's
type isn't as clear as it could be.
---
 telepathy-glib/base-connection.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c
index 194c6b4..bd0fdc4 100644
--- a/telepathy-glib/base-connection.c
+++ b/telepathy-glib/base-connection.c
@@ -2424,12 +2424,12 @@ TpHandleRepoIface *
 tp_base_connection_get_handles (TpBaseConnection *self,
                                 TpHandleType handle_type)
 {
-  TpBaseConnectionPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-      TP_TYPE_BASE_CONNECTION, TpBaseConnectionPrivate);
+  g_return_val_if_fail (TP_IS_BASE_CONNECTION (self), NULL);
 
   if (handle_type >= NUM_TP_HANDLE_TYPES)
     return NULL;
-  return priv->handles[handle_type];
+
+  return self->priv->handles[handle_type];
 }
 
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list