Skip to content

Commit b3f820b

Browse files
committed
Split off nodelist header components to nodelist.h
1 parent aa6564c commit b3f820b

File tree

4 files changed

+43
-20
lines changed

4 files changed

+43
-20
lines changed

ext/dom/nodelist.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "php.h"
2323
#if defined(HAVE_LIBXML) && defined(HAVE_DOM)
2424
#include "php_dom.h"
25+
#include "nodelist.h"
2526
#include "zend_interfaces.h"
2627

2728
/*
@@ -249,21 +250,7 @@ ZEND_METHOD(DOMNodeList, getIterator)
249250
zend_create_internal_iterator_zval(return_value, ZEND_THIS);
250251
}
251252

252-
enum dom_nodelist_dimension_index_type {
253-
DOM_NODELIST_DIM_ILLEGAL,
254-
DOM_NODELIST_DIM_STRING,
255-
DOM_NODELIST_DIM_LONG,
256-
};
257-
258-
typedef struct _dom_nodelist_dimension_index {
259-
union {
260-
zend_long lval;
261-
zend_string *str;
262-
};
263-
enum dom_nodelist_dimension_index_type type;
264-
} dom_nodelist_dimension_index;
265-
266-
static dom_nodelist_dimension_index dom_modern_nodelist_get_index(zval *offset)
253+
dom_nodelist_dimension_index dom_modern_nodelist_get_index(zval *offset)
267254
{
268255
dom_nodelist_dimension_index ret;
269256

ext/dom/nodelist.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
+----------------------------------------------------------------------+
3+
| Copyright (c) The PHP Group |
4+
+----------------------------------------------------------------------+
5+
| This source file is subject to version 3.01 of the PHP license, |
6+
| that is bundled with this package in the file LICENSE, and is |
7+
| available through the world-wide-web at the following url: |
8+
| https://www.php.net/license/3_01.txt |
9+
| If you did not receive a copy of the PHP license and are unable to |
10+
| obtain it through the world-wide-web, please send a note to |
11+
| [email protected] so we can mail you a copy immediately. |
12+
+----------------------------------------------------------------------+
13+
| Authors: Niels Dossche <[email protected]> |
14+
+----------------------------------------------------------------------+
15+
*/
16+
17+
#ifndef PHP_NODELIST_H
18+
#define PHP_NODELIST_H
19+
20+
enum dom_nodelist_dimension_index_type {
21+
DOM_NODELIST_DIM_ILLEGAL,
22+
DOM_NODELIST_DIM_STRING,
23+
DOM_NODELIST_DIM_LONG,
24+
};
25+
26+
typedef struct _dom_nodelist_dimension_index {
27+
union {
28+
zend_long lval;
29+
zend_string *str;
30+
};
31+
enum dom_nodelist_dimension_index_type type;
32+
} dom_nodelist_dimension_index;
33+
34+
void php_dom_nodelist_get_item_into_zval(dom_nnodemap_object *objmap, zend_long index, zval *return_value);
35+
int php_dom_get_nodelist_length(dom_object *obj);
36+
dom_nodelist_dimension_index dom_modern_nodelist_get_index(zval *offset);
37+
zval *dom_modern_nodelist_read_dimension(zend_object *object, zval *offset, int type, zval *rv);
38+
int dom_modern_nodelist_has_dimension(zend_object *object, zval *member, int check_empty);
39+
40+
#endif

ext/dom/php_dom.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "php.h"
2424
#if defined(HAVE_LIBXML) && defined(HAVE_DOM)
2525
#include "php_dom.h"
26+
#include "nodelist.h"
2627
#include "namespace_compat.h"
2728
#include "internal_helpers.h"
2829
#include "php_dom_arginfo.h"

ext/dom/php_dom.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,6 @@ xmlDocPtr php_dom_create_html_doc(void);
177177
xmlChar *dom_attr_value(const xmlAttr *attr, bool *free);
178178
bool dom_compare_value(const xmlAttr *attr, const xmlChar *value);
179179

180-
zval *dom_modern_nodelist_read_dimension(zend_object *object, zval *offset, int type, zval *rv);
181-
int dom_modern_nodelist_has_dimension(zend_object *object, zval *member, int check_empty);
182-
183180
typedef enum {
184181
DOM_LOAD_STRING = 0,
185182
DOM_LOAD_FILE = 1,
@@ -209,9 +206,7 @@ xmlNodePtr php_dom_named_node_map_get_named_item(dom_nnodemap_object *objmap, co
209206
void php_dom_named_node_map_get_named_item_into_zval(dom_nnodemap_object *objmap, const zend_string *named, zval *return_value);
210207
xmlNodePtr php_dom_named_node_map_get_item(dom_nnodemap_object *objmap, zend_long index);
211208
void php_dom_named_node_map_get_item_into_zval(dom_nnodemap_object *objmap, zend_long index, zval *return_value);
212-
void php_dom_nodelist_get_item_into_zval(dom_nnodemap_object *objmap, zend_long index, zval *return_value);
213209
int php_dom_get_namednodemap_length(dom_object *obj);
214-
int php_dom_get_nodelist_length(dom_object *obj);
215210

216211
xmlNodePtr dom_clone_node(php_dom_libxml_ns_mapper *ns_mapper, xmlNodePtr node, xmlDocPtr doc, bool recursive);
217212

0 commit comments

Comments
 (0)