cvs: php4 /ext/domxml php_domxml.c

From: Date: Wed, 14 Aug 2002 16:53:57 +0000
Subject: cvs: php4 /ext/domxml php_domxml.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13361@lists.php.net to get a copy of this message
chregu Wed Aug 14 12:53:57 2002 EDT Modified files: /php4/ext/domxml php_domxml.c Log: DomNode->replace_node moves instead of copies node. Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.190 php4/ext/domxml/php_domxml.c:1.191 --- php4/ext/domxml/php_domxml.c:1.190 Wed Aug 14 12:12:18 2002 +++ php4/ext/domxml/php_domxml.c Wed Aug 14 12:53:56 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_domxml.c,v 1.190 2002/08/14 16:12:18 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.191 2002/08/14 16:53:56 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -2320,7 +2320,7 @@ PHP_FUNCTION(domxml_node_replace_node) { zval *id, *rv = NULL, *node; - xmlNodePtr repnode, nodep, new_repnode; + xmlNodePtr repnode, nodep, old_repnode; int ret; DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep); @@ -2331,23 +2331,9 @@ DOMXML_GET_OBJ(repnode, node, le_domxmlnodep); - /* check if the new node is already part of the document. In such a case - * we better make a copy to prevent changing identical nodes at different - * positions in the document at the same time. - * A node created with e.g. create_element() doesn't have parents. - */ - if(repnode->parent) { - if (NULL == (new_repnode = xmlCopyNode(repnode, 1))) { - php_error(E_WARNING, "%s(): unable to clone node", get_active_function_name(TSRMLS_C)); - RETURN_FALSE; - } - } else { - new_repnode = repnode; - } - - repnode = xmlReplaceNode(nodep, new_repnode); + old_repnode = xmlReplaceNode(nodep, repnode); - DOMXML_RET_OBJ(rv, nodep, &ret); + DOMXML_RET_OBJ(rv, old_repnode, &ret); } /* }}} */

« previous php.cvs (#13361) next »