]> granicus.if.org Git - php/commitdiff
Remove DOM_GET_THIS macro
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 9 Mar 2020 08:55:56 +0000 (09:55 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 9 Mar 2020 08:56:22 +0000 (09:56 +0100)
This macro is trivial, it's more obvious to use ZEND_THIS directly.

ext/dom/xml_common.h
ext/dom/xpath.c
ext/xsl/xsltprocessor.c

index d239b85b638df503a08f674faf87a327991e538e..40548c2d1a89487edfa1338273124fa6d154c600 100644 (file)
@@ -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
index d3960c5790d9970a5b789241aae56cf54fcb436d..718b433b409218485b8f322d7bbb320a91d833f1 100644 (file)
@@ -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) {
index c64fd668a1f10680e00d715d7db431f3af08518c..d17d0c92f681f60c03079eb1718b22ecef6b4d56 100644 (file)
@@ -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);