From 5602f6421372848a6fbb23fbe6bbca47d94dd49a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 3 Mar 2016 23:13:50 +0100 Subject: [PATCH] Eliminate usages of _PP macros These are either in debug code (fix them), commented out (drop them) or in dead compatibility macros (drop them). One usage was in php_stream_get_from_zval(), which we have not used since at least PHP 5.2 and, judging from the fact that nobody complained about it causing compile errors in PHP 7, nobody else uses it either, so drop it. There are still remaining uses in mysqli embedded and odbc birdstep. These probably need to be dropped outright. --- ext/dba/php_dba.h | 2 -- ext/exif/exif.c | 2 +- ext/mysqlnd/mysqlnd_priv.h | 14 -------------- ext/readline/readline.c | 2 +- ext/soap/php_http.c | 10 ---------- ext/standard/var_unserializer.c | 33 ++++++++++++++++---------------- ext/standard/var_unserializer.re | 4 ++-- main/php_streams.h | 6 ------ sapi/phpdbg/phpdbg_wait.c | 5 ----- 9 files changed, 20 insertions(+), 58 deletions(-) diff --git a/ext/dba/php_dba.h b/ext/dba/php_dba.h index 933e5b5161..a0d291a66d 100644 --- a/ext/dba/php_dba.h +++ b/ext/dba/php_dba.h @@ -129,8 +129,6 @@ typedef struct dba_handler { DBA_SYNC_FUNC(x); \ DBA_INFO_FUNC(x) -#define VALLEN(p) Z_STRVAL_PP(p), Z_STRLEN_PP(p) - PHP_FUNCTION(dba_open); PHP_FUNCTION(dba_popen); PHP_FUNCTION(dba_close); diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 7e001029c9..0f3c889b21 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -4074,7 +4074,7 @@ PHP_FUNCTION(exif_read_data) exif_discard_imageinfo(&ImageInfo); #ifdef EXIF_DEBUG - php_error_docref1(NULL, Z_STRVAL_PP(p_name), E_NOTICE, "done"); + php_error_docref1(NULL, p_name, E_NOTICE, "done"); #endif } /* }}} */ diff --git a/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h index 86baf121fe..0d8908b13c 100644 --- a/ext/mysqlnd/mysqlnd_priv.h +++ b/ext/mysqlnd/mysqlnd_priv.h @@ -23,24 +23,10 @@ #ifndef MYSQLND_PRIV_H #define MYSQLND_PRIV_H -#ifndef Z_ADDREF_P -/* PHP 5.2, old GC */ -#define Z_ADDREF_P(pz) (++(pz)->refcount) -#define Z_DELREF_P(pz) (--(pz)->refcount) -#define Z_REFCOUNT_P(pz) ((pz)->refcount) -#define Z_SET_REFCOUNT_P(pz, rc) ((pz)->refcount = rc) -#define Z_REFCOUNT_PP(ppz) Z_REFCOUNT_P(*(ppz)) -#define Z_DELREF_PP(ppz) Z_DELREF_P(*(ppz)) -#endif - #ifdef ZTS #include "TSRM.h" #endif -#ifndef pestrndup -#define pestrndup(s, length, persistent) ((persistent)?zend_strndup((s),(length)):estrndup((s),(length))) -#endif - #define MYSQLND_STR_W_LEN(str) str, (sizeof(str) - 1) #define MYSQLND_DEBUG_DUMP_TIME 1 diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 1d4427f061..ad9b01a946 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -305,7 +305,7 @@ PHP_FUNCTION(readline_info) oldval = rl_erase_empty_line; if (value) { convert_to_long_ex(value); - rl_erase_empty_line = Z_LVAL_PP(value); + rl_erase_empty_line = Z_LVAL_P(value); } RETVAL_LONG(oldval); #endif diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index a2d0b6207d..7c9183613c 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -700,16 +700,6 @@ try_again: PHP_MD5Update(&md5ctx, (unsigned char*)phpurl->query, strlen(phpurl->query)); } - /* TODO: Support for qop="auth-int" */ -/* - if (zend_hash_find(Z_ARRVAL_PP(digest), "qop", sizeof("qop"), (void **)&tmp) == SUCCESS && - Z_TYPE_PP(tmp) == IS_STRING && - Z_STRLEN_PP(tmp) == sizeof("auth-int")-1 && - stricmp(Z_STRVAL_PP(tmp), "auth-int") == 0) { - PHP_MD5Update(&md5ctx, ":", 1); - PHP_MD5Update(&md5ctx, HEntity, HASHHEXLEN); - } -*/ PHP_MD5Final(hash, &md5ctx); make_digest(HA2, hash); diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index 12a15c3a69..f8c715284f 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.7.5 */ +/* Generated by re2c 0.13.5 */ #line 1 "ext/standard/var_unserializer.re" /* +----------------------------------------------------------------------+ @@ -44,7 +44,7 @@ static inline void var_push(php_unserialize_data_t *var_hashx, zval *rval) { var_entries *var_hash = (*var_hashx)->last; #if VAR_ENTRIES_DBG - fprintf(stderr, "var_push(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval)); + fprintf(stderr, "var_push(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_P(rval)); #endif if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) { @@ -104,7 +104,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nz zend_long i; var_entries *var_hash = (*var_hashx)->first; #if VAR_ENTRIES_DBG - fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval)); + fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_P(nzval)); #endif while (var_hash) { @@ -651,8 +651,7 @@ yy20: if (yybm[0+yych] & 128) { goto yy20; } - if (yych <= '/') goto yy18; - if (yych >= ';') goto yy18; + if (yych != ':') goto yy18; yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; @@ -801,7 +800,7 @@ yy20: return object_common2(UNSERIALIZE_PASSTHRU, elements); } -#line 805 "ext/standard/var_unserializer.c" +#line 804 "ext/standard/var_unserializer.c" yy25: yych = *++YYCURSOR; if (yych <= ',') { @@ -833,7 +832,7 @@ yy27: return object_common2(UNSERIALIZE_PASSTHRU, object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR)); } -#line 837 "ext/standard/var_unserializer.c" +#line 836 "ext/standard/var_unserializer.c" yy32: yych = *++YYCURSOR; if (yych == '+') goto yy33; @@ -878,7 +877,7 @@ yy34: return finish_nested_data(UNSERIALIZE_PASSTHRU); } -#line 882 "ext/standard/var_unserializer.c" +#line 881 "ext/standard/var_unserializer.c" yy39: yych = *++YYCURSOR; if (yych == '+') goto yy40; @@ -927,7 +926,7 @@ yy41: ZVAL_STR(rval, str); return 1; } -#line 931 "ext/standard/var_unserializer.c" +#line 930 "ext/standard/var_unserializer.c" yy46: yych = *++YYCURSOR; if (yych == '+') goto yy47; @@ -975,7 +974,7 @@ yy48: ZVAL_STRINGL(rval, str, len); return 1; } -#line 979 "ext/standard/var_unserializer.c" +#line 978 "ext/standard/var_unserializer.c" yy53: yych = *++YYCURSOR; if (yych <= '/') { @@ -1072,7 +1071,7 @@ use_double: ZVAL_DOUBLE(rval, zend_strtod((const char *)start + 2, NULL)); return 1; } -#line 1076 "ext/standard/var_unserializer.c" +#line 1075 "ext/standard/var_unserializer.c" yy65: yych = *++YYCURSOR; if (yych <= ',') { @@ -1147,7 +1146,7 @@ yy73: return 1; } -#line 1151 "ext/standard/var_unserializer.c" +#line 1150 "ext/standard/var_unserializer.c" yy76: yych = *++YYCURSOR; if (yych == 'N') goto yy73; @@ -1200,7 +1199,7 @@ yy79: ZVAL_LONG(rval, parse_iv(start + 2)); return 1; } -#line 1204 "ext/standard/var_unserializer.c" +#line 1203 "ext/standard/var_unserializer.c" yy83: yych = *++YYCURSOR; if (yych <= '/') goto yy18; @@ -1214,7 +1213,7 @@ yy83: ZVAL_BOOL(rval, parse_iv(start + 2)); return 1; } -#line 1218 "ext/standard/var_unserializer.c" +#line 1217 "ext/standard/var_unserializer.c" yy87: ++YYCURSOR; #line 573 "ext/standard/var_unserializer.re" @@ -1223,7 +1222,7 @@ yy87: ZVAL_NULL(rval); return 1; } -#line 1227 "ext/standard/var_unserializer.c" +#line 1226 "ext/standard/var_unserializer.c" yy89: yych = *++YYCURSOR; if (yych <= ',') { @@ -1271,7 +1270,7 @@ yy91: return 1; } -#line 1275 "ext/standard/var_unserializer.c" +#line 1274 "ext/standard/var_unserializer.c" yy95: yych = *++YYCURSOR; if (yych <= ',') { @@ -1320,7 +1319,7 @@ yy97: return 1; } -#line 1324 "ext/standard/var_unserializer.c" +#line 1323 "ext/standard/var_unserializer.c" } #line 875 "ext/standard/var_unserializer.re" diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index e4db9090b9..762bed507f 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -42,7 +42,7 @@ static inline void var_push(php_unserialize_data_t *var_hashx, zval *rval) { var_entries *var_hash = (*var_hashx)->last; #if VAR_ENTRIES_DBG - fprintf(stderr, "var_push(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval)); + fprintf(stderr, "var_push(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_P(rval)); #endif if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) { @@ -102,7 +102,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nz zend_long i; var_entries *var_hash = (*var_hashx)->first; #if VAR_ENTRIES_DBG - fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval)); + fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_P(nzval)); #endif while (var_hash) { diff --git a/main/php_streams.h b/main/php_streams.h index de7c280050..cd5319ca22 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -568,12 +568,6 @@ PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf); #define php_stream_open_wrapper(path, mode, options, opened) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_CC) #define php_stream_open_wrapper_ex(path, mode, options, opened, context) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) STREAMS_CC) -#define php_stream_get_from_zval(stream, zstream, mode, options, opened, context) \ - if (Z_TYPE_PP((zstream)) == IS_RESOURCE) { \ - php_stream_from_zval((stream), (zstream)); \ - } else (stream) = Z_TYPE_PP((zstream)) == IS_STRING ? \ - php_stream_open_wrapper_ex(Z_STRVAL_PP((zstream)), (mode), (options), (opened), (context)) : NULL - /* pushes an error message onto the stack for a wrapper instance */ PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); diff --git a/sapi/phpdbg/phpdbg_wait.c b/sapi/phpdbg/phpdbg_wait.c index 7972d5ec96..c7dcd4fbd4 100644 --- a/sapi/phpdbg/phpdbg_wait.c +++ b/sapi/phpdbg/phpdbg_wait.c @@ -281,11 +281,6 @@ void phpdbg_webdata_decompress(char *msg, int len) { pefree(elm, zend_extensions.persistent); zend_extensions.count--; } else { -/* zend_hash_get_current_key_zval_ex(Z_ARRVAL_PP(zvpp), &key, &hpos); - if (Z_TYPE(key) == IS_LONG) { - zend_hash_index_del(Z_ARRVAL_PP(zvpp), Z_LVAL(key)); - } -*/ zend_hash_del(Z_ARRVAL_P(zvp), strkey); } } -- 2.40.0