diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-18 14:19:45 +0100 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-18 14:19:45 +0100 |
commit | f16295ac56ad5652875588b9b513a5ab326ef4cf (patch) | |
tree | a32d90285054b12c4097852b31ee404317ae7292 | |
parent | f7a5af7452745c06e66f9078d7a52bb0f1dc77fb (diff) |
private-tubes-factory: factor out copy_caps
-rw-r--r-- | src/private-tubes-factory.c | 26 |
1 files 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 |