diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2012-07-05 15:56:12 +0100 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2012-07-05 15:56:53 +0100 |
commit | 05ea1395d99b67e8569dd6e50ec99b782b72ea08 (patch) | |
tree | 92303aa76a8266a1492edc3395166574ffcf65c2 | |
parent | 6b037b43df5104636f58ab0a3e10c075012feee5 (diff) | |
download | telepathy-glib-05ea1395d99b67e8569dd6e50ec99b782b72ea08.tar.gz |
base-connection: simplify add_interfaces
Calling set_size on the GArray is a little overkill.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r-- | telepathy-glib/base-connection.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c index 9bacd7f8d..1983e94be 100644 --- a/telepathy-glib/base-connection.c +++ b/telepathy-glib/base-connection.c @@ -3193,28 +3193,14 @@ void tp_base_connection_add_interfaces (TpBaseConnection *self, const gchar **interfaces) { - guint i, n_new, size; TpBaseConnectionPrivate *priv = self->priv; g_return_if_fail (TP_IS_BASE_CONNECTION (self)); g_return_if_fail (self->status != TP_CONNECTION_STATUS_CONNECTED); g_return_if_fail (self->status != TP_CONNECTION_STATUS_DISCONNECTED); - if (interfaces == NULL || interfaces[0] == NULL) - { - /* If user tries to add no new interfaces, ignore it */ - return; - } - - n_new = g_strv_length ((gchar **) interfaces); - size = priv->interfaces->len; - - g_array_set_size (priv->interfaces, size + n_new); - for (i = 0; i < n_new; i++) - { - g_array_index (priv->interfaces, const gchar *, size + i) = - interfaces[i]; - } + for (; interfaces != NULL && *interfaces != NULL; interfaces++) + g_array_append_val (priv->interfaces, *interfaces); } static void |