Implement Dom\TokenList (#13664)

Part of RFC: https://wiki.php.net/rfc/dom_additions_84

Closes GH-11688.
This commit is contained in:
Niels Dossche 2024-07-02 12:34:23 -07:00 committed by GitHub
parent 768900b180
commit fc09f4b2bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 2186 additions and 30 deletions

View file

@ -1313,24 +1313,30 @@ PHP_LIBXML_API int php_libxml_increment_node_ptr(php_libxml_node_object *object,
return ret_refcount;
}
PHP_LIBXML_API int php_libxml_decrement_node_ptr_ref(php_libxml_node_ptr *ptr)
{
ZEND_ASSERT(ptr != NULL);
int ret_refcount = --ptr->refcount;
if (ret_refcount == 0) {
if (ptr->node != NULL) {
ptr->node->_private = NULL;
}
if (ptr->_private) {
php_libxml_node_object *object = (php_libxml_node_object *) ptr->_private;
object->node = NULL;
}
efree(ptr);
}
return ret_refcount;
}
PHP_LIBXML_API int php_libxml_decrement_node_ptr(php_libxml_node_object *object)
{
int ret_refcount = -1;
php_libxml_node_ptr *obj_node;
if (object != NULL && object->node != NULL) {
obj_node = (php_libxml_node_ptr *) object->node;
ret_refcount = --obj_node->refcount;
if (ret_refcount == 0) {
if (obj_node->node != NULL) {
obj_node->node->_private = NULL;
}
efree(obj_node);
}
object->node = NULL;
return php_libxml_decrement_node_ptr_ref(object->node);
}
return ret_refcount;
return -1;
}
PHP_LIBXML_API int php_libxml_increment_doc_ref(php_libxml_node_object *object, xmlDocPtr docp)