Skip to content

Commit e34a1f9

Browse files
committed
Convert zend_parse_parameters_none() to fast ZPP in standard lib
Closes phpGH-5037
1 parent e57b2b9 commit e34a1f9

File tree

15 files changed

+36
-97
lines changed

15 files changed

+36
-97
lines changed

ext/standard/basic_functions.c

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,9 +1924,7 @@ PHP_FUNCTION(getopt)
19241924
Flush the output buffer */
19251925
PHP_FUNCTION(flush)
19261926
{
1927-
if (zend_parse_parameters_none() == FAILURE) {
1928-
return;
1929-
}
1927+
ZEND_PARSE_PARAMETERS_NONE();
19301928

19311929
sapi_flush();
19321930
}
@@ -2063,9 +2061,7 @@ PHP_FUNCTION(time_sleep_until)
20632061
Get the name of the owner of the current PHP script */
20642062
PHP_FUNCTION(get_current_user)
20652063
{
2066-
if (zend_parse_parameters_none() == FAILURE) {
2067-
return;
2068-
}
2064+
ZEND_PARSE_PARAMETERS_NONE();
20692065

20702066
RETURN_STRING(php_get_current_user());
20712067
}
@@ -2243,9 +2239,7 @@ PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, cha
22432239
Get the last occurred error as associative array. Returns NULL if there hasn't been an error yet. */
22442240
PHP_FUNCTION(error_get_last)
22452241
{
2246-
if (zend_parse_parameters_none() == FAILURE) {
2247-
return;
2248-
}
2242+
ZEND_PARSE_PARAMETERS_NONE();
22492243

22502244
if (PG(last_error_message)) {
22512245
array_init(return_value);
@@ -2261,9 +2255,7 @@ PHP_FUNCTION(error_get_last)
22612255
Clear the last occurred error. */
22622256
PHP_FUNCTION(error_clear_last)
22632257
{
2264-
if (zend_parse_parameters_none() == FAILURE) {
2265-
return;
2266-
}
2258+
ZEND_PARSE_PARAMETERS_NONE();
22672259

22682260
if (PG(last_error_message)) {
22692261
PG(last_error_type) = 0;
@@ -2977,9 +2969,7 @@ PHP_FUNCTION(get_include_path)
29772969
{
29782970
char *str;
29792971

2980-
if (zend_parse_parameters_none() == FAILURE) {
2981-
return;
2982-
}
2972+
ZEND_PARSE_PARAMETERS_NONE();
29832973

29842974
str = zend_ini_string("include_path", sizeof("include_path") - 1, 0);
29852975

@@ -2997,9 +2987,8 @@ PHP_FUNCTION(restore_include_path)
29972987
{
29982988
zend_string *key;
29992989

3000-
if (zend_parse_parameters_none() == FAILURE) {
3001-
return;
3002-
}
2990+
ZEND_PARSE_PARAMETERS_NONE();
2991+
30032992
key = zend_string_init("include_path", sizeof("include_path")-1, 0);
30042993
zend_restore_ini_entry(key, PHP_INI_STAGE_RUNTIME);
30052994
zend_string_efree(key);
@@ -3032,9 +3021,7 @@ PHP_FUNCTION(print_r)
30323021
Returns true if client disconnected */
30333022
PHP_FUNCTION(connection_aborted)
30343023
{
3035-
if (zend_parse_parameters_none() == FAILURE) {
3036-
return;
3037-
}
3024+
ZEND_PARSE_PARAMETERS_NONE();
30383025

30393026
RETURN_LONG(PG(connection_status) & PHP_CONNECTION_ABORTED);
30403027
}
@@ -3044,9 +3031,7 @@ PHP_FUNCTION(connection_aborted)
30443031
Returns the connection status bitfield */
30453032
PHP_FUNCTION(connection_status)
30463033
{
3047-
if (zend_parse_parameters_none() == FAILURE) {
3048-
return;
3049-
}
3034+
ZEND_PARSE_PARAMETERS_NONE();
30503035

30513036
RETURN_LONG(PG(connection_status));
30523037
}
@@ -3536,9 +3521,7 @@ PHP_FUNCTION(sys_getloadavg)
35363521
{
35373522
double load[3];
35383523

3539-
if (zend_parse_parameters_none() == FAILURE) {
3540-
return;
3541-
}
3524+
ZEND_PARSE_PARAMETERS_NONE();
35423525

35433526
if (getloadavg(load, 3) == -1) {
35443527
RETURN_FALSE;

ext/standard/dir.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,7 @@ PHP_FUNCTION(getcwd)
347347
char path[MAXPATHLEN];
348348
char *ret=NULL;
349349

350-
if (zend_parse_parameters_none() == FAILURE) {
351-
return;
352-
}
350+
ZEND_PARSE_PARAMETERS_NONE();
353351

354352
#if HAVE_GETCWD
355353
ret = VCWD_GETCWD(path, MAXPATHLEN);

ext/standard/dns.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ PHP_FUNCTION(gethostname)
124124
{
125125
char buf[HOST_NAME_MAX + 1];
126126

127-
if (zend_parse_parameters_none() == FAILURE) {
128-
return;
129-
}
127+
ZEND_PARSE_PARAMETERS_NONE();
130128

131129
if (gethostname(buf, sizeof(buf))) {
132130
php_error_docref(NULL, E_WARNING, "unable to fetch host [%d]: %s", errno, strerror(errno));

ext/standard/file.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -854,9 +854,7 @@ PHP_NAMED_FUNCTION(php_if_tmpfile)
854854
{
855855
php_stream *stream;
856856

857-
if (zend_parse_parameters_none() == FAILURE) {
858-
return;
859-
}
857+
ZEND_PARSE_PARAMETERS_NONE();
860858

861859
stream = php_stream_fopen_tmpfile();
862860

@@ -2467,9 +2465,8 @@ PHP_FUNCTION(fnmatch)
24672465
Returns directory path used for temporary files */
24682466
PHP_FUNCTION(sys_get_temp_dir)
24692467
{
2470-
if (zend_parse_parameters_none() == FAILURE) {
2471-
return;
2472-
}
2468+
ZEND_PARSE_PARAMETERS_NONE();
2469+
24732470
RETURN_STRING((char *)php_get_temporary_directory());
24742471
}
24752472
/* }}} */

ext/standard/filestat.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,9 +1086,8 @@ FileFunction(php_if_stat, FS_STAT)
10861086
Get current size of realpath cache */
10871087
PHP_FUNCTION(realpath_cache_size)
10881088
{
1089-
if (zend_parse_parameters_none() == FAILURE) {
1090-
return;
1091-
}
1089+
ZEND_PARSE_PARAMETERS_NONE();
1090+
10921091
RETURN_LONG(realpath_cache_size());
10931092
}
10941093

@@ -1098,9 +1097,7 @@ PHP_FUNCTION(realpath_cache_get)
10981097
{
10991098
realpath_cache_bucket **buckets = realpath_cache_get_buckets(), **end = buckets + realpath_cache_max_buckets();
11001099

1101-
if (zend_parse_parameters_none() == FAILURE) {
1102-
return;
1103-
}
1100+
ZEND_PARSE_PARAMETERS_NONE();
11041101

11051102
array_init(return_value);
11061103
while(buckets < end) {

ext/standard/head.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,7 @@ static void php_head_apply_header_list_to_hash(void *data, void *arg)
388388
Return list of headers to be sent / already sent */
389389
PHP_FUNCTION(headers_list)
390390
{
391-
if (zend_parse_parameters_none() == FAILURE) {
392-
return;
393-
}
391+
ZEND_PARSE_PARAMETERS_NONE();
394392

395393
array_init(return_value);
396394
zend_llist_apply_with_argument(&SG(sapi_headers).headers, php_head_apply_header_list_to_hash, return_value);

ext/standard/info.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,9 +1309,7 @@ PHP_FUNCTION(phpcredits)
13091309
Return the current SAPI module name */
13101310
PHP_FUNCTION(php_sapi_name)
13111311
{
1312-
if (zend_parse_parameters_none() == FAILURE) {
1313-
return;
1314-
}
1312+
ZEND_PARSE_PARAMETERS_NONE();
13151313

13161314
if (sapi_module.name) {
13171315
RETURN_STRING(sapi_module.name);
@@ -1343,9 +1341,7 @@ PHP_FUNCTION(php_uname)
13431341
Return comma-separated string of .ini files parsed from the additional ini dir */
13441342
PHP_FUNCTION(php_ini_scanned_files)
13451343
{
1346-
if (zend_parse_parameters_none() == FAILURE) {
1347-
return;
1348-
}
1344+
ZEND_PARSE_PARAMETERS_NONE();
13491345

13501346
if (php_ini_scanned_files) {
13511347
RETURN_STRING(php_ini_scanned_files);
@@ -1359,9 +1355,7 @@ PHP_FUNCTION(php_ini_scanned_files)
13591355
Return the actual loaded ini filename */
13601356
PHP_FUNCTION(php_ini_loaded_file)
13611357
{
1362-
if (zend_parse_parameters_none() == FAILURE) {
1363-
return;
1364-
}
1358+
ZEND_PARSE_PARAMETERS_NONE();
13651359

13661360
if (php_ini_opened_path) {
13671361
RETURN_STRING(php_ini_opened_path);

ext/standard/lcg.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,8 @@ PHP_MINIT_FUNCTION(lcg) /* {{{ */
114114
Returns a value from the combined linear congruential generator */
115115
PHP_FUNCTION(lcg_value)
116116
{
117-
if (zend_parse_parameters_none() == FAILURE) {
118-
return;
119-
}
117+
ZEND_PARSE_PARAMETERS_NONE();
118+
120119
RETURN_DOUBLE(php_combined_lcg());
121120
}
122121
/* }}} */

ext/standard/math.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,7 @@ PHP_FUNCTION(atanh)
490490
Returns an approximation of pi */
491491
PHP_FUNCTION(pi)
492492
{
493-
if (zend_parse_parameters_none() == FAILURE) {
494-
return;
495-
}
493+
ZEND_PARSE_PARAMETERS_NONE();
496494

497495
RETURN_DOUBLE(M_PI);
498496
}

ext/standard/mt_rand.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,7 @@ PHP_FUNCTION(mt_rand)
337337
Returns the maximum value a random number from Mersenne Twister can have */
338338
PHP_FUNCTION(mt_getrandmax)
339339
{
340-
if (zend_parse_parameters_none() == FAILURE) {
341-
return;
342-
}
340+
ZEND_PARSE_PARAMETERS_NONE();
343341

344342
/*
345343
* Melo: it could be 2^^32 but we only use 2^^31 to maintain

ext/standard/pageinfo.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ PHP_FUNCTION(getmyuid)
9494
{
9595
zend_long uid;
9696

97-
if (zend_parse_parameters_none() == FAILURE) {
98-
return;
99-
}
97+
ZEND_PARSE_PARAMETERS_NONE();
10098

10199
uid = php_getuid();
102100
if (uid < 0) {
@@ -113,9 +111,7 @@ PHP_FUNCTION(getmygid)
113111
{
114112
zend_long gid;
115113

116-
if (zend_parse_parameters_none() == FAILURE) {
117-
return;
118-
}
114+
ZEND_PARSE_PARAMETERS_NONE();
119115

120116
gid = php_getgid();
121117
if (gid < 0) {
@@ -132,9 +128,7 @@ PHP_FUNCTION(getmypid)
132128
{
133129
zend_long pid;
134130

135-
if (zend_parse_parameters_none() == FAILURE) {
136-
return;
137-
}
131+
ZEND_PARSE_PARAMETERS_NONE();
138132

139133
pid = getpid();
140134
if (pid < 0) {
@@ -149,9 +143,7 @@ PHP_FUNCTION(getmypid)
149143
Get the inode of the current script being parsed */
150144
PHP_FUNCTION(getmyinode)
151145
{
152-
if (zend_parse_parameters_none() == FAILURE) {
153-
return;
154-
}
146+
ZEND_PARSE_PARAMETERS_NONE();
155147

156148
php_statpage();
157149
if (BG(page_inode) < 0) {
@@ -174,9 +166,7 @@ PHP_FUNCTION(getlastmod)
174166
{
175167
zend_long lm;
176168

177-
if (zend_parse_parameters_none() == FAILURE) {
178-
return;
179-
}
169+
ZEND_PARSE_PARAMETERS_NONE();
180170

181171
lm = php_getlastmod();
182172
if (lm < 0) {

ext/standard/streamsfuncs.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,7 @@ PHP_FUNCTION(stream_get_transports)
557557
HashTable *stream_xport_hash;
558558
zend_string *stream_xport;
559559

560-
if (zend_parse_parameters_none() == FAILURE) {
561-
return;
562-
}
560+
ZEND_PARSE_PARAMETERS_NONE();
563561

564562
if ((stream_xport_hash = php_stream_xport_get_hash())) {
565563
array_init(return_value);
@@ -579,9 +577,7 @@ PHP_FUNCTION(stream_get_wrappers)
579577
HashTable *url_stream_wrappers_hash;
580578
zend_string *stream_protocol;
581579

582-
if (zend_parse_parameters_none() == FAILURE) {
583-
return;
584-
}
580+
ZEND_PARSE_PARAMETERS_NONE();
585581

586582
if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) {
587583
array_init(return_value);

ext/standard/string.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5442,10 +5442,7 @@ PHP_FUNCTION(localeconv)
54425442
zval grouping, mon_grouping;
54435443
int len, i;
54445444

5445-
/* We don't need no stinkin' parameters... */
5446-
if (zend_parse_parameters_none() == FAILURE) {
5447-
return;
5448-
}
5445+
ZEND_PARSE_PARAMETERS_NONE();
54495446

54505447
array_init(return_value);
54515448
array_init(&grouping);

ext/standard/syslog.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,7 @@ PHP_FUNCTION(openlog)
162162
Close connection to system logger */
163163
PHP_FUNCTION(closelog)
164164
{
165-
if (zend_parse_parameters_none() == FAILURE) {
166-
return;
167-
}
165+
ZEND_PARSE_PARAMETERS_NONE();
168166

169167
closelog();
170168
if (BG(syslog_device)) {

ext/standard/user_filters.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,7 @@ PHP_FUNCTION(stream_get_filters)
521521
zend_string *filter_name;
522522
HashTable *filters_hash;
523523

524-
if (zend_parse_parameters_none() == FAILURE) {
525-
return;
526-
}
524+
ZEND_PARSE_PARAMETERS_NONE();
527525

528526
array_init(return_value);
529527

0 commit comments

Comments
 (0)