[vlc-commits] commit: Improve xml_ReaderReset() ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Tue Jul 27 22:02:26 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jul 27 23:01:35 2010 +0300| [70faefb1b693e96c1bfd68643880b6f278a2b2bf] | committer: Rémi Denis-Courmont 

Improve xml_ReaderReset()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=70faefb1b693e96c1bfd68643880b6f278a2b2bf
---

 src/misc/xml.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/misc/xml.c b/src/misc/xml.c
index a76e4c3..6e23522 100644
--- a/src/misc/xml.c
+++ b/src/misc/xml.c
@@ -107,17 +107,21 @@ void xml_ReaderDelete(xml_reader_t *reader)
  * Resets an existing XML reader.
  * If you need to parse several XML files, this function is much faster than
  * xml_ReaderCreate() and xml_ReaderDelete() combined.
+ * If the stream parameter is NULL, the XML reader will be stopped, but
+ * not restarted until the next xml_ReaderReset() call with a non-NULL stream.
+ *
  * @param reader XML reader to reinitialize
- * @param stream new stream to read XML data from
- * @return reader on success, NULL on error (in that case, the reader is
- * destroyed).
+ * @param stream new stream to read XML data from (or NULL)
+ * @return reader on success,
+ *         NULL on error (in that case, the reader is destroyed).
  */
 xml_reader_t *xml_ReaderReset(xml_reader_t *reader, stream_t *stream)
 {
-    module_stop(reader, reader->p_module);
+    if (reader->p_stream)
+        module_stop(reader, reader->p_module);
 
     reader->p_stream = stream;
-    if (module_start(reader, reader->p_module))
+    if ((stream != NULL) && module_start(reader, reader->p_module))
     {
         vlc_object_release(reader);
         return NULL;



More information about the vlc-commits mailing list