mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Use uint32_t for the number of nodes (#11371)
This commit is contained in:
@@ -134,6 +134,8 @@ PHP 8.3 INTERNALS UPGRADE NOTES
|
||||
the base node of the node list. This function also no longer accepts -1 as the index argument.
|
||||
- The function dom_namednode_iter() has additional arguments to avoid recomputing the length of
|
||||
the strings.
|
||||
- The functions dom_parent_node_prepend(), dom_parent_node_append(), dom_parent_node_after(), and
|
||||
dom_parent_node_before() now use an uint32_t argument for the number of nodes instead of int.
|
||||
|
||||
g. ext/libxml
|
||||
- Two new functions: php_libxml_invalidate_node_list_cache_from_doc() and
|
||||
|
||||
@@ -364,7 +364,7 @@ PHP_METHOD(DOMCharacterData, remove)
|
||||
|
||||
PHP_METHOD(DOMCharacterData, after)
|
||||
{
|
||||
int argc;
|
||||
uint32_t argc;
|
||||
zval *args, *id;
|
||||
dom_object *intern;
|
||||
xmlNode *context;
|
||||
@@ -381,7 +381,7 @@ PHP_METHOD(DOMCharacterData, after)
|
||||
|
||||
PHP_METHOD(DOMCharacterData, before)
|
||||
{
|
||||
int argc;
|
||||
uint32_t argc;
|
||||
zval *args, *id;
|
||||
dom_object *intern;
|
||||
xmlNode *context;
|
||||
@@ -398,7 +398,7 @@ PHP_METHOD(DOMCharacterData, before)
|
||||
|
||||
PHP_METHOD(DOMCharacterData, replaceWith)
|
||||
{
|
||||
int argc;
|
||||
uint32_t argc;
|
||||
zval *args, *id;
|
||||
dom_object *intern;
|
||||
xmlNode *context;
|
||||
|
||||
@@ -2104,7 +2104,7 @@ Since: DOM Living Standard (DOM4)
|
||||
*/
|
||||
PHP_METHOD(DOMDocument, append)
|
||||
{
|
||||
int argc;
|
||||
uint32_t argc;
|
||||
zval *args, *id;
|
||||
dom_object *intern;
|
||||
xmlNode *context;
|
||||
@@ -2125,7 +2125,7 @@ Since: DOM Living Standard (DOM4)
|
||||
*/
|
||||
PHP_METHOD(DOMDocument, prepend)
|
||||
{
|
||||
int argc;
|
||||
uint32_t argc;
|
||||
zval *args, *id;
|
||||
dom_object *intern;
|
||||
xmlNode *context;
|
||||
|
||||
@@ -135,7 +135,7 @@ Since: DOM Living Standard (DOM4)
|
||||
*/
|
||||
PHP_METHOD(DOMDocumentFragment, append)
|
||||
{
|
||||
int argc;
|
||||
uint32_t argc;
|
||||
zval *args, *id;
|
||||
dom_object *intern;
|
||||
xmlNode *context;
|
||||
@@ -156,7 +156,7 @@ Since: DOM Living Standard (DOM4)
|
||||
*/
|
||||
PHP_METHOD(DOMDocumentFragment, prepend)
|
||||
{
|
||||
int argc;
|
||||
uint32_t argc;
|
||||
zval *args, *id;
|
||||
dom_object *intern;
|
||||
xmlNode *context;
|
||||
|
||||
@@ -1155,7 +1155,7 @@ PHP_METHOD(DOMElement, remove)
|
||||
|
||||
PHP_METHOD(DOMElement, after)
|
||||
{
|
||||
int argc;
|
||||
uint32_t argc;
|
||||
zval *args, *id;
|
||||
dom_object *intern;
|
||||
xmlNode *context;
|
||||
@@ -1172,7 +1172,7 @@ PHP_METHOD(DOMElement, after)
|
||||
|
||||
PHP_METHOD(DOMElement, before)
|
||||
{
|
||||
int argc;
|
||||
uint32_t argc;
|
||||
zval *args, *id;
|
||||
dom_object *intern;
|
||||
xmlNode *context;
|
||||
@@ -1192,7 +1192,7 @@ Since: DOM Living Standard (DOM4)
|
||||
*/
|
||||
PHP_METHOD(DOMElement, append)
|
||||
{
|
||||
int argc;
|
||||
uint32_t argc;
|
||||
zval *args, *id;
|
||||
dom_object *intern;
|
||||
xmlNode *context;
|
||||
@@ -1213,7 +1213,7 @@ Since: DOM Living Standard (DOM4)
|
||||
*/
|
||||
PHP_METHOD(DOMElement, prepend)
|
||||
{
|
||||
int argc;
|
||||
uint32_t argc;
|
||||
zval *args, *id;
|
||||
dom_object *intern;
|
||||
xmlNode *context;
|
||||
@@ -1234,7 +1234,7 @@ Since: DOM Living Standard (DOM4)
|
||||
*/
|
||||
PHP_METHOD(DOMElement, replaceWith)
|
||||
{
|
||||
int argc;
|
||||
uint32_t argc;
|
||||
zval *args, *id;
|
||||
dom_object *intern;
|
||||
xmlNode *context;
|
||||
|
||||
@@ -124,9 +124,9 @@ int dom_parent_node_child_element_count(dom_object *obj, zval *retval)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static bool dom_is_node_in_list(const zval *nodes, int nodesc, const xmlNodePtr node_to_find)
|
||||
static bool dom_is_node_in_list(const zval *nodes, uint32_t nodesc, const xmlNodePtr node_to_find)
|
||||
{
|
||||
for (int i = 0; i < nodesc; i++) {
|
||||
for (uint32_t i = 0; i < nodesc; i++) {
|
||||
if (Z_TYPE(nodes[i]) == IS_OBJECT) {
|
||||
const zend_class_entry *ce = Z_OBJCE(nodes[i]);
|
||||
|
||||
@@ -141,9 +141,8 @@ static bool dom_is_node_in_list(const zval *nodes, int nodesc, const xmlNodePtr
|
||||
return false;
|
||||
}
|
||||
|
||||
xmlNode* dom_zvals_to_fragment(php_libxml_ref_obj *document, xmlNode *contextNode, zval *nodes, int nodesc)
|
||||
xmlNode* dom_zvals_to_fragment(php_libxml_ref_obj *document, xmlNode *contextNode, zval *nodes, uint32_t nodesc)
|
||||
{
|
||||
int i;
|
||||
xmlDoc *documentNode;
|
||||
xmlNode *fragment;
|
||||
xmlNode *newNode;
|
||||
@@ -170,7 +169,7 @@ xmlNode* dom_zvals_to_fragment(php_libxml_ref_obj *document, xmlNode *contextNod
|
||||
|
||||
stricterror = dom_get_strict_error(document);
|
||||
|
||||
for (i = 0; i < nodesc; i++) {
|
||||
for (uint32_t i = 0; i < nodesc; i++) {
|
||||
if (Z_TYPE(nodes[i]) == IS_OBJECT) {
|
||||
ce = Z_OBJCE(nodes[i]);
|
||||
|
||||
@@ -253,9 +252,9 @@ static void dom_fragment_assign_parent_node(xmlNodePtr parentNode, xmlNodePtr fr
|
||||
fragment->last = NULL;
|
||||
}
|
||||
|
||||
static zend_result dom_hierarchy_node_list(xmlNodePtr parentNode, zval *nodes, int nodesc)
|
||||
static zend_result dom_hierarchy_node_list(xmlNodePtr parentNode, zval *nodes, uint32_t nodesc)
|
||||
{
|
||||
for (int i = 0; i < nodesc; i++) {
|
||||
for (uint32_t i = 0; i < nodesc; i++) {
|
||||
if (Z_TYPE(nodes[i]) == IS_OBJECT) {
|
||||
const zend_class_entry *ce = Z_OBJCE(nodes[i]);
|
||||
|
||||
@@ -270,7 +269,7 @@ static zend_result dom_hierarchy_node_list(xmlNodePtr parentNode, zval *nodes, i
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void dom_parent_node_append(dom_object *context, zval *nodes, int nodesc)
|
||||
void dom_parent_node_append(dom_object *context, zval *nodes, uint32_t nodesc)
|
||||
{
|
||||
xmlNode *parentNode = dom_object_get_node(context);
|
||||
xmlNodePtr newchild, prevsib;
|
||||
@@ -311,7 +310,7 @@ void dom_parent_node_append(dom_object *context, zval *nodes, int nodesc)
|
||||
xmlFree(fragment);
|
||||
}
|
||||
|
||||
void dom_parent_node_prepend(dom_object *context, zval *nodes, int nodesc)
|
||||
void dom_parent_node_prepend(dom_object *context, zval *nodes, uint32_t nodesc)
|
||||
{
|
||||
xmlNode *parentNode = dom_object_get_node(context);
|
||||
|
||||
@@ -379,7 +378,7 @@ static void dom_pre_insert(xmlNodePtr insertion_point, xmlNodePtr parentNode, xm
|
||||
}
|
||||
}
|
||||
|
||||
void dom_parent_node_after(dom_object *context, zval *nodes, int nodesc)
|
||||
void dom_parent_node_after(dom_object *context, zval *nodes, uint32_t nodesc)
|
||||
{
|
||||
/* Spec link: https://dom.spec.whatwg.org/#dom-childnode-after */
|
||||
|
||||
@@ -432,7 +431,7 @@ void dom_parent_node_after(dom_object *context, zval *nodes, int nodesc)
|
||||
xmlFree(fragment);
|
||||
}
|
||||
|
||||
void dom_parent_node_before(dom_object *context, zval *nodes, int nodesc)
|
||||
void dom_parent_node_before(dom_object *context, zval *nodes, uint32_t nodesc)
|
||||
{
|
||||
/* Spec link: https://dom.spec.whatwg.org/#dom-childnode-before */
|
||||
|
||||
@@ -544,7 +543,7 @@ void dom_child_node_remove(dom_object *context)
|
||||
php_dom_throw_error(NOT_FOUND_ERR, stricterror);
|
||||
}
|
||||
|
||||
void dom_child_replace_with(dom_object *context, zval *nodes, int nodesc)
|
||||
void dom_child_replace_with(dom_object *context, zval *nodes, uint32_t nodesc)
|
||||
{
|
||||
xmlNodePtr child = dom_object_get_node(context);
|
||||
xmlNodePtr parentNode = child->parent;
|
||||
|
||||
@@ -135,12 +135,12 @@ xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
|
||||
zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
|
||||
void dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce);
|
||||
|
||||
void dom_parent_node_prepend(dom_object *context, zval *nodes, int nodesc);
|
||||
void dom_parent_node_append(dom_object *context, zval *nodes, int nodesc);
|
||||
void dom_parent_node_after(dom_object *context, zval *nodes, int nodesc);
|
||||
void dom_parent_node_before(dom_object *context, zval *nodes, int nodesc);
|
||||
void dom_parent_node_prepend(dom_object *context, zval *nodes, uint32_t nodesc);
|
||||
void dom_parent_node_append(dom_object *context, zval *nodes, uint32_t nodesc);
|
||||
void dom_parent_node_after(dom_object *context, zval *nodes, uint32_t nodesc);
|
||||
void dom_parent_node_before(dom_object *context, zval *nodes, uint32_t nodesc);
|
||||
void dom_child_node_remove(dom_object *context);
|
||||
void dom_child_replace_with(dom_object *context, zval *nodes, int nodesc);
|
||||
void dom_child_replace_with(dom_object *context, zval *nodes, uint32_t nodesc);
|
||||
|
||||
#define DOM_GET_OBJ(__ptr, __id, __prtype, __intern) { \
|
||||
__intern = Z_DOMOBJ_P(__id); \
|
||||
|
||||
Reference in New Issue
Block a user