mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
dom: Rename get_named_item -> get_ns_named_item, and has_named_item -> has_ns_named_item
This commit is contained in:
parent
5cacae8f29
commit
a2d65354a0
4 changed files with 36 additions and 36 deletions
|
@ -63,7 +63,7 @@ PHP_METHOD(DOMNamedNodeMap, getNamedItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
dom_nnodemap_object *objmap = Z_DOMOBJ_P(ZEND_THIS)->ptr;
|
dom_nnodemap_object *objmap = Z_DOMOBJ_P(ZEND_THIS)->ptr;
|
||||||
php_dom_obj_map_get_named_item_into_zval(objmap, named, NULL, return_value);
|
php_dom_obj_map_get_ns_named_item_into_zval(objmap, named, NULL, return_value);
|
||||||
}
|
}
|
||||||
/* }}} end dom_namednodemap_get_named_item */
|
/* }}} end dom_namednodemap_get_named_item */
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ PHP_METHOD(DOMNamedNodeMap, getNamedItemNS)
|
||||||
objmap = (dom_nnodemap_object *)intern->ptr;
|
objmap = (dom_nnodemap_object *)intern->ptr;
|
||||||
|
|
||||||
if (objmap != NULL) {
|
if (objmap != NULL) {
|
||||||
php_dom_obj_map_get_named_item_into_zval(objmap, named, uri, return_value);
|
php_dom_obj_map_get_ns_named_item_into_zval(objmap, named, uri, return_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* }}} end dom_namednodemap_get_named_item_ns */
|
/* }}} end dom_namednodemap_get_named_item_ns */
|
||||||
|
|
|
@ -373,9 +373,9 @@ void php_dom_obj_map_get_item_into_zval(dom_nnodemap_object *objmap, zend_long i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void php_dom_obj_map_get_named_item_into_zval(dom_nnodemap_object *objmap, const zend_string *named, const char *ns, zval *return_value)
|
void php_dom_obj_map_get_ns_named_item_into_zval(dom_nnodemap_object *objmap, const zend_string *named, const char *ns, zval *return_value)
|
||||||
{
|
{
|
||||||
xmlNodePtr itemnode = objmap->handler->get_named_item(objmap, named, ns);
|
xmlNodePtr itemnode = objmap->handler->get_ns_named_item(objmap, named, ns);
|
||||||
if (itemnode) {
|
if (itemnode) {
|
||||||
DOM_RET_OBJ(itemnode, objmap->baseobj);
|
DOM_RET_OBJ(itemnode, objmap->baseobj);
|
||||||
} else {
|
} else {
|
||||||
|
@ -387,17 +387,17 @@ void php_dom_obj_map_get_named_item_into_zval(dom_nnodemap_object *objmap, const
|
||||||
* === Named item === *
|
* === Named item === *
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
static xmlNodePtr dom_map_get_named_item_entity(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
static xmlNodePtr dom_map_get_ns_named_item_entity(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
||||||
{
|
{
|
||||||
return xmlHashLookup(map->ht, BAD_CAST ZSTR_VAL(named));
|
return xmlHashLookup(map->ht, BAD_CAST ZSTR_VAL(named));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dom_map_has_named_item_xmlht(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
static bool dom_map_has_ns_named_item_xmlht(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
||||||
{
|
{
|
||||||
return dom_map_get_named_item_entity(map, named, ns) != NULL;
|
return dom_map_get_ns_named_item_entity(map, named, ns) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static xmlNodePtr dom_map_get_named_item_notation(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
static xmlNodePtr dom_map_get_ns_named_item_notation(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
||||||
{
|
{
|
||||||
xmlNotationPtr notation = xmlHashLookup(map->ht, BAD_CAST ZSTR_VAL(named));
|
xmlNotationPtr notation = xmlHashLookup(map->ht, BAD_CAST ZSTR_VAL(named));
|
||||||
if (notation) {
|
if (notation) {
|
||||||
|
@ -406,7 +406,7 @@ static xmlNodePtr dom_map_get_named_item_notation(dom_nnodemap_object *map, cons
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static xmlNodePtr dom_map_get_named_item_prop(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
static xmlNodePtr dom_map_get_ns_named_item_prop(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
||||||
{
|
{
|
||||||
xmlNodePtr nodep = dom_object_get_node(map->baseobj);
|
xmlNodePtr nodep = dom_object_get_node(map->baseobj);
|
||||||
if (nodep) {
|
if (nodep) {
|
||||||
|
@ -423,17 +423,17 @@ static xmlNodePtr dom_map_get_named_item_prop(dom_nnodemap_object *map, const ze
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dom_map_has_named_item_prop(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
static bool dom_map_has_ns_named_item_prop(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
||||||
{
|
{
|
||||||
return dom_map_get_named_item_prop(map, named, ns) != NULL;
|
return dom_map_get_ns_named_item_prop(map, named, ns) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static xmlNodePtr dom_map_get_named_item_null(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
static xmlNodePtr dom_map_get_ns_named_item_null(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dom_map_has_named_item_null(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
static bool dom_map_has_ns_named_item_null(dom_nnodemap_object *map, const zend_string *named, const char *ns)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -445,8 +445,8 @@ static bool dom_map_has_named_item_null(dom_nnodemap_object *map, const zend_str
|
||||||
const php_dom_obj_map_handler php_dom_obj_map_attributes = {
|
const php_dom_obj_map_handler php_dom_obj_map_attributes = {
|
||||||
.length = dom_map_get_prop_length,
|
.length = dom_map_get_prop_length,
|
||||||
.get_item = dom_map_get_attributes_item,
|
.get_item = dom_map_get_attributes_item,
|
||||||
.get_named_item = dom_map_get_named_item_prop,
|
.get_ns_named_item = dom_map_get_ns_named_item_prop,
|
||||||
.has_named_item = dom_map_has_named_item_prop,
|
.has_ns_named_item = dom_map_has_ns_named_item_prop,
|
||||||
.use_cache = false,
|
.use_cache = false,
|
||||||
.nameless = false,
|
.nameless = false,
|
||||||
};
|
};
|
||||||
|
@ -454,8 +454,8 @@ const php_dom_obj_map_handler php_dom_obj_map_attributes = {
|
||||||
const php_dom_obj_map_handler php_dom_obj_map_by_tag_name = {
|
const php_dom_obj_map_handler php_dom_obj_map_by_tag_name = {
|
||||||
.length = dom_map_get_by_tag_name_length,
|
.length = dom_map_get_by_tag_name_length,
|
||||||
.get_item = dom_map_get_by_tag_name_item,
|
.get_item = dom_map_get_by_tag_name_item,
|
||||||
.get_named_item = dom_map_get_named_item_null,
|
.get_ns_named_item = dom_map_get_ns_named_item_null,
|
||||||
.has_named_item = dom_map_has_named_item_null,
|
.has_ns_named_item = dom_map_has_ns_named_item_null,
|
||||||
.use_cache = true,
|
.use_cache = true,
|
||||||
.nameless = true,
|
.nameless = true,
|
||||||
};
|
};
|
||||||
|
@ -463,8 +463,8 @@ const php_dom_obj_map_handler php_dom_obj_map_by_tag_name = {
|
||||||
const php_dom_obj_map_handler php_dom_obj_map_child_nodes = {
|
const php_dom_obj_map_handler php_dom_obj_map_child_nodes = {
|
||||||
.length = dom_map_get_nodes_length,
|
.length = dom_map_get_nodes_length,
|
||||||
.get_item = dom_map_get_nodes_item,
|
.get_item = dom_map_get_nodes_item,
|
||||||
.get_named_item = dom_map_get_named_item_null,
|
.get_ns_named_item = dom_map_get_ns_named_item_null,
|
||||||
.has_named_item = dom_map_has_named_item_null,
|
.has_ns_named_item = dom_map_has_ns_named_item_null,
|
||||||
.use_cache = true,
|
.use_cache = true,
|
||||||
.nameless = true,
|
.nameless = true,
|
||||||
};
|
};
|
||||||
|
@ -472,8 +472,8 @@ const php_dom_obj_map_handler php_dom_obj_map_child_nodes = {
|
||||||
const php_dom_obj_map_handler php_dom_obj_map_nodeset = {
|
const php_dom_obj_map_handler php_dom_obj_map_nodeset = {
|
||||||
.length = dom_map_get_nodeset_length,
|
.length = dom_map_get_nodeset_length,
|
||||||
.get_item = dom_map_get_nodeset_item,
|
.get_item = dom_map_get_nodeset_item,
|
||||||
.get_named_item = dom_map_get_named_item_null,
|
.get_ns_named_item = dom_map_get_ns_named_item_null,
|
||||||
.has_named_item = dom_map_has_named_item_null,
|
.has_ns_named_item = dom_map_has_ns_named_item_null,
|
||||||
.use_cache = false,
|
.use_cache = false,
|
||||||
.nameless = true,
|
.nameless = true,
|
||||||
};
|
};
|
||||||
|
@ -481,8 +481,8 @@ const php_dom_obj_map_handler php_dom_obj_map_nodeset = {
|
||||||
const php_dom_obj_map_handler php_dom_obj_map_entities = {
|
const php_dom_obj_map_handler php_dom_obj_map_entities = {
|
||||||
.length = dom_map_get_xmlht_length,
|
.length = dom_map_get_xmlht_length,
|
||||||
.get_item = dom_map_get_entity_item,
|
.get_item = dom_map_get_entity_item,
|
||||||
.get_named_item = dom_map_get_named_item_entity,
|
.get_ns_named_item = dom_map_get_ns_named_item_entity,
|
||||||
.has_named_item = dom_map_has_named_item_xmlht,
|
.has_ns_named_item = dom_map_has_ns_named_item_xmlht,
|
||||||
.use_cache = false,
|
.use_cache = false,
|
||||||
.nameless = false,
|
.nameless = false,
|
||||||
};
|
};
|
||||||
|
@ -490,8 +490,8 @@ const php_dom_obj_map_handler php_dom_obj_map_entities = {
|
||||||
const php_dom_obj_map_handler php_dom_obj_map_notations = {
|
const php_dom_obj_map_handler php_dom_obj_map_notations = {
|
||||||
.length = dom_map_get_xmlht_length,
|
.length = dom_map_get_xmlht_length,
|
||||||
.get_item = dom_map_get_notation_item,
|
.get_item = dom_map_get_notation_item,
|
||||||
.get_named_item = dom_map_get_named_item_notation,
|
.get_ns_named_item = dom_map_get_ns_named_item_notation,
|
||||||
.has_named_item = dom_map_has_named_item_xmlht,
|
.has_ns_named_item = dom_map_has_ns_named_item_xmlht,
|
||||||
.use_cache = false,
|
.use_cache = false,
|
||||||
.nameless = false,
|
.nameless = false,
|
||||||
};
|
};
|
||||||
|
@ -499,8 +499,8 @@ const php_dom_obj_map_handler php_dom_obj_map_notations = {
|
||||||
const php_dom_obj_map_handler php_dom_obj_map_child_elements = {
|
const php_dom_obj_map_handler php_dom_obj_map_child_elements = {
|
||||||
.length = dom_map_get_elements_length,
|
.length = dom_map_get_elements_length,
|
||||||
.get_item = dom_map_get_elements_item,
|
.get_item = dom_map_get_elements_item,
|
||||||
.get_named_item = dom_map_get_named_item_null,
|
.get_ns_named_item = dom_map_get_ns_named_item_null,
|
||||||
.has_named_item = dom_map_has_named_item_null,
|
.has_ns_named_item = dom_map_has_ns_named_item_null,
|
||||||
.use_cache = true,
|
.use_cache = true,
|
||||||
.nameless = true,
|
.nameless = true,
|
||||||
};
|
};
|
||||||
|
@ -508,8 +508,8 @@ const php_dom_obj_map_handler php_dom_obj_map_child_elements = {
|
||||||
const php_dom_obj_map_handler php_dom_obj_map_noop = {
|
const php_dom_obj_map_handler php_dom_obj_map_noop = {
|
||||||
.length = dom_map_get_zero_length,
|
.length = dom_map_get_zero_length,
|
||||||
.get_item = dom_map_get_null_item,
|
.get_item = dom_map_get_null_item,
|
||||||
.get_named_item = dom_map_get_named_item_null,
|
.get_ns_named_item = dom_map_get_ns_named_item_null,
|
||||||
.has_named_item = dom_map_has_named_item_null,
|
.has_ns_named_item = dom_map_has_ns_named_item_null,
|
||||||
.use_cache = false,
|
.use_cache = false,
|
||||||
.nameless = true,
|
.nameless = true,
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,8 +22,8 @@ typedef struct dom_nnodemap_object dom_nnodemap_object;
|
||||||
typedef struct php_dom_obj_map_handler {
|
typedef struct php_dom_obj_map_handler {
|
||||||
zend_long (*length)(dom_nnodemap_object *);
|
zend_long (*length)(dom_nnodemap_object *);
|
||||||
void (*get_item)(dom_nnodemap_object *, zend_long, zval *);
|
void (*get_item)(dom_nnodemap_object *, zend_long, zval *);
|
||||||
xmlNodePtr (*get_named_item)(dom_nnodemap_object *, const zend_string *, const char *);
|
xmlNodePtr (*get_ns_named_item)(dom_nnodemap_object *, const zend_string *, const char *);
|
||||||
bool (*has_named_item)(dom_nnodemap_object *, const zend_string *, const char *);
|
bool (*has_ns_named_item)(dom_nnodemap_object *, const zend_string *, const char *);
|
||||||
bool use_cache;
|
bool use_cache;
|
||||||
bool nameless;
|
bool nameless;
|
||||||
} php_dom_obj_map_handler;
|
} php_dom_obj_map_handler;
|
||||||
|
@ -51,7 +51,7 @@ typedef struct dom_nnodemap_object {
|
||||||
} dom_nnodemap_object;
|
} dom_nnodemap_object;
|
||||||
|
|
||||||
void php_dom_create_obj_map(dom_object *basenode, dom_object *intern, xmlHashTablePtr ht, zend_string *local, zend_string *ns, const php_dom_obj_map_handler *handler);
|
void php_dom_create_obj_map(dom_object *basenode, dom_object *intern, xmlHashTablePtr ht, zend_string *local, zend_string *ns, const php_dom_obj_map_handler *handler);
|
||||||
void php_dom_obj_map_get_named_item_into_zval(dom_nnodemap_object *objmap, const zend_string *named, const char *ns, zval *return_value);
|
void php_dom_obj_map_get_ns_named_item_into_zval(dom_nnodemap_object *objmap, const zend_string *named, const char *ns, zval *return_value);
|
||||||
void php_dom_obj_map_get_item_into_zval(dom_nnodemap_object *objmap, zend_long index, zval *return_value);
|
void php_dom_obj_map_get_item_into_zval(dom_nnodemap_object *objmap, zend_long index, zval *return_value);
|
||||||
zend_long php_dom_get_nodelist_length(dom_object *obj);
|
zend_long php_dom_get_nodelist_length(dom_object *obj);
|
||||||
|
|
||||||
|
|
|
@ -2373,7 +2373,7 @@ static zval *dom_nodemap_read_dimension(zend_object *object, zval *offset, int t
|
||||||
zend_long lval;
|
zend_long lval;
|
||||||
if (dom_nodemap_or_nodelist_process_offset_as_named(offset, &lval)) {
|
if (dom_nodemap_or_nodelist_process_offset_as_named(offset, &lval)) {
|
||||||
/* exceptional case, switch to named lookup */
|
/* exceptional case, switch to named lookup */
|
||||||
php_dom_obj_map_get_named_item_into_zval(php_dom_obj_from_obj(object)->ptr, Z_STR_P(offset), NULL, rv);
|
php_dom_obj_map_get_ns_named_item_into_zval(php_dom_obj_from_obj(object)->ptr, Z_STR_P(offset), NULL, rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2399,7 +2399,7 @@ static int dom_nodemap_has_dimension(zend_object *object, zval *member, int chec
|
||||||
if (dom_nodemap_or_nodelist_process_offset_as_named(member, &offset)) {
|
if (dom_nodemap_or_nodelist_process_offset_as_named(member, &offset)) {
|
||||||
/* exceptional case, switch to named lookup */
|
/* exceptional case, switch to named lookup */
|
||||||
dom_nnodemap_object *map = php_dom_obj_from_obj(object)->ptr;
|
dom_nnodemap_object *map = php_dom_obj_from_obj(object)->ptr;
|
||||||
return map->handler->has_named_item(map, Z_STR_P(member), NULL);
|
return map->handler->has_ns_named_item(map, Z_STR_P(member), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return offset >= 0 && offset < php_dom_get_namednodemap_length(php_dom_obj_from_obj(object));
|
return offset >= 0 && offset < php_dom_get_namednodemap_length(php_dom_obj_from_obj(object));
|
||||||
|
@ -2420,7 +2420,7 @@ static zval *dom_modern_nodemap_read_dimension(zend_object *object, zval *offset
|
||||||
if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), lval)) {
|
if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), lval)) {
|
||||||
map->handler->get_item(map, (zend_long) lval, rv);
|
map->handler->get_item(map, (zend_long) lval, rv);
|
||||||
} else {
|
} else {
|
||||||
php_dom_obj_map_get_named_item_into_zval(map, Z_STR_P(offset), NULL, rv);
|
php_dom_obj_map_get_ns_named_item_into_zval(map, Z_STR_P(offset), NULL, rv);
|
||||||
}
|
}
|
||||||
} else if (Z_TYPE_P(offset) == IS_LONG) {
|
} else if (Z_TYPE_P(offset) == IS_LONG) {
|
||||||
map->handler->get_item(map, Z_LVAL_P(offset), rv);
|
map->handler->get_item(map, Z_LVAL_P(offset), rv);
|
||||||
|
@ -2448,7 +2448,7 @@ static int dom_modern_nodemap_has_dimension(zend_object *object, zval *member, i
|
||||||
if (ZEND_HANDLE_NUMERIC(Z_STR_P(member), lval)) {
|
if (ZEND_HANDLE_NUMERIC(Z_STR_P(member), lval)) {
|
||||||
return (zend_long) lval >= 0 && (zend_long) lval < php_dom_get_namednodemap_length(obj);
|
return (zend_long) lval >= 0 && (zend_long) lval < php_dom_get_namednodemap_length(obj);
|
||||||
} else {
|
} else {
|
||||||
return map->handler->has_named_item(map, Z_STR_P(member), NULL);
|
return map->handler->has_ns_named_item(map, Z_STR_P(member), NULL);
|
||||||
}
|
}
|
||||||
} else if (Z_TYPE_P(member) == IS_LONG) {
|
} else if (Z_TYPE_P(member) == IS_LONG) {
|
||||||
zend_long offset = Z_LVAL_P(member);
|
zend_long offset = Z_LVAL_P(member);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue