From f85ce8e334f448078a3d71a812824fa5b45d9b07 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Mon, 22 Sep 2003 10:24:45 +0000 Subject: [PATCH] the uri arg to xmlNodeSetBase is really a const xmlChar* addin the * tree.c include/libxml/tree.h: the uri arg to xmlNodeSetBase is really a const xmlChar* * xmlreader.c include/libxml/xmlreader.h: addin the xmlTextReaderConstString() to get an interned string from the reader Daniel --- ChangeLog | 8 ++++++++ include/libxml/tree.h | 2 +- include/libxml/xmlreader.h | 4 ++++ tree.c | 2 +- xmlreader.c | 18 ++++++++++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 70da84b8..112c0f40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mon Sep 22 12:21:11 CEST 2003 Daniel Veillard + + * tree.c include/libxml/tree.h: the uri arg to xmlNodeSetBase is + really a const xmlChar* + * xmlreader.c include/libxml/xmlreader.h: addin the + xmlTextReaderConstString() to get an interned string from + the reader + Sun Sep 20 17:22:20 PDT 2003 William Brack * error.c: fixed a warning message (trivial) diff --git a/include/libxml/tree.h b/include/libxml/tree.h index 5ead191a..686364fa 100644 --- a/include/libxml/tree.h +++ b/include/libxml/tree.h @@ -926,7 +926,7 @@ XMLPUBFUN xmlChar * XMLCALL xmlNodePtr cur); XMLPUBFUN void XMLCALL xmlNodeSetBase (xmlNodePtr cur, - xmlChar *uri); + const xmlChar *uri); /* * Removing content. diff --git a/include/libxml/xmlreader.h b/include/libxml/xmlreader.h index c8af21a2..139b1deb 100644 --- a/include/libxml/xmlreader.h +++ b/include/libxml/xmlreader.h @@ -131,6 +131,10 @@ XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstPrefix (xmlTextReaderPtr reader); XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstString (xmlTextReaderPtr reader, + const xmlChar *str); + /* * Methods of the XmlTextReader */ diff --git a/tree.c b/tree.c index a65fda8c..8fc7e854 100644 --- a/tree.c +++ b/tree.c @@ -4550,7 +4550,7 @@ xmlNodeSetName(xmlNodePtr cur, const xmlChar *name) { * xml:base attribute. */ void -xmlNodeSetBase(xmlNodePtr cur, xmlChar* uri) { +xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri) { xmlNsPtr ns; if (cur == NULL) return; diff --git a/xmlreader.c b/xmlreader.c index 6c52e1f3..8109cf88 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -2991,6 +2991,24 @@ xmlTextReaderConstXmlLang(xmlTextReaderPtr reader) { return(ret); } +/** + * xmlTextReaderConstString: + * @reader: the xmlTextReaderPtr used + * @str: the string to intern. + * + * Get an interned string from the reader, allows for example to + * speedup string name comparisons + * + * Returns an interned copy of the string or NULL in case of error. The + * string will be deallocated with the reader. + */ +const xmlChar * +xmlTextReaderConstString(xmlTextReaderPtr reader, const xmlChar *str) { + if (reader == NULL) + return(NULL); + return(CONSTSTR(str)); +} + /** * xmlTextReaderNormalization: * @reader: the xmlTextReaderPtr used