[libxml2] Simplify xmlFreeNode



commit 823bf161566da76a27a079d9febe78c4f996004a
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Fri May 20 22:38:38 2022 +0200

    Simplify xmlFreeNode

 tree.c | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)
---
diff --git a/tree.c b/tree.c
index e2ab961b..30f031d5 100644
--- a/tree.c
+++ b/tree.c
@@ -3828,18 +3828,18 @@ xmlFreeNode(xmlNodePtr cur) {
     if ((cur->children != NULL) &&
        (cur->type != XML_ENTITY_REF_NODE))
        xmlFreeNodeList(cur->children);
-    if (((cur->type == XML_ELEMENT_NODE) ||
-        (cur->type == XML_XINCLUDE_START) ||
-        (cur->type == XML_XINCLUDE_END)) &&
-       (cur->properties != NULL))
-       xmlFreePropList(cur->properties);
-    if ((cur->type != XML_ELEMENT_NODE) &&
-       (cur->content != NULL) &&
-       (cur->type != XML_ENTITY_REF_NODE) &&
-       (cur->type != XML_XINCLUDE_END) &&
-       (cur->type != XML_XINCLUDE_START) &&
-       (cur->content != (xmlChar *) &(cur->properties))) {
-       DICT_FREE(cur->content)
+
+    if ((cur->type == XML_ELEMENT_NODE) ||
+        (cur->type == XML_XINCLUDE_START) ||
+        (cur->type == XML_XINCLUDE_END)) {
+        if (cur->properties != NULL)
+            xmlFreePropList(cur->properties);
+        if (cur->nsDef != NULL)
+            xmlFreeNsList(cur->nsDef);
+    } else if ((cur->content != NULL) &&
+               (cur->type != XML_ENTITY_REF_NODE) &&
+               (cur->content != (xmlChar *) &(cur->properties))) {
+        DICT_FREE(cur->content)
     }
 
     /*
@@ -3852,11 +3852,6 @@ xmlFreeNode(xmlNodePtr cur) {
         (cur->type != XML_COMMENT_NODE))
        DICT_FREE(cur->name)
 
-    if (((cur->type == XML_ELEMENT_NODE) ||
-        (cur->type == XML_XINCLUDE_START) ||
-        (cur->type == XML_XINCLUDE_END)) &&
-       (cur->nsDef != NULL))
-       xmlFreeNsList(cur->nsDef);
     xmlFree(cur);
 }
 


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