mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Implement Dom\TokenList (#13664)
Part of RFC: https://wiki.php.net/rfc/dom_additions_84 Closes GH-11688.
This commit is contained in:
parent
768900b180
commit
fc09f4b2bc
42 changed files with 2186 additions and 30 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue