allow to give -1 for undefined length in lookups first round of work on
* dict.c: allow to give -1 for undefined length in lookups
* include/libxml/parser.h parser.c parserInternals.c testSAX.c:
first round of work on the new SAX2 interfaces, the API
will change but commiting before changing for historical
reference.
Daniel
diff --git a/dict.c b/dict.c
index 2dd759d..aa29976 100644
--- a/dict.c
+++ b/dict.c
@@ -256,7 +256,7 @@
* xmlDictLookup:
* @dict: the dictionnary
* @name: the name of the userdata
- * @len: the length of the name
+ * @len: the length of the name, if -1 it is recomputed
*
* Add the @name to the hash @dict if not present.
*
@@ -269,7 +269,12 @@
xmlDictEntryPtr insert;
const xmlChar *ret;
- if ((dict == NULL) || (name == NULL) || (len <= 0))
+ if ((dict == NULL) || (name == NULL))
+ return(NULL);
+
+ if (len < 0)
+ len = xmlStrlen(name);
+ if (len <= 0)
return(NULL);
/*