summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2013-04-14 19:27:27 +0200
committerJens Georg <mail@jensge.org>2013-05-30 10:35:59 +0200
commit3e820dcd0c7ba39dabf44e9e9448d2c02eede6db (patch)
treef6f9191b3047f7eb6cfb81bef4b14b93d328de9a
parente1c1252e7647778f0ed7c38547950255cfe68d44 (diff)
downloadgupnp-av-3e820dcd0c7ba39dabf44e9e9448d2c02eede6db.tar.gz
Only split protocol info once
https://bugzilla.gnome.org/show_bug.cgi?id=698008
-rw-r--r--libgupnp-av/gupnp-didl-lite-object.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/libgupnp-av/gupnp-didl-lite-object.c b/libgupnp-av/gupnp-didl-lite-object.c
index 5e527bc..35a55fd 100644
--- a/libgupnp-av/gupnp-didl-lite-object.c
+++ b/libgupnp-av/gupnp-didl-lite-object.c
@@ -790,13 +790,10 @@ gupnp_didl_lite_object_class_init (GUPnPDIDLLiteObjectClass *klass)
static gboolean
is_resource_compatible (GUPnPDIDLLiteResource *resource,
- const char *sink_protocol_info)
+ char **protocols)
{
gboolean ret = FALSE;
- char **protocols, **it;
-
- protocols = g_strsplit (sink_protocol_info, ",", 0);
-
+ char **it;
for (it = protocols; *it != NULL && !ret; it++) {
GUPnPProtocolInfo *info;
@@ -813,8 +810,6 @@ is_resource_compatible (GUPnPDIDLLiteResource *resource,
g_object_unref (info);
}
- g_strfreev (protocols);
-
return ret;
}
@@ -1557,6 +1552,7 @@ gupnp_didl_lite_object_get_compat_resource
GList *resources = NULL;
GList *compat_resources = NULL;
GList *res;
+ char **protocols = NULL;
g_return_val_if_fail (GUPNP_IS_DIDL_LITE_OBJECT (object), NULL);
g_return_val_if_fail (sink_protocol_info != NULL, NULL);
@@ -1565,15 +1561,18 @@ gupnp_didl_lite_object_get_compat_resource
if (resources == NULL)
return NULL;
+ protocols = g_strsplit (sink_protocol_info, ",", -1);
for (res = resources;
res != NULL;
res = res->next) {
resource = (GUPnPDIDLLiteResource *) res->data;
- if (is_resource_compatible (resource, sink_protocol_info))
+ if (is_resource_compatible (resource, protocols))
compat_resources = g_list_append (compat_resources,
resource);
}
+ g_strfreev (protocols);
+ protocols = NULL;
resource = NULL;