From f16295ac56ad5652875588b9b513a5ab326ef4cf Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 18 Mar 2010 14:19:45 +0100 Subject: private-tubes-factory: factor out copy_caps --- src/private-tubes-factory.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/private-tubes-factory.c b/src/private-tubes-factory.c index 1607fae7c..e6a368e49 100644 --- a/src/private-tubes-factory.c +++ b/src/private-tubes-factory.c @@ -717,23 +717,29 @@ gabble_private_tubes_factory_free_caps ( g_free (caps); } +static Feature * +copy_caps (Feature *feat) +{ + Feature *copy; + + if (feat == NULL) + return NULL; + + copy = g_new0 (Feature, 1); + copy->feature_type = feat->feature_type; + copy->ns = g_strdup (feat->ns); + copy->caps = feat->caps; + return copy; +} + static void copy_caps_helper (gpointer key, gpointer value, gpointer user_data) { GHashTable *out = user_data; gchar *str = key; Feature *feat = value; - Feature *copy = NULL; - - if (value != NULL) - { - copy = g_new0 (Feature, 1); - copy->feature_type = feat->feature_type; - copy->ns = g_strdup (feat->ns); - copy->caps = feat->caps; - } - g_hash_table_insert (out, g_strdup (str), copy); + g_hash_table_insert (out, g_strdup (str), copy_caps (feat)); } static void -- cgit v1.2.3