Skip to content

Commit 8ca1f47

Browse files
committed
Use variables that already received ZEND_NUM_ARGS()
1 parent 26cd84d commit 8ca1f47

File tree

6 files changed

+15
-22
lines changed

6 files changed

+15
-22
lines changed

ext/bz2/bz2.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,13 +516,11 @@ static PHP_FUNCTION(bzcompress)
516516
int error, /* Error Container */
517517
block_size = 4, /* Block size for compression algorithm */
518518
work_factor = 0, /* Work factor for compression algorithm */
519-
argc; /* Argument count */
519+
argc = ZEND_NUM_ARGS(); /* Argument count */
520520
size_t source_len; /* Length of the source data */
521521
unsigned int dest_len; /* Length of the destination buffer */
522522

523-
argc = ZEND_NUM_ARGS();
524-
525-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ll", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) {
523+
if (zend_parse_parameters(argc, "s|ll", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) {
526524
return;
527525
}
528526

ext/gd/gd_ctx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
101101
*/
102102
switch (image_type) {
103103
case PHP_GDIMG_TYPE_XBM:
104-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rp!|ll", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) {
104+
if (zend_parse_parameters(argc, "rp!|ll", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) {
105105
return;
106106
}
107107
break;
108108
case PHP_GDIMG_TYPE_BMP:
109-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!b", &imgind, &to_zval, &compressed) == FAILURE) {
109+
if (zend_parse_parameters(argc, "r|z!b", &imgind, &to_zval, &compressed) == FAILURE) {
110110
return;
111111
}
112112
break;
@@ -117,7 +117,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
117117
* PHP_GDIMG_TYPE_WBM
118118
* PHP_GDIMG_TYPE_WEBP
119119
* */
120-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!ll", &imgind, &to_zval, &quality, &basefilter) == FAILURE) {
120+
if (zend_parse_parameters(argc, "r|z!ll", &imgind, &to_zval, &quality, &basefilter) == FAILURE) {
121121
return;
122122
}
123123
}

ext/interbase/interbase.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ PHP_FUNCTION(ibase_drop_db)
11231123
PHP_FUNCTION(ibase_trans)
11241124
{
11251125
unsigned short i, link_cnt = 0, tpb_len = 0;
1126-
int argn;
1126+
int argn = ZEND_NUM_ARGS();
11271127
char last_tpb[TPB_MAX_SIZE];
11281128
ibase_db_link **ib_link = NULL;
11291129
ibase_trans *ib_trans;
@@ -1132,8 +1132,6 @@ PHP_FUNCTION(ibase_trans)
11321132

11331133
RESET_ERRMSG;
11341134

1135-
argn = ZEND_NUM_ARGS();
1136-
11371135
/* (1+argn) is an upper bound for the number of links this trans connects to */
11381136
ib_link = (ibase_db_link **) safe_emalloc(sizeof(ibase_db_link *),1+argn,0);
11391137

@@ -1143,7 +1141,7 @@ PHP_FUNCTION(ibase_trans)
11431141
ISC_TEB *teb;
11441142
zval *args = NULL;
11451143

1146-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argn) == FAILURE) {
1144+
if (zend_parse_parameters(argn, "+", &args, &argn) == FAILURE) {
11471145
efree(ib_link);
11481146
RETURN_FALSE;
11491147
}

ext/ldap/ldap.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3335,7 +3335,7 @@ PHP_FUNCTION(ldap_parse_result)
33353335
char *lmatcheddn, *lerrmsg;
33363336
int rc, lerrcode, myargcount = ZEND_NUM_ARGS();
33373337

3338-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrz/|z/z/z/z/", &link, &result, &errcode, &matcheddn, &errmsg, &referrals, &serverctrls) != SUCCESS) {
3338+
if (zend_parse_parameters(myargcount, "rrz/|z/z/z/z/", &link, &result, &errcode, &matcheddn, &errmsg, &referrals, &serverctrls) != SUCCESS) {
33393339
return;
33403340
}
33413341

@@ -3411,7 +3411,7 @@ PHP_FUNCTION(ldap_parse_exop)
34113411
struct berval *lretdata;
34123412
int rc, myargcount = ZEND_NUM_ARGS();
34133413

3414-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr|z/z/", &link, &result, &retdata, &retoid) != SUCCESS) {
3414+
if (zend_parse_parameters(myargcount, "rr|z/z/", &link, &result, &retdata, &retoid) != SUCCESS) {
34153415
WRONG_PARAM_COUNT;
34163416
}
34173417

@@ -3925,7 +3925,7 @@ PHP_FUNCTION(ldap_control_paged_result)
39253925
LDAPControl ctrl, *ctrlsp[2];
39263926
int rc, myargcount = ZEND_NUM_ARGS();
39273927

3928-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|bs", &link, &pagesize, &iscritical, &cookie, &cookie_len) != SUCCESS) {
3928+
if (zend_parse_parameters(myargcount, "rl|bs", &link, &pagesize, &iscritical, &cookie, &cookie_len) != SUCCESS) {
39293929
return;
39303930
}
39313931

@@ -4017,7 +4017,7 @@ PHP_FUNCTION(ldap_control_paged_result_response)
40174017
ber_tag_t tag;
40184018
int rc, lerrcode, myargcount = ZEND_NUM_ARGS();
40194019

4020-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr|z/z/", &link, &result, &cookie, &estimated) != SUCCESS) {
4020+
if (zend_parse_parameters(myargcount, "rr|z/z/", &link, &result, &cookie, &estimated) != SUCCESS) {
40214021
return;
40224022
}
40234023

@@ -4221,7 +4221,7 @@ PHP_FUNCTION(ldap_exop_passwd)
42214221
int rc, myargcount = ZEND_NUM_ARGS(), msgid, err;
42224222
char* errmsg;
42234223

4224-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|zzzz/", &link, &user, &oldpw, &newpw, &serverctrls) == FAILURE) {
4224+
if (zend_parse_parameters(myargcount, "r|zzzz/", &link, &user, &oldpw, &newpw, &serverctrls) == FAILURE) {
42254225
WRONG_PARAM_COUNT;
42264226
}
42274227

ext/odbc/php_odbc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,12 +1302,10 @@ PHP_FUNCTION(odbc_execute)
13021302
unsigned char otype;
13031303
SQLSMALLINT ctype;
13041304
odbc_result *result;
1305-
int numArgs, i, ne;
1305+
int numArgs = ZEND_NUM_ARGS(), i, ne;
13061306
RETCODE rc;
13071307

1308-
numArgs = ZEND_NUM_ARGS();
1309-
1310-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|a", &pv_res, &pv_param_arr) == FAILURE) {
1308+
if (zend_parse_parameters(numArgs, "r|a", &pv_res, &pv_param_arr) == FAILURE) {
13111309
return;
13121310
}
13131311

ext/xmlrpc/xmlrpc-epi-php.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ PHP_FUNCTION(xmlrpc_server_call_method)
10261026
php_output_options out;
10271027
int argc = ZEND_NUM_ARGS();
10281028

1029-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz|a", &handle, &rawxml, &rawxml_len, &caller_params, &output_opts) != SUCCESS) {
1029+
if (zend_parse_parameters(argc, "rsz|a", &handle, &rawxml, &rawxml_len, &caller_params, &output_opts) != SUCCESS) {
10301030
return;
10311031
}
10321032
/* user output options */
@@ -1447,4 +1447,3 @@ PHP_FUNCTION(xmlrpc_is_fault)
14471447
* c-basic-offset: 4
14481448
* End:
14491449
*/
1450-

0 commit comments

Comments
 (0)