From: RĂ©mi Denis-Courmont Date: Tue, 27 Jul 2010 20:01:35 +0000 (+0300) Subject: Improve xml_ReaderReset() X-Git-Tag: 1.2.0-pre1~5651 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=70faefb1b693e96c1bfd68643880b6f278a2b2bf;p=vlc Improve xml_ReaderReset() --- diff --git a/src/misc/xml.c b/src/misc/xml.c index a76e4c37f8..6e23522e9e 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;