summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/dom/node.c25
-rw-r--r--ext/dom/php_dom.c2
-rw-r--r--ext/dom/xml_common.h6
3 files changed, 15 insertions, 18 deletions
diff --git a/ext/dom/node.c b/ext/dom/node.c
index 839c797..38a2620 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -998,7 +998,7 @@ Since:
*/
PHP_FUNCTION(dom_node_insert_before)
{
- zval *id, *node, *ref = NULL, *rv = NULL;
+ zval *id, *node, *ref = NULL;
xmlNodePtr child, new_child, parentp, refp;
dom_object *intern, *childobj, *refpobj;
int ret, stricterror;
@@ -1087,7 +1087,7 @@ PHP_FUNCTION(dom_node_insert_before)
xmlUnlinkNode((xmlNodePtr) lastattr);
php_libxml_node_free_resource((xmlNodePtr) lastattr TSRMLS_CC);
} else {
- DOM_RET_OBJ(rv, child, &ret, intern);
+ DOM_RET_OBJ_EX(child, &ret, intern);
return;
}
}
@@ -1129,7 +1129,7 @@ PHP_FUNCTION(dom_node_insert_before)
xmlUnlinkNode((xmlNodePtr) lastattr);
php_libxml_node_free_resource((xmlNodePtr) lastattr TSRMLS_CC);
} else {
- DOM_RET_OBJ(rv, child, &ret, intern);
+ DOM_RET_OBJ_EX(child, &ret, intern);
return;
}
}
@@ -1148,7 +1148,7 @@ PHP_FUNCTION(dom_node_insert_before)
dom_reconcile_ns(parentp->doc, new_child);
- DOM_RET_OBJ(rv, new_child, &ret, intern);
+ DOM_RET_OBJ_EX(new_child, &ret, intern);
}
/* }}} end dom_node_insert_before */
@@ -1212,9 +1212,6 @@ PHP_FUNCTION(dom_node_replace_child)
}
if (foundoldchild) {
- xmlNodePtr node;
- zval *rv = NULL;
-
if (newchild->type == XML_DOCUMENT_FRAG_NODE) {
xmlNodePtr prevsib, nextsib;
prevsib = oldchild->prev;
@@ -1232,10 +1229,10 @@ PHP_FUNCTION(dom_node_replace_child)
newchildobj->document = intern->document;
php_libxml_increment_doc_ref((php_libxml_node_object *)newchildobj, NULL TSRMLS_CC);
}
- node = xmlReplaceNode(oldchild, newchild);
+ xmlReplaceNode(oldchild, newchild);
dom_reconcile_ns(nodep->doc, newchild);
}
- DOM_RET_OBJ(rv, oldchild, &ret, intern);
+ DOM_RET_OBJ_EX(oldchild, &ret, intern);
return;
} else {
php_dom_throw_error(NOT_FOUND_ERR, dom_get_strict_error(intern->document) TSRMLS_CC);
@@ -1283,9 +1280,8 @@ PHP_FUNCTION(dom_node_remove_child)
while (children) {
if (children == child) {
- zval *rv = NULL;
xmlUnlinkNode(child);
- DOM_RET_OBJ(rv, child, &ret, intern);
+ DOM_RET_OBJ_EX(child, &ret, intern);
return;
}
children = children->next;
@@ -1302,7 +1298,7 @@ Since:
*/
PHP_FUNCTION(dom_node_append_child)
{
- zval *id, *node, *rv = NULL;
+ zval *id, *node;
xmlNodePtr child, nodep, new_child = NULL;
dom_object *intern, *childobj;
int ret, stricterror;
@@ -1393,7 +1389,7 @@ PHP_FUNCTION(dom_node_append_child)
dom_reconcile_ns(nodep->doc, new_child);
- DOM_RET_OBJ(rv, new_child, &ret, intern);
+ DOM_RET_OBJ_EX(new_child, &ret, intern);
}
/* }}} end dom_node_append_child */
@@ -1431,7 +1427,6 @@ Since:
*/
PHP_FUNCTION(dom_node_clone_node)
{
- zval *rv = NULL;
zval *id;
xmlNode *n, *node;
int ret;
@@ -1483,7 +1478,7 @@ PHP_FUNCTION(dom_node_clone_node)
intern = NULL;
}
- DOM_RET_OBJ(rv, node, &ret, intern);
+ DOM_RET_OBJ_EX(node, &ret, intern);
}
/* }}} end dom_node_clone_node */
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index cf9b79b..f8ee426 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -212,7 +212,7 @@ int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece,
zend_hash_init(doc_props->classmap, 0, NULL, NULL, 0);
}
if (ce) {
- return zend_hash_update(doc_props->classmap, basece->name, basece->name_length + 1, &ce, sizeof(ce), NULL);
+ return zend_hash_update(doc_props->classmap, basece->name, basece->name_length + 1, &ce, sizeof(zend_class_entry *), NULL);
} else {
zend_hash_del(doc_props->classmap, basece->name, basece->name_length + 1);
}
diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h
index 075d9ff..5699842 100644
--- a/ext/dom/xml_common.h
+++ b/ext/dom/xml_common.h
@@ -78,12 +78,14 @@ PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj);
} \
}
-#define DOM_RET_OBJ(zval, obj, ret, domobject) \
- if (NULL == (zval = php_dom_create_object(obj, ret, zval, return_value, domobject TSRMLS_CC))) { \
+#define DOM_RET_OBJ_EX(obj, ret, domobject) \
+ if (!php_dom_create_object(obj, ret, NULL, return_value, domobject TSRMLS_CC)) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object"); \
RETURN_FALSE; \
}
+#define DOM_RET_OBJ(zval, obj, ret, domobject) DOM_RET_OBJ_EX(obj, ret, domobject)
+
#define DOM_GET_THIS(zval) \
if (NULL == (zval = getThis())) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing"); \