Use common helper macro for getting the node in property handlers

This commit is contained in:
Niels Dossche 2024-03-09 18:05:28 +01:00
parent 649394d357
commit 539d8d9259
13 changed files with 123 additions and 458 deletions

View file

@ -22,6 +22,7 @@
#include "php.h"
#if defined(HAVE_LIBXML) && defined(HAVE_DOM)
#include "php_dom.h"
#include "dom_properties.h"
/*
* class DOMNotation extends DOMNode
@ -39,12 +40,7 @@ Since:
*/
zend_result dom_notation_public_id_read(dom_object *obj, zval *retval)
{
xmlEntityPtr nodep = (xmlEntityPtr) dom_object_get_node(obj);
if (nodep == NULL) {
php_dom_throw_error(INVALID_STATE_ERR, true);
return FAILURE;
}
DOM_PROP_NODE(xmlEntityPtr, nodep, obj);
if (nodep->ExternalID) {
ZVAL_STRING(retval, (char *) (nodep->ExternalID));
@ -64,12 +60,7 @@ Since:
*/
zend_result dom_notation_system_id_read(dom_object *obj, zval *retval)
{
xmlEntityPtr nodep = (xmlEntityPtr) dom_object_get_node(obj);
if (nodep == NULL) {
php_dom_throw_error(INVALID_STATE_ERR, true);
return FAILURE;
}
DOM_PROP_NODE(xmlEntityPtr, nodep, obj);
if (nodep->SystemID) {
ZVAL_STRING(retval, (char *) (nodep->SystemID));