[gupnp-av/wip/didl-lite-fragments] Make didl-lite xsd global.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-av/wip/didl-lite-fragments] Make didl-lite xsd global.
- Date: Wed, 24 Oct 2012 13:18:58 +0000 (UTC)
commit 75e4bc328cf8c20cbab8868a67abde70d510d93b
Author: Krzesimir Nowak <krnowak openismus com>
Date: Wed Oct 24 15:16:07 2012 +0200
Make didl-lite xsd global.
Loading it everytime we want to apply a list of fragments is superslow
and wasteful.
libgupnp-av/gupnp-didl-lite-object.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/libgupnp-av/gupnp-didl-lite-object.c b/libgupnp-av/gupnp-didl-lite-object.c
index aaf1840..bea33df 100644
--- a/libgupnp-av/gupnp-didl-lite-object.c
+++ b/libgupnp-av/gupnp-didl-lite-object.c
@@ -56,6 +56,8 @@ struct _GUPnPDIDLLiteObjectPrivate {
xmlNs *dlna_ns;
};
+static XSDData *didl_lite_xsd;
+
enum {
PROP_0,
PROP_XML_NODE,
@@ -784,6 +786,9 @@ gupnp_didl_lite_object_class_init (GUPnPDIDLLiteObjectClass *klass)
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK |
G_PARAM_STATIC_BLURB));
+
+ if (didl_lite_xsd == NULL)
+ didl_lite_xsd = fragment_util_get_didl_lite_xsd_data ();
}
static gboolean
@@ -2167,7 +2172,6 @@ gupnp_didl_lite_object_apply_fragments (GUPnPDIDLLiteObject *object,
DocNode modified;
DocNode original;
GUPnPDIDLLiteFragmentResult result;
- XSDData *xsd_data;
gint iter;
g_return_val_if_fail (GUPNP_IS_DIDL_LITE_OBJECT (object),
@@ -2177,11 +2181,6 @@ gupnp_didl_lite_object_apply_fragments (GUPnPDIDLLiteObject *object,
g_return_val_if_fail (new_fragments != NULL,
GUPNP_DIDL_LITE_FRAGMENT_RESULT_NEW_INVALID);
- xsd_data = fragment_util_get_didl_lite_xsd_data ();
-
- g_return_val_if_fail (xsd_data != NULL,
- GUPNP_DIDL_LITE_FRAGMENT_RESULT_UNKNOWN_ERROR);
-
result = GUPNP_DIDL_LITE_FRAGMENT_RESULT_OK;
modified.doc = NULL;
@@ -2229,7 +2228,7 @@ gupnp_didl_lite_object_apply_fragments (GUPnPDIDLLiteObject *object,
&modified,
current_fragment,
new_fragment,
- xsd_data);
+ didl_lite_xsd);
if (result != GUPNP_DIDL_LITE_FRAGMENT_RESULT_OK)
goto out;
@@ -2241,7 +2240,5 @@ gupnp_didl_lite_object_apply_fragments (GUPnPDIDLLiteObject *object,
out:
if (modified.doc != NULL)
xmlFreeDoc (modified.doc);
- xsd_data_free (xsd_data);
-
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]