Use variables that already received ZEND_NUM_ARGS()

This commit is contained in:
Gabriel Caruso 2018-07-22 15:54:00 -03:00
parent 26cd84d19f
commit 8ca1f47a7a
No known key found for this signature in database
GPG key ID: EA85C7988F5A6877
6 changed files with 15 additions and 22 deletions

View file

@ -516,13 +516,11 @@ static PHP_FUNCTION(bzcompress)
int error, /* Error Container */ int error, /* Error Container */
block_size = 4, /* Block size for compression algorithm */ block_size = 4, /* Block size for compression algorithm */
work_factor = 0, /* Work factor for compression algorithm */ work_factor = 0, /* Work factor for compression algorithm */
argc; /* Argument count */ argc = ZEND_NUM_ARGS(); /* Argument count */
size_t source_len; /* Length of the source data */ size_t source_len; /* Length of the source data */
unsigned int dest_len; /* Length of the destination buffer */ unsigned int dest_len; /* Length of the destination buffer */
argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc, "s|ll", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ll", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) {
return; return;
} }

View file

@ -101,12 +101,12 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
*/ */
switch (image_type) { switch (image_type) {
case PHP_GDIMG_TYPE_XBM: case PHP_GDIMG_TYPE_XBM:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rp!|ll", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) { if (zend_parse_parameters(argc, "rp!|ll", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) {
return; return;
} }
break; break;
case PHP_GDIMG_TYPE_BMP: case PHP_GDIMG_TYPE_BMP:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!b", &imgind, &to_zval, &compressed) == FAILURE) { if (zend_parse_parameters(argc, "r|z!b", &imgind, &to_zval, &compressed) == FAILURE) {
return; return;
} }
break; break;
@ -117,7 +117,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
* PHP_GDIMG_TYPE_WBM * PHP_GDIMG_TYPE_WBM
* PHP_GDIMG_TYPE_WEBP * PHP_GDIMG_TYPE_WEBP
* */ * */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!ll", &imgind, &to_zval, &quality, &basefilter) == FAILURE) { if (zend_parse_parameters(argc, "r|z!ll", &imgind, &to_zval, &quality, &basefilter) == FAILURE) {
return; return;
} }
} }

View file

@ -1123,7 +1123,7 @@ PHP_FUNCTION(ibase_drop_db)
PHP_FUNCTION(ibase_trans) PHP_FUNCTION(ibase_trans)
{ {
unsigned short i, link_cnt = 0, tpb_len = 0; unsigned short i, link_cnt = 0, tpb_len = 0;
int argn; int argn = ZEND_NUM_ARGS();
char last_tpb[TPB_MAX_SIZE]; char last_tpb[TPB_MAX_SIZE];
ibase_db_link **ib_link = NULL; ibase_db_link **ib_link = NULL;
ibase_trans *ib_trans; ibase_trans *ib_trans;
@ -1132,8 +1132,6 @@ PHP_FUNCTION(ibase_trans)
RESET_ERRMSG; RESET_ERRMSG;
argn = ZEND_NUM_ARGS();
/* (1+argn) is an upper bound for the number of links this trans connects to */ /* (1+argn) is an upper bound for the number of links this trans connects to */
ib_link = (ibase_db_link **) safe_emalloc(sizeof(ibase_db_link *),1+argn,0); ib_link = (ibase_db_link **) safe_emalloc(sizeof(ibase_db_link *),1+argn,0);
@ -1143,7 +1141,7 @@ PHP_FUNCTION(ibase_trans)
ISC_TEB *teb; ISC_TEB *teb;
zval *args = NULL; zval *args = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argn) == FAILURE) { if (zend_parse_parameters(argn, "+", &args, &argn) == FAILURE) {
efree(ib_link); efree(ib_link);
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -3335,7 +3335,7 @@ PHP_FUNCTION(ldap_parse_result)
char *lmatcheddn, *lerrmsg; char *lmatcheddn, *lerrmsg;
int rc, lerrcode, myargcount = ZEND_NUM_ARGS(); int rc, lerrcode, myargcount = ZEND_NUM_ARGS();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrz/|z/z/z/z/", &link, &result, &errcode, &matcheddn, &errmsg, &referrals, &serverctrls) != SUCCESS) { if (zend_parse_parameters(myargcount, "rrz/|z/z/z/z/", &link, &result, &errcode, &matcheddn, &errmsg, &referrals, &serverctrls) != SUCCESS) {
return; return;
} }
@ -3411,7 +3411,7 @@ PHP_FUNCTION(ldap_parse_exop)
struct berval *lretdata; struct berval *lretdata;
int rc, myargcount = ZEND_NUM_ARGS(); int rc, myargcount = ZEND_NUM_ARGS();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr|z/z/", &link, &result, &retdata, &retoid) != SUCCESS) { if (zend_parse_parameters(myargcount, "rr|z/z/", &link, &result, &retdata, &retoid) != SUCCESS) {
WRONG_PARAM_COUNT; WRONG_PARAM_COUNT;
} }
@ -3925,7 +3925,7 @@ PHP_FUNCTION(ldap_control_paged_result)
LDAPControl ctrl, *ctrlsp[2]; LDAPControl ctrl, *ctrlsp[2];
int rc, myargcount = ZEND_NUM_ARGS(); int rc, myargcount = ZEND_NUM_ARGS();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|bs", &link, &pagesize, &iscritical, &cookie, &cookie_len) != SUCCESS) { if (zend_parse_parameters(myargcount, "rl|bs", &link, &pagesize, &iscritical, &cookie, &cookie_len) != SUCCESS) {
return; return;
} }
@ -4017,7 +4017,7 @@ PHP_FUNCTION(ldap_control_paged_result_response)
ber_tag_t tag; ber_tag_t tag;
int rc, lerrcode, myargcount = ZEND_NUM_ARGS(); int rc, lerrcode, myargcount = ZEND_NUM_ARGS();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr|z/z/", &link, &result, &cookie, &estimated) != SUCCESS) { if (zend_parse_parameters(myargcount, "rr|z/z/", &link, &result, &cookie, &estimated) != SUCCESS) {
return; return;
} }
@ -4221,7 +4221,7 @@ PHP_FUNCTION(ldap_exop_passwd)
int rc, myargcount = ZEND_NUM_ARGS(), msgid, err; int rc, myargcount = ZEND_NUM_ARGS(), msgid, err;
char* errmsg; char* errmsg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|zzzz/", &link, &user, &oldpw, &newpw, &serverctrls) == FAILURE) { if (zend_parse_parameters(myargcount, "r|zzzz/", &link, &user, &oldpw, &newpw, &serverctrls) == FAILURE) {
WRONG_PARAM_COUNT; WRONG_PARAM_COUNT;
} }

View file

@ -1302,12 +1302,10 @@ PHP_FUNCTION(odbc_execute)
unsigned char otype; unsigned char otype;
SQLSMALLINT ctype; SQLSMALLINT ctype;
odbc_result *result; odbc_result *result;
int numArgs, i, ne; int numArgs = ZEND_NUM_ARGS(), i, ne;
RETCODE rc; RETCODE rc;
numArgs = ZEND_NUM_ARGS(); if (zend_parse_parameters(numArgs, "r|a", &pv_res, &pv_param_arr) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|a", &pv_res, &pv_param_arr) == FAILURE) {
return; return;
} }

View file

@ -1026,7 +1026,7 @@ PHP_FUNCTION(xmlrpc_server_call_method)
php_output_options out; php_output_options out;
int argc = ZEND_NUM_ARGS(); int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz|a", &handle, &rawxml, &rawxml_len, &caller_params, &output_opts) != SUCCESS) { if (zend_parse_parameters(argc, "rsz|a", &handle, &rawxml, &rawxml_len, &caller_params, &output_opts) != SUCCESS) {
return; return;
} }
/* user output options */ /* user output options */
@ -1447,4 +1447,3 @@ PHP_FUNCTION(xmlrpc_is_fault)
* c-basic-offset: 4 * c-basic-offset: 4
* End: * End:
*/ */