From: Nikita Popov Date: Mon, 9 Mar 2020 08:55:56 +0000 (+0100) Subject: Remove DOM_GET_THIS macro X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c5f091e47f8e958715adc9fcb791f3a15e3932c6;p=php Remove DOM_GET_THIS macro This macro is trivial, it's more obvious to use ZEND_THIS directly. --- diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h index d239b85b63..40548c2d1a 100644 --- a/ext/dom/xml_common.h +++ b/ext/dom/xml_common.h @@ -81,11 +81,8 @@ PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj); #define DOM_RET_OBJ(obj, ret, domobject) \ *ret = php_dom_create_object(obj, return_value, domobject) -#define DOM_GET_THIS(zval) \ - do { zval = ZEND_THIS; } while (0) - #define DOM_GET_THIS_OBJ(__ptr, __id, __prtype, __intern) \ - DOM_GET_THIS(__id); \ + __id = ZEND_THIS; \ DOM_GET_OBJ(__ptr, __id, __prtype, __intern); #endif diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index d3960c5790..718b433b40 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -503,13 +503,11 @@ PHP_METHOD(domxpath, evaluate) /* {{{ proto void dom_xpath_register_php_functions() */ PHP_METHOD(domxpath, registerPhpFunctions) { - zval *id; + zval *id = ZEND_THIS; dom_xpath_object *intern; zval *array_value, *entry, new_string; zend_string *name; - DOM_GET_THIS(id); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "a", &array_value) == SUCCESS) { intern = Z_XPATHOBJ_P(id); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(array_value), entry) { diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index c64fd668a1..d17d0c92f6 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -745,13 +745,12 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_xml) PHP_FUNCTION(xsl_xsltprocessor_set_parameter) { - zval *id; + zval *id = ZEND_THIS; zval *array_value, *entry, new_string; xsl_object *intern; char *namespace; size_t namespace_len; zend_string *string_key, *name, *value; - DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "sa", &namespace, &namespace_len, &array_value) == SUCCESS) { intern = Z_XSL_P(id); @@ -790,15 +789,13 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter) */ PHP_FUNCTION(xsl_xsltprocessor_get_parameter) { - zval *id; + zval *id = ZEND_THIS; char *namespace; size_t namespace_len = 0; zval *value; zend_string *name; xsl_object *intern; - DOM_GET_THIS(id); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "sS", &namespace, &namespace_len, &name) == FAILURE) { RETURN_THROWS(); } @@ -815,14 +812,12 @@ PHP_FUNCTION(xsl_xsltprocessor_get_parameter) */ PHP_FUNCTION(xsl_xsltprocessor_remove_parameter) { - zval *id; + zval *id = ZEND_THIS; size_t namespace_len = 0; char *namespace; zend_string *name; xsl_object *intern; - DOM_GET_THIS(id); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "sS", &namespace, &namespace_len, &name) == FAILURE) { RETURN_THROWS(); } @@ -839,13 +834,11 @@ PHP_FUNCTION(xsl_xsltprocessor_remove_parameter) */ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions) { - zval *id; + zval *id = ZEND_THIS; xsl_object *intern; zval *array_value, *entry, new_string; zend_string *name; - DOM_GET_THIS(id); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "a", &array_value) == SUCCESS) { intern = Z_XSL_P(id); @@ -878,11 +871,10 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions) /* {{{ proto bool xsl_xsltprocessor_set_profiling(string filename) */ PHP_FUNCTION(xsl_xsltprocessor_set_profiling) { - zval *id; + zval *id = ZEND_THIS; xsl_object *intern; char *filename = NULL; size_t filename_len; - DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "p!", &filename, &filename_len) == SUCCESS) { intern = Z_XSL_P(id); @@ -904,11 +896,10 @@ PHP_FUNCTION(xsl_xsltprocessor_set_profiling) /* {{{ proto int xsl_xsltprocessor_set_security_prefs(int securityPrefs) */ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs) { - zval *id; + zval *id = ZEND_THIS; xsl_object *intern; zend_long securityPrefs, oldSecurityPrefs; - DOM_GET_THIS(id); if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &securityPrefs) == FAILURE) { RETURN_THROWS(); } @@ -924,10 +915,9 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs) /* {{{ proto int xsl_xsltprocessor_get_security_prefs() */ PHP_FUNCTION(xsl_xsltprocessor_get_security_prefs) { - zval *id; + zval *id = ZEND_THIS; xsl_object *intern; - DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "") == SUCCESS) { intern = Z_XSL_P(id); RETURN_LONG(intern->securityPrefs);