Commit 70faefb1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Improve xml_ReaderReset()

parent 15172e68
...@@ -107,17 +107,21 @@ void xml_ReaderDelete(xml_reader_t *reader) ...@@ -107,17 +107,21 @@ void xml_ReaderDelete(xml_reader_t *reader)
* Resets an existing XML reader. * Resets an existing XML reader.
* If you need to parse several XML files, this function is much faster than * If you need to parse several XML files, this function is much faster than
* xml_ReaderCreate() and xml_ReaderDelete() combined. * 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 reader XML reader to reinitialize
* @param stream new stream to read XML data from * @param stream new stream to read XML data from (or NULL)
* @return reader on success, NULL on error (in that case, the reader is * @return reader on success,
* destroyed). * NULL on error (in that case, the reader is destroyed).
*/ */
xml_reader_t *xml_ReaderReset(xml_reader_t *reader, stream_t *stream) xml_reader_t *xml_ReaderReset(xml_reader_t *reader, stream_t *stream)
{ {
if (reader->p_stream)
module_stop(reader, reader->p_module); module_stop(reader, reader->p_module);
reader->p_stream = stream; reader->p_stream = stream;
if (module_start(reader, reader->p_module)) if ((stream != NULL) && module_start(reader, reader->p_module))
{ {
vlc_object_release(reader); vlc_object_release(reader);
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment