Cleanup php_libxml_unregister_node()

This commit is contained in:
Niels Dossche 2024-04-29 20:26:10 +02:00
parent 6e8b134023
commit a54d63aefe

View file

@ -151,18 +151,16 @@ static void php_libxml_unlink_entity(void *data, void *table, xmlChar *name)
/* {{{ internal functions for interoperability */ /* {{{ internal functions for interoperability */
static void php_libxml_unregister_node(xmlNodePtr nodep) static void php_libxml_unregister_node(xmlNodePtr nodep)
{ {
php_libxml_node_object *wrapper;
php_libxml_node_ptr *nodeptr = nodep->_private; php_libxml_node_ptr *nodeptr = nodep->_private;
if (nodeptr != NULL) { if (nodeptr != NULL) {
wrapper = nodeptr->_private; php_libxml_node_object *wrapper = nodeptr->_private;
if (wrapper) { if (wrapper) {
php_libxml_decrement_node_ptr(wrapper); php_libxml_decrement_node_ptr(wrapper);
php_libxml_decrement_doc_ref(wrapper); php_libxml_decrement_doc_ref(wrapper);
} else { } else {
if (nodeptr->node != NULL && nodeptr->node->type != XML_DOCUMENT_NODE) { if (nodep->type != XML_DOCUMENT_NODE) {
nodeptr->node->_private = NULL; nodep->_private = NULL;
} }
nodeptr->node = NULL; nodeptr->node = NULL;
} }