1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-28 00:21:53 +03:00

fixing bug #107129, removing excessive allocation and calls to *printf in

* tree.c valid.c xpath.c include/libxml/tree.h include/libxml/valid.h:
  fixing bug #107129, removing excessive allocation and calls
  to *printf in the code to build QName strings.
Daniel
This commit is contained in:
Daniel Veillard
2003-04-07 10:22:39 +00:00
parent 6965118d3c
commit c00cda8c06
6 changed files with 233 additions and 160 deletions

22
xpath.c
View File

@ -6186,18 +6186,20 @@ xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs)
else if ((cur->nodesetval->nodeTab[i]->ns == NULL) ||
(cur->nodesetval->nodeTab[i]->ns->prefix == NULL)) {
valuePush(ctxt,
xmlXPathNewString(cur->nodesetval->
nodeTab[i]->name));
xmlXPathNewString(cur->nodesetval->nodeTab[i]->name));
} else {
char name[2000];
snprintf(name, sizeof(name), "%s:%s",
(char *) cur->nodesetval->nodeTab[i]->ns->
prefix,
(char *) cur->nodesetval->nodeTab[i]->name);
name[sizeof(name) - 1] = 0;
valuePush(ctxt, xmlXPathNewCString(name));
xmlChar *fullname;
fullname = xmlBuildQName(cur->nodesetval->nodeTab[i]->name,
cur->nodesetval->nodeTab[i]->ns->prefix,
NULL, 0);
if (fullname == cur->nodesetval->nodeTab[i]->name)
fullname = xmlStrdup(cur->nodesetval->nodeTab[i]->name);
if (fullname == NULL) {
XP_ERROR(XPATH_MEMORY_ERROR);
}
valuePush(ctxt, xmlXPathWrapString(fullname));
}
break;
default: