mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Remove duplicated code for entity vs notation handling
This commit is contained in:
parent
fa4d8cd4fa
commit
fc9b58f602
4 changed files with 14 additions and 30 deletions
|
@ -62,7 +62,7 @@ xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index) /* {{{ */
|
||||
static xmlNode *php_dom_libxml_hash_iter_ex(xmlHashTable *ht, int index)
|
||||
{
|
||||
int htsize;
|
||||
|
||||
|
@ -77,17 +77,18 @@ xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index) /* {{{ */
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index) /* {{{ */
|
||||
xmlNode *php_dom_libxml_hash_iter(dom_nnodemap_object *objmap, int index)
|
||||
{
|
||||
xmlNotation *notation = (xmlNotation *) php_dom_libxml_hash_iter(ht, index);
|
||||
if (notation != NULL) {
|
||||
return create_notation(notation->name, notation->PublicID, notation->SystemID);
|
||||
xmlNode *curnode = php_dom_libxml_hash_iter_ex(objmap->ht, index);
|
||||
|
||||
if (curnode != NULL && objmap->nodetype != XML_ENTITY_NODE) {
|
||||
xmlNotation *notation = (xmlNotation *) curnode;
|
||||
curnode = create_notation(notation->name, notation->PublicID, notation->SystemID);
|
||||
}
|
||||
return NULL;
|
||||
|
||||
return curnode;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void php_dom_iterator_dtor(zend_object_iterator *iter) /* {{{ */
|
||||
{
|
||||
|
@ -194,11 +195,7 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter) /* {{{ */
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (objmap->nodetype == XML_ENTITY_NODE) {
|
||||
curnode = php_dom_libxml_hash_iter(objmap->ht, iter->index);
|
||||
} else {
|
||||
curnode = php_dom_libxml_notation_iter(objmap->ht, iter->index);
|
||||
}
|
||||
curnode = php_dom_libxml_hash_iter(objmap, iter->index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,11 +276,7 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, i
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (objmap->nodetype == XML_ENTITY_NODE) {
|
||||
curnode = php_dom_libxml_hash_iter(objmap->ht, 0);
|
||||
} else {
|
||||
curnode = php_dom_libxml_notation_iter(objmap->ht, 0);
|
||||
}
|
||||
curnode = php_dom_libxml_hash_iter(objmap, 0);
|
||||
}
|
||||
}
|
||||
err:
|
||||
|
|
|
@ -139,11 +139,7 @@ xmlNodePtr php_dom_named_node_map_get_item(dom_nnodemap_object *objmap, zend_lon
|
|||
if ((objmap->nodetype == XML_NOTATION_NODE) ||
|
||||
objmap->nodetype == XML_ENTITY_NODE) {
|
||||
if (objmap->ht) {
|
||||
if (objmap->nodetype == XML_ENTITY_NODE) {
|
||||
itemnode = php_dom_libxml_hash_iter(objmap->ht, index);
|
||||
} else {
|
||||
itemnode = php_dom_libxml_notation_iter(objmap->ht, index);
|
||||
}
|
||||
itemnode = php_dom_libxml_hash_iter(objmap, index);
|
||||
}
|
||||
} else {
|
||||
xmlNodePtr nodep = dom_object_get_node(objmap->baseobj);
|
||||
|
|
|
@ -142,11 +142,7 @@ void php_dom_nodelist_get_item_into_zval(dom_nnodemap_object *objmap, zend_long
|
|||
if (index >= 0) {
|
||||
if (objmap != NULL) {
|
||||
if (objmap->ht) {
|
||||
if (objmap->nodetype == XML_ENTITY_NODE) {
|
||||
itemnode = php_dom_libxml_hash_iter(objmap->ht, index);
|
||||
} else {
|
||||
itemnode = php_dom_libxml_notation_iter(objmap->ht, index);
|
||||
}
|
||||
itemnode = php_dom_libxml_hash_iter(objmap, index);
|
||||
} else {
|
||||
if (objmap->nodetype == DOM_NODESET) {
|
||||
HashTable *nodeht = HASH_OF(&objmap->baseobj_zv);
|
||||
|
|
|
@ -151,8 +151,7 @@ bool dom_node_children_valid(xmlNodePtr node);
|
|||
void php_dom_create_iterator(zval *return_value, dom_iterator_type iterator_type, bool modern);
|
||||
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, const char *local, size_t local_len, const char *ns, size_t ns_len);
|
||||
xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID);
|
||||
xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
|
||||
xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
|
||||
xmlNode *php_dom_libxml_hash_iter(dom_nnodemap_object *objmap, 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);
|
||||
xmlNodePtr php_dom_create_fake_namespace_decl(xmlNodePtr nodep, xmlNsPtr original, zval *return_value, dom_object *parent_intern);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue