diff options
-rw-r--r-- | rest/rest-xml-parser.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/rest/rest-xml-parser.c b/rest/rest-xml-parser.c index 690d757..49b49b4 100644 --- a/rest/rest-xml-parser.c +++ b/rest/rest-xml-parser.c @@ -20,6 +20,7 @@ * */ +#include <string.h> #include <libxml/xmlreader.h> #include "rest-private.h" @@ -56,7 +57,7 @@ rest_xml_parser_new (void) * rest_xml_parser_parse_from_data: * @parser: a #RestXmlParser * @data: the XML content to parse - * @len: the length of @data + * @len: the length of @data, or -1 if @data is a nul-terminated string * * Parse the XML in @data, and return a new #RestXmlNode. If @data is invalid * XML, %NULL is returned. @@ -82,6 +83,9 @@ rest_xml_parser_parse_from_data (RestXmlParser *parser, g_return_val_if_fail (REST_IS_XML_PARSER (parser), NULL); + if (len == -1) + len = strlen (data); + _rest_setup_debugging (); reader = xmlReaderForMemory (data, |