From f5aef603cce6a9c34f007807106ec2cbd47b4254 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 21 May 2014 10:52:21 +0200 Subject: [PATCH 6/9] ensure that class pointers aren't NULL Make clang happier and is safer anyway. https://bugs.freedesktop.org/show_bug.cgi?id=79006 --- telepathy-glib/base-client.c | 9 +++++++++ telepathy-glib/base-connection.c | 3 +++ telepathy-glib/dbus.c | 1 + 3 files changed, 13 insertions(+) diff --git a/telepathy-glib/base-client.c b/telepathy-glib/base-client.c index e975b0a..cb717ca 100644 --- a/telepathy-glib/base-client.c +++ b/telepathy-glib/base-client.c @@ -415,6 +415,7 @@ tp_base_client_add_observer_filter_variant (TpBaseClient *self, TpBaseClientClass *cls = TP_BASE_CLIENT_GET_CLASS (self); g_return_if_fail (TP_IS_BASE_CLIENT (self)); + g_return_if_fail (cls != NULL); g_return_if_fail (!self->priv->registered); g_return_if_fail (cls->observe_channel != NULL); g_return_if_fail (g_variant_is_of_type (filter, G_VARIANT_TYPE_VARDICT)); @@ -456,6 +457,7 @@ tp_base_client_set_observer_recover (TpBaseClient *self, TpBaseClientClass *cls = TP_BASE_CLIENT_GET_CLASS (self); g_return_if_fail (TP_IS_BASE_CLIENT (self)); + g_return_if_fail (cls != NULL); g_return_if_fail (!self->priv->registered); g_return_if_fail (cls->observe_channel != NULL); @@ -496,6 +498,7 @@ tp_base_client_set_observer_delay_approvers (TpBaseClient *self, TpBaseClientClass *cls = TP_BASE_CLIENT_GET_CLASS (self); g_return_if_fail (TP_IS_BASE_CLIENT (self)); + g_return_if_fail (cls != NULL); g_return_if_fail (!self->priv->registered); g_return_if_fail (cls->observe_channel != NULL); @@ -589,6 +592,7 @@ tp_base_client_add_approver_filter_variant (TpBaseClient *self, TpBaseClientClass *cls = TP_BASE_CLIENT_GET_CLASS (self); g_return_if_fail (TP_IS_BASE_CLIENT (self)); + g_return_if_fail (cls != NULL); g_return_if_fail (!self->priv->registered); g_return_if_fail (cls->add_dispatch_operation != NULL); g_return_if_fail (g_variant_is_of_type (filter, G_VARIANT_TYPE_VARDICT)); @@ -619,6 +623,7 @@ tp_base_client_be_a_handler (TpBaseClient *self) TpBaseClientClass *cls = TP_BASE_CLIENT_GET_CLASS (self); g_return_if_fail (TP_IS_BASE_CLIENT (self)); + g_return_if_fail (cls != NULL); g_return_if_fail (!self->priv->registered); g_return_if_fail (cls->handle_channel != NULL); @@ -679,6 +684,7 @@ tp_base_client_add_handler_filter_variant (TpBaseClient *self, TpBaseClientClass *cls = TP_BASE_CLIENT_GET_CLASS (self); g_return_if_fail (TP_IS_BASE_CLIENT (self)); + g_return_if_fail (cls != NULL); g_return_if_fail (!self->priv->registered); g_return_if_fail (cls->handle_channel != NULL); g_return_if_fail (g_variant_is_of_type (filter, G_VARIANT_TYPE_VARDICT)); @@ -736,6 +742,7 @@ tp_base_client_set_handler_bypass_approval (TpBaseClient *self, TpBaseClientClass *cls = TP_BASE_CLIENT_GET_CLASS (self); g_return_if_fail (TP_IS_BASE_CLIENT (self)); + g_return_if_fail (cls != NULL); g_return_if_fail (!self->priv->registered); g_return_if_fail (cls->handle_channel != NULL); @@ -773,6 +780,7 @@ tp_base_client_set_handler_request_notification (TpBaseClient *self) TpBaseClientClass *cls = TP_BASE_CLIENT_GET_CLASS (self); g_return_if_fail (TP_IS_BASE_CLIENT (self)); + g_return_if_fail (cls != NULL); g_return_if_fail (!self->priv->registered); g_return_if_fail (cls->handle_channel != NULL); @@ -819,6 +827,7 @@ tp_base_client_add_handler_capability (TpBaseClient *self, TpBaseClientClass *cls = TP_BASE_CLIENT_GET_CLASS (self); g_return_if_fail (TP_IS_BASE_CLIENT (self)); + g_return_if_fail (cls != NULL); g_return_if_fail (!self->priv->registered); g_return_if_fail (cls->handle_channel != NULL); diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c index 1ed86eb..00e91bd 100644 --- a/telepathy-glib/base-connection.c +++ b/telepathy-glib/base-connection.c @@ -1263,6 +1263,7 @@ tp_base_connection_register (TpBaseConnection *self, guint prefix_length; const guint dbus_max_name_length = 255; + g_return_val_if_fail (cls != NULL, FALSE); g_return_val_if_fail (TP_IS_BASE_CONNECTION (self), FALSE); g_return_val_if_fail (cm_name != NULL, FALSE); g_return_val_if_fail (!self->priv->been_registered, FALSE); @@ -1421,6 +1422,7 @@ tp_base_connection_connect (_TpGDBusConnection *skeleton, GError *error = NULL; g_assert (TP_IS_BASE_CONNECTION (self)); + g_assert (cls != NULL); if (self->priv->status == TP_INTERNAL_CONNECTION_STATUS_NEW) { @@ -2739,6 +2741,7 @@ tp_base_connection_dup_contact_attributes (TpBaseConnection *self, guint i; g_return_val_if_fail (TP_IS_BASE_CONNECTION (self), NULL); + g_return_val_if_fail (klass != NULL, NULL); g_return_val_if_fail (tp_base_connection_check_connected (self, NULL), NULL); g_return_val_if_fail (klass->fill_contact_attributes != NULL, NULL); diff --git a/telepathy-glib/dbus.c b/telepathy-glib/dbus.c index 4bc2c59..552e0fd 100644 --- a/telepathy-glib/dbus.c +++ b/telepathy-glib/dbus.c @@ -807,6 +807,7 @@ _tp_dbus_connection_gather_gdbus_skeletons (GDBusObject *object, GDBusInterface *iface = list_iter->data; const gchar *iface_name = g_dbus_interface_get_info (iface)->name; + g_assert (iface != NULL); if (!G_IS_DBUS_INTERFACE_SKELETON (iface)) { DEBUG ("- not a GDBusInterfaceSkeleton: %s %p", -- 1.9.0