Re: [xml] Minor path for xmltree.c : xmlNodeSetName



On Thu, Jan 21, 2010 at 01:58:56PM +0100, Martin B. wrote:
While compiling an older version (2.6.27) and then re-checking with
the newest code, I found that there's a minor casting issue in
xmlNodeSetBase(..). It's purely cosmetic, but it cost me time trying
to figure out what's going on, so I though it probably should be
changed to use a const-correct local variable.

Patch vs. HEAD looks like this:
########################################
xmlNodeSetName: Remove const from declaration 'const xmlChar* fixed'
since it is used non-const anyway. Remove unnecessary cast on
xmlFree later on.
########################################
diff --git a/tree.c b/tree.c
index ffebf06..3b66f97 100644
--- a/tree.c
+++ b/tree.c
@@ -5056,7 +5056,7 @@ xmlNodeSetName(xmlNodePtr cur, const xmlChar *name) {
 void
 xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri) {
     xmlNsPtr ns;
-    const xmlChar* fixed;
+    xmlChar* fixed;

     if (cur == NULL) return;
     switch(cur->type) {
@@ -5103,7 +5103,7 @@ xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri) {
     fixed = xmlPathToURI(uri);
     if (fixed != NULL) {
        xmlSetNsProp(cur, ns, BAD_CAST "base", fixed);
-       xmlFree((xmlChar *)fixed);
+       xmlFree(fixed);
     } else {
        xmlSetNsProp(cur, ns, BAD_CAST "base", uri);
     }
########################################

  Okay, makes sense, pushed,

    thanks,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]