1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

some cleanup after an unsuccessful attempt at fixing #61290 :-( Daniel

* debugXML.c tree.c: some cleanup after an unsuccessful attempt
  at fixing #61290 :-(
Daniel
This commit is contained in:
Daniel Veillard
2002-01-14 17:11:53 +00:00
parent bc66f859d1
commit e6a5519cdc
3 changed files with 41 additions and 9 deletions

View File

@ -1,3 +1,8 @@
Mon Jan 14 17:53:41 CET 2002 Daniel Veillard <daniel@veillard.com>
* debugXML.c tree.c: some cleanup after an unsuccessful attempt
at fixing #61290 :-(
Sun Jan 13 21:30:54 CET 2002 Daniel Veillard <daniel@veillard.com> Sun Jan 13 21:30:54 CET 2002 Daniel Veillard <daniel@veillard.com>
* tree.c: fixed xmlSaveFormatFileEnc() when encoding == NULL * tree.c: fixed xmlSaveFormatFileEnc() when encoding == NULL

View File

@ -1111,17 +1111,22 @@ xmlLsOneNode(FILE *output, xmlNodePtr node) {
case XML_NOTATION_NODE: case XML_NOTATION_NODE:
fprintf(output, "N"); fprintf(output, "N");
break; break;
case XML_NAMESPACE_DECL:
fprintf(output, "n");
break;
default: default:
fprintf(output, "?"); fprintf(output, "?");
} }
if (node->properties != NULL) if (node->type != XML_NAMESPACE_DECL) {
fprintf(output, "a"); if (node->properties != NULL)
else fprintf(output, "a");
fprintf(output, "-"); else
if (node->nsDef != NULL) fprintf(output, "-");
fprintf(output, "n"); if (node->nsDef != NULL)
else fprintf(output, "n");
fprintf(output, "-"); else
fprintf(output, "-");
}
fprintf(output, " %8d ", xmlLsCountNode(node)); fprintf(output, " %8d ", xmlLsCountNode(node));
@ -1169,6 +1174,15 @@ xmlLsOneNode(FILE *output, xmlNodePtr node) {
break; break;
case XML_NOTATION_NODE: case XML_NOTATION_NODE:
break; break;
case XML_NAMESPACE_DECL: {
xmlNsPtr ns = (xmlNsPtr) node;
if (ns->prefix == NULL)
fprintf(output, "default -> %s", ns->href);
else
fprintf(output, "%s -> %s", ns->prefix, ns->href);
break;
}
default: default:
if (node->name != NULL) if (node->name != NULL)
fprintf(output, "%s", node->name); fprintf(output, "%s", node->name);
@ -1363,6 +1377,9 @@ xmlShellList(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
if ((node->type == XML_DOCUMENT_NODE) || if ((node->type == XML_DOCUMENT_NODE) ||
(node->type == XML_HTML_DOCUMENT_NODE)) { (node->type == XML_HTML_DOCUMENT_NODE)) {
cur = ((xmlDocPtr) node)->children; cur = ((xmlDocPtr) node)->children;
} else if (node->type == XML_NAMESPACE_DECL) {
xmlLsOneNode(stdout, node);
return (0);
} else if (node->children != NULL) { } else if (node->children != NULL) {
cur = node->children; cur = node->children;
} else { } else {

12
tree.c
View File

@ -2352,6 +2352,10 @@ xmlFreeNodeList(xmlNodePtr cur) {
#endif #endif
return; return;
} }
if (cur->type == XML_NAMESPACE_DECL) {
xmlFreeNsList((xmlNsPtr) cur);
return;
}
while (cur != NULL) { while (cur != NULL) {
next = cur->next; next = cur->next;
/* unroll to speed up freeing the document */ /* unroll to speed up freeing the document */
@ -2425,8 +2429,14 @@ xmlFreeNode(xmlNodePtr cur) {
return; return;
} }
/* use xmlFreeDtd for DTD nodes */ /* use xmlFreeDtd for DTD nodes */
if (cur->type == XML_DTD_NODE) if (cur->type == XML_DTD_NODE) {
xmlFreeDtd((xmlDtdPtr) cur);
return; return;
}
if (cur->type == XML_NAMESPACE_DECL) {
xmlFreeNs((xmlNsPtr) cur);
return;
}
if ((cur->children != NULL) && if ((cur->children != NULL) &&
(cur->type != XML_ENTITY_REF_NODE)) (cur->type != XML_ENTITY_REF_NODE))
xmlFreeNodeList(cur->children); xmlFreeNodeList(cur->children);