[php-src] master: Split off nodelist header components to nodelist.h

From: Date: Sun, 14 Apr 2024 12:48:45 +0000
Subject: [php-src] master: Split off nodelist header components to nodelist.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-128096@lists.php.net to get a copy of this message
Author: Niels Dossche (nielsdos) Date: 2024-04-14T14:45:46+02:00 Commit: https://github.com/php/php-src/commit/b3f820b408e3d3329160b95456944f6bbdeeb521 Raw diff: https://github.com/php/php-src/commit/b3f820b408e3d3329160b95456944f6bbdeeb521.diff Split off nodelist header components to nodelist.h Changed paths: A ext/dom/nodelist.h M ext/dom/nodelist.c M ext/dom/php_dom.c M ext/dom/php_dom.h Diff: diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c index d212d6a79ffd..beda8939e553 100644 --- a/ext/dom/nodelist.c +++ b/ext/dom/nodelist.c @@ -22,6 +22,7 @@ #include "php.h" #if defined(HAVE_LIBXML) && defined(HAVE_DOM) #include "php_dom.h" +#include "nodelist.h" #include "zend_interfaces.h" /* @@ -249,21 +250,7 @@ ZEND_METHOD(DOMNodeList, getIterator) zend_create_internal_iterator_zval(return_value, ZEND_THIS); } -enum dom_nodelist_dimension_index_type { - DOM_NODELIST_DIM_ILLEGAL, - DOM_NODELIST_DIM_STRING, - DOM_NODELIST_DIM_LONG, -}; - -typedef struct _dom_nodelist_dimension_index { - union { - zend_long lval; - zend_string *str; - }; - enum dom_nodelist_dimension_index_type type; -} dom_nodelist_dimension_index; - -static dom_nodelist_dimension_index dom_modern_nodelist_get_index(zval *offset) +dom_nodelist_dimension_index dom_modern_nodelist_get_index(zval *offset) { dom_nodelist_dimension_index ret; diff --git a/ext/dom/nodelist.h b/ext/dom/nodelist.h new file mode 100644 index 000000000000..af76e34e41dc --- /dev/null +++ b/ext/dom/nodelist.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | Copyright (c) The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | https://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Niels Dossche <nielsdos@php.net> | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_NODELIST_H +#define PHP_NODELIST_H + +enum dom_nodelist_dimension_index_type { + DOM_NODELIST_DIM_ILLEGAL, + DOM_NODELIST_DIM_STRING, + DOM_NODELIST_DIM_LONG, +}; + +typedef struct _dom_nodelist_dimension_index { + union { + zend_long lval; + zend_string *str; + }; + enum dom_nodelist_dimension_index_type type; +} dom_nodelist_dimension_index; + +void php_dom_nodelist_get_item_into_zval(dom_nnodemap_object *objmap, zend_long index, zval *return_value); +int php_dom_get_nodelist_length(dom_object *obj); +dom_nodelist_dimension_index dom_modern_nodelist_get_index(zval *offset); +zval *dom_modern_nodelist_read_dimension(zend_object *object, zval *offset, int type, zval *rv); +int dom_modern_nodelist_has_dimension(zend_object *object, zval *member, int check_empty); + +#endif diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index acf1b5a1e929..c6cead3578d3 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -23,6 +23,7 @@ #include "php.h" #if defined(HAVE_LIBXML) && defined(HAVE_DOM) #include "php_dom.h" +#include "nodelist.h" #include "namespace_compat.h" #include "internal_helpers.h" #include "php_dom_arginfo.h" diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index 6806217b5ce3..5aa2a9ce949a 100644 --- a/ext/dom/php_dom.h +++ b/ext/dom/php_dom.h @@ -177,9 +177,6 @@ xmlDocPtr php_dom_create_html_doc(void); xmlChar *dom_attr_value(const xmlAttr *attr, bool *free); bool dom_compare_value(const xmlAttr *attr, const xmlChar *value); -zval *dom_modern_nodelist_read_dimension(zend_object *object, zval *offset, int type, zval *rv); -int dom_modern_nodelist_has_dimension(zend_object *object, zval *member, int check_empty); - typedef enum { DOM_LOAD_STRING = 0, DOM_LOAD_FILE = 1, @@ -209,9 +206,7 @@ xmlNodePtr php_dom_named_node_map_get_named_item(dom_nnodemap_object *objmap, co void php_dom_named_node_map_get_named_item_into_zval(dom_nnodemap_object *objmap, const zend_string *named, zval *return_value); xmlNodePtr php_dom_named_node_map_get_item(dom_nnodemap_object *objmap, zend_long index); void php_dom_named_node_map_get_item_into_zval(dom_nnodemap_object *objmap, zend_long index, zval *return_value); -void php_dom_nodelist_get_item_into_zval(dom_nnodemap_object *objmap, zend_long index, zval *return_value); int php_dom_get_namednodemap_length(dom_object *obj); -int php_dom_get_nodelist_length(dom_object *obj); xmlNodePtr dom_clone_node(php_dom_libxml_ns_mapper *ns_mapper, xmlNodePtr node, xmlDocPtr doc, bool recursive);

« previous php.cvs (#128096) next »