Skip to content

Commit 27782a8

Browse files
authored
1 parent a25dbce commit 27782a8

File tree

3 files changed

+74
-46
lines changed

3 files changed

+74
-46
lines changed

apc_iterator.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,13 @@ PHP_METHOD(APCUIterator, __construct) {
376376
zval *search = NULL;
377377
zend_long list = APC_LIST_ACTIVE;
378378

379-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z!lll", &search, &format, &chunk_size, &list) == FAILURE) {
380-
return;
381-
}
379+
ZEND_PARSE_PARAMETERS_START(0, 4)
380+
Z_PARAM_OPTIONAL
381+
Z_PARAM_ZVAL_EX(search, 1, 0)
382+
Z_PARAM_LONG(format)
383+
Z_PARAM_LONG(chunk_size)
384+
Z_PARAM_LONG(list)
385+
ZEND_PARSE_PARAMETERS_END();
382386

383387
if (chunk_size < 0) {
384388
apc_error("APCUIterator chunk size must be 0 or greater");

apcue/apcue.c

+10-7
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ PHP_FUNCTION(apcue_get)
134134
char* key = NULL;
135135
zend_uint klen = 0L;
136136

137-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &klen) == FAILURE) {
138-
return;
139-
}
137+
ZEND_PARSE_PARAMETERS_START(1, 1)
138+
Z_PARAM_STRING(key, klen)
139+
ZEND_PARSE_PARAMETERS_END();
140140

141141
{
142142
/* perform lookup */
@@ -155,10 +155,13 @@ PHP_FUNCTION(apcue_set)
155155
zend_uint klen = 0L;
156156
long ttl = 0L;
157157
zval* pzval = NULL;
158-
159-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &key, &klen, &pzval, &ttl) == FAILURE) {
160-
return;
161-
}
158+
159+
ZEND_PARSE_PARAMETERS_START(2, 3)
160+
Z_PARAM_STRING(key, klen)
161+
Z_PARAM_ZVAL(pzval)
162+
Z_PARAM_OPTIONAL
163+
Z_PARAM_LONG(ttl)
164+
ZEND_PARSE_PARAMETERS_END();
162165

163166
/* perform store */
164167
ZVAL_BOOL(return_value, apc_cache_store(apcue_cache, key, klen, pzval, ttl, 0 TSRMLS_CC));

php_apc.c

+57-36
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,10 @@ PHP_FUNCTION(apcu_cache_info)
350350
{
351351
zend_bool limited = 0;
352352

353-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &limited) == FAILURE) {
354-
return;
355-
}
353+
ZEND_PARSE_PARAMETERS_START(0,1)
354+
Z_PARAM_OPTIONAL
355+
Z_PARAM_BOOL(limited)
356+
ZEND_PARSE_PARAMETERS_END();
356357

357358
if (!apc_cache_info(return_value, apc_user_cache, limited)) {
358359
php_error_docref(NULL, E_WARNING, "No APC info available. Perhaps APC is not enabled? Check apc.enabled in your ini file");
@@ -366,9 +367,9 @@ PHP_FUNCTION(apcu_key_info)
366367
{
367368
zend_string *key;
368369

369-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
370-
return;
371-
}
370+
ZEND_PARSE_PARAMETERS_START(1, 1)
371+
Z_PARAM_STR(key)
372+
ZEND_PARSE_PARAMETERS_END();
372373

373374
apc_cache_stat(apc_user_cache, key, return_value);
374375
} /* }}} */
@@ -381,9 +382,10 @@ PHP_FUNCTION(apcu_sma_info)
381382
int i;
382383
zend_bool limited = 0;
383384

384-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &limited) == FAILURE) {
385-
return;
386-
}
385+
ZEND_PARSE_PARAMETERS_START(0, 1)
386+
Z_PARAM_OPTIONAL
387+
Z_PARAM_BOOL(limited)
388+
ZEND_PARSE_PARAMETERS_END();
387389

388390
info = apc_sma_info(&apc_sma, limited);
389391

@@ -447,9 +449,12 @@ static void apc_store_helper(INTERNAL_FUNCTION_PARAMETERS, const zend_bool exclu
447449
zval *val = NULL;
448450
zend_long ttl = 0L;
449451

450-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|zl", &key, &val, &ttl) == FAILURE) {
451-
return;
452-
}
452+
ZEND_PARSE_PARAMETERS_START(1, 3)
453+
Z_PARAM_ZVAL(key)
454+
Z_PARAM_OPTIONAL
455+
Z_PARAM_ZVAL(val)
456+
Z_PARAM_LONG(ttl)
457+
ZEND_PARSE_PARAMETERS_END();
453458

454459
if (APCG(serializer_name)) {
455460
/* Avoid race conditions between MINIT of apc and serializer exts like igbinary */
@@ -540,9 +545,13 @@ PHP_FUNCTION(apcu_inc) {
540545
zend_long step = 1, ttl = 0;
541546
zval *success = NULL;
542547

543-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|lzl", &key, &step, &success, &ttl) == FAILURE) {
544-
return;
545-
}
548+
ZEND_PARSE_PARAMETERS_START(1, 4)
549+
Z_PARAM_STR(key)
550+
Z_PARAM_OPTIONAL
551+
Z_PARAM_LONG(step)
552+
Z_PARAM_ZVAL(success)
553+
Z_PARAM_LONG(ttl)
554+
ZEND_PARSE_PARAMETERS_END();
546555

547556
args.step = step;
548557
if (php_apc_update(key, php_inc_updater, &args, 1, ttl)) {
@@ -568,9 +577,13 @@ PHP_FUNCTION(apcu_dec) {
568577
zend_long step = 1, ttl = 0;
569578
zval *success = NULL;
570579

571-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|lzl", &key, &step, &success, &ttl) == FAILURE) {
572-
return;
573-
}
580+
ZEND_PARSE_PARAMETERS_START(1, 4)
581+
Z_PARAM_STR(key)
582+
Z_PARAM_OPTIONAL
583+
Z_PARAM_LONG(step)
584+
Z_PARAM_ZVAL(success)
585+
Z_PARAM_LONG(ttl)
586+
ZEND_PARSE_PARAMETERS_END();
574587

575588
args.step = 0 - step;
576589
if (php_apc_update(key, php_inc_updater, &args, 1, ttl)) {
@@ -604,9 +617,11 @@ PHP_FUNCTION(apcu_cas) {
604617
zend_string *key;
605618
zend_long vals[2];
606619

607-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sll", &key, &vals[0], &vals[1]) == FAILURE) {
608-
return;
609-
}
620+
ZEND_PARSE_PARAMETERS_START(3, 3)
621+
Z_PARAM_STR(key)
622+
Z_PARAM_LONG(vals[0])
623+
Z_PARAM_LONG(vals[1])
624+
ZEND_PARSE_PARAMETERS_END();
610625

611626
if (APCG(serializer_name)) {
612627
/* Avoid race conditions between MINIT of apc and serializer exts like igbinary */
@@ -625,9 +640,11 @@ PHP_FUNCTION(apcu_fetch) {
625640
time_t t;
626641
int result;
627642

628-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|z", &key, &success) == FAILURE) {
629-
return;
630-
}
643+
ZEND_PARSE_PARAMETERS_START(1, 2)
644+
Z_PARAM_ZVAL(key)
645+
Z_PARAM_OPTIONAL
646+
Z_PARAM_ZVAL(success)
647+
ZEND_PARSE_PARAMETERS_END();
631648

632649
t = apc_time();
633650

@@ -676,9 +693,9 @@ PHP_FUNCTION(apcu_exists) {
676693
zval *key;
677694
time_t t;
678695

679-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &key) == FAILURE) {
680-
return;
681-
}
696+
ZEND_PARSE_PARAMETERS_START(1, 1)
697+
Z_PARAM_ZVAL(key)
698+
ZEND_PARSE_PARAMETERS_END();
682699

683700
t = apc_time();
684701

@@ -718,9 +735,9 @@ PHP_FUNCTION(apcu_exists) {
718735
PHP_FUNCTION(apcu_delete) {
719736
zval *keys;
720737

721-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &keys) == FAILURE) {
722-
return;
723-
}
738+
ZEND_PARSE_PARAMETERS_START(1, 1)
739+
Z_PARAM_ZVAL(keys)
740+
ZEND_PARSE_PARAMETERS_END();
724741

725742
if (Z_TYPE_P(keys) == IS_STRING) {
726743
RETURN_BOOL(apc_cache_delete(apc_user_cache, Z_STR_P(keys)));
@@ -754,9 +771,12 @@ PHP_FUNCTION(apcu_entry) {
754771
zend_long ttl = 0L;
755772
zend_long now = apc_time();
756773

757-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sf|l", &key, &fci, &fcc, &ttl) != SUCCESS) {
758-
return;
759-
}
774+
ZEND_PARSE_PARAMETERS_START(2, 3)
775+
Z_PARAM_STR(key)
776+
Z_PARAM_FUNC(fci, fcc)
777+
Z_PARAM_OPTIONAL
778+
Z_PARAM_LONG(ttl)
779+
ZEND_PARSE_PARAMETERS_END();
760780

761781
apc_cache_entry(apc_user_cache, key, &fci, &fcc, ttl, now, return_value);
762782
}
@@ -767,9 +787,10 @@ PHP_FUNCTION(apcu_entry) {
767787
PHP_FUNCTION(apcu_inc_request_time) {
768788
zend_long by = 1;
769789

770-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &by) != SUCCESS) {
771-
return;
772-
}
790+
ZEND_PARSE_PARAMETERS_START(0, 1)
791+
Z_PARAM_OPTIONAL
792+
Z_PARAM_LONG(by)
793+
ZEND_PARSE_PARAMETERS_END();
773794

774795
if (!APCG(use_request_time)) {
775796
php_error_docref(NULL, E_WARNING,

0 commit comments

Comments
 (0)