mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Use common helper macro for getting the node in property handlers
This commit is contained in:
parent
649394d357
commit
539d8d9259
13 changed files with 123 additions and 458 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "php.h"
|
||||
#if defined(HAVE_LIBXML) && defined(HAVE_DOM)
|
||||
#include "php_dom.h"
|
||||
#include "dom_properties.h"
|
||||
|
||||
/*
|
||||
* class DOMProcessingInstruction extends DOMNode
|
||||
|
@ -72,15 +73,8 @@ Since:
|
|||
*/
|
||||
zend_result dom_processinginstruction_target_read(dom_object *obj, zval *retval)
|
||||
{
|
||||
xmlNodePtr nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, true);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ZVAL_STRING(retval, (char *) (nodep->name));
|
||||
|
||||
DOM_PROP_NODE(xmlNodePtr, nodep, obj);
|
||||
ZVAL_STRING(retval, (const char *) nodep->name);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -93,26 +87,14 @@ Since:
|
|||
*/
|
||||
zend_result dom_processinginstruction_data_read(dom_object *obj, zval *retval)
|
||||
{
|
||||
xmlNodePtr nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, true);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
DOM_PROP_NODE(xmlNodePtr, nodep, obj);
|
||||
php_dom_get_content_into_zval(nodep, retval, false);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
zend_result dom_processinginstruction_data_write(dom_object *obj, zval *newval)
|
||||
{
|
||||
xmlNode *nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, true);
|
||||
return FAILURE;
|
||||
}
|
||||
DOM_PROP_NODE(xmlNodePtr, nodep, obj);
|
||||
|
||||
/* Typed property, this is already a string */
|
||||
ZEND_ASSERT(Z_TYPE_P(newval) == IS_STRING);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue