diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2009-08-16 18:13:23 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2009-08-16 18:13:23 +0100 |
commit | 78f37b8630897d69c304c1e3c9451f8888cd5ac6 (patch) | |
tree | 6c6962ed497afd02e4b184674c9340c4f873ffb8 /telepathy-glib | |
parent | 524350c8c032fc86a573f53e39cf6bc27eb6fde1 (diff) | |
download | telepathy-glib-78f37b8630897d69c304c1e3c9451f8888cd5ac6.tar.gz |
TpDBusDaemon: factor out _tp_dbus_daemon_stop_watching
Diffstat (limited to 'telepathy-glib')
-rw-r--r-- | telepathy-glib/dbus.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/telepathy-glib/dbus.c b/telepathy-glib/dbus.c index 4ca19471b..e36fea9e7 100644 --- a/telepathy-glib/dbus.c +++ b/telepathy-glib/dbus.c @@ -887,6 +887,18 @@ tp_dbus_daemon_watch_name_owner (TpDBusDaemon *self, } } +static void +_tp_dbus_daemon_stop_watching (TpDBusDaemon *self, + const gchar *name, + _NameOwnerWatch *watch) +{ + if (watch->destroy) + watch->destroy (watch->user_data); + + g_free (watch->last_owner); + g_slice_free (_NameOwnerWatch, watch); +} + /** * tp_dbus_daemon_cancel_name_owner_watch: * @self: the D-Bus daemon @@ -925,11 +937,7 @@ tp_dbus_daemon_cancel_name_owner_watch (TpDBusDaemon *self, else if (watch->callback == callback && watch->user_data == user_data) { /* Simple case: there is one name-owner watch and it's what we wanted */ - if (watch->destroy) - watch->destroy (watch->user_data); - - g_free (watch->last_owner); - g_slice_free (_NameOwnerWatch, watch); + _tp_dbus_daemon_stop_watching (self, name, watch); g_hash_table_remove (self->priv->name_owner_watches, name); return TRUE; } @@ -954,9 +962,7 @@ tp_dbus_daemon_cancel_name_owner_watch (TpDBusDaemon *self, if (array->len == 0) { - watch->destroy (watch->user_data); - g_free (watch->last_owner); - g_slice_free (_NameOwnerWatch, watch); + _tp_dbus_daemon_stop_watching (self, name, watch); g_hash_table_remove (self->priv->name_owner_watches, name); } |