Skip to content

Commit 5f28ffe

Browse files
committed
The rest of the fast_zpp conversions
1 parent 2760e2e commit 5f28ffe

File tree

1 file changed

+118
-66
lines changed

1 file changed

+118
-66
lines changed

Diff for: php_memcached.c

+118-66
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,7 @@ static PHP_METHOD(Memcached, __construct)
11741174

11751175
zend_bool is_persistent = 0;
11761176

1177+
/* |S!f!S */
11771178
ZEND_PARSE_PARAMETERS_START(0, 3)
11781179
Z_PARAM_OPTIONAL
11791180
Z_PARAM_STR_EX(persistent_id, 1, 0)
@@ -1406,15 +1407,17 @@ void php_memc_get_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key)
14061407
MEMC_METHOD_INIT_VARS;
14071408

14081409
if (by_key) {
1409-
ZEND_PARSE_PARAMETERS_START(2, 5)
1410+
/* SS|f!l */
1411+
ZEND_PARSE_PARAMETERS_START(2, 4)
14101412
Z_PARAM_STR(server_key)
14111413
Z_PARAM_STR(key)
14121414
Z_PARAM_OPTIONAL
14131415
Z_PARAM_FUNC_EX(fci, fcc, 1, 0)
14141416
Z_PARAM_LONG(get_flags)
14151417
ZEND_PARSE_PARAMETERS_END();
14161418
} else {
1417-
ZEND_PARSE_PARAMETERS_START(1, 4)
1419+
/* S|f!l */
1420+
ZEND_PARSE_PARAMETERS_START(1, 3)
14181421
Z_PARAM_STR(key)
14191422
Z_PARAM_OPTIONAL
14201423
Z_PARAM_FUNC_EX(fci, fcc, 1, 0)
@@ -2020,22 +2023,34 @@ static void php_memc_cas_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key)
20202023
zend_string *key;
20212024
zend_string *server_key = NULL;
20222025
zval *value;
2023-
time_t expiration = 0;
2026+
zend_long expiration = 0;
2027+
zend_long ignored;
20242028
zend_string *payload;
20252029
uint32_t flags = 0;
20262030
memcached_return status;
20272031
MEMC_METHOD_INIT_VARS;
20282032

20292033
if (by_key) {
2030-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zSSz|ll", &zv_cas, &server_key, &key,
2031-
&value, &expiration) == FAILURE) {
2032-
return;
2033-
}
2034+
/* zSSz|ll */
2035+
ZEND_PARSE_PARAMETERS_START(4, 6)
2036+
Z_PARAM_ZVAL(zv_cas)
2037+
Z_PARAM_STR(server_key)
2038+
Z_PARAM_STR(key)
2039+
Z_PARAM_ZVAL(value)
2040+
Z_PARAM_OPTIONAL
2041+
Z_PARAM_LONG(expiration)
2042+
Z_PARAM_LONG(ignored)
2043+
ZEND_PARSE_PARAMETERS_END();
20342044
} else {
2035-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zSz|ll", &zv_cas, &key, &value,
2036-
&expiration) == FAILURE) {
2037-
return;
2038-
}
2045+
/* zSz|ll */
2046+
ZEND_PARSE_PARAMETERS_START(3, 5)
2047+
Z_PARAM_ZVAL(zv_cas)
2048+
Z_PARAM_STR(key)
2049+
Z_PARAM_ZVAL(value)
2050+
Z_PARAM_OPTIONAL
2051+
Z_PARAM_LONG(expiration)
2052+
Z_PARAM_LONG(ignored)
2053+
ZEND_PARSE_PARAMETERS_END();
20392054
}
20402055

20412056
MEMC_METHOD_FETCH_OBJECT;
@@ -2117,18 +2132,25 @@ PHP_METHOD(Memcached, deleteMultiByKey)
21172132
static void php_memc_delete_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key)
21182133
{
21192134
zend_string *key, *server_key;
2120-
time_t expiration = 0;
2135+
zend_long expiration = 0;
21212136
memcached_return status;
21222137
MEMC_METHOD_INIT_VARS;
21232138

21242139
if (by_key) {
2125-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|l", &server_key, &key, &expiration) == FAILURE) {
2126-
return;
2127-
}
2140+
/* SS|l */
2141+
ZEND_PARSE_PARAMETERS_START(2, 3)
2142+
Z_PARAM_STR(server_key)
2143+
Z_PARAM_STR(key)
2144+
Z_PARAM_OPTIONAL
2145+
Z_PARAM_LONG(expiration)
2146+
ZEND_PARSE_PARAMETERS_END();
21282147
} else {
2129-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|l", &key, &expiration) == FAILURE) {
2130-
return;
2131-
}
2148+
/* S|l */
2149+
ZEND_PARSE_PARAMETERS_START(1, 2)
2150+
Z_PARAM_STR(key)
2151+
Z_PARAM_OPTIONAL
2152+
Z_PARAM_LONG(expiration)
2153+
ZEND_PARSE_PARAMETERS_END();
21322154
server_key = key;
21332155
}
21342156

@@ -2156,20 +2178,27 @@ static void php_memc_deleteMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by
21562178
{
21572179
zval *entries, *zv, ret;
21582180
zend_string *server_key = NULL;
2159-
time_t expiration = 0;
2181+
zend_long expiration = 0;
21602182
zend_string *entry;
21612183

21622184
memcached_return status;
21632185
MEMC_METHOD_INIT_VARS;
21642186

21652187
if (by_key) {
2166-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sa/|l", &server_key, &entries, &expiration) == FAILURE) {
2167-
return;
2168-
}
2188+
/* Sa/|l */
2189+
ZEND_PARSE_PARAMETERS_START(2, 3)
2190+
Z_PARAM_STR(server_key)
2191+
Z_PARAM_ARRAY_EX(entries, 0, 1)
2192+
Z_PARAM_OPTIONAL
2193+
Z_PARAM_LONG(expiration)
2194+
ZEND_PARSE_PARAMETERS_END();
21692195
} else {
2170-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/|l", &entries, &expiration) == FAILURE) {
2171-
return;
2172-
}
2196+
/* a/|l */
2197+
ZEND_PARSE_PARAMETERS_START(1, 2)
2198+
Z_PARAM_ARRAY_EX(entries, 0, 1)
2199+
Z_PARAM_OPTIONAL
2200+
Z_PARAM_LONG(expiration)
2201+
ZEND_PARSE_PARAMETERS_END();
21732202
}
21742203

21752204
MEMC_METHOD_FETCH_OBJECT;
@@ -2339,13 +2368,17 @@ PHP_METHOD(Memcached, incrementByKey)
23392368
PHP_METHOD(Memcached, addServer)
23402369
{
23412370
zend_string *host;
2342-
long port, weight = 0;
2371+
zend_long port, weight = 0;
23432372
memcached_return status;
23442373
MEMC_METHOD_INIT_VARS;
23452374

2346-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl|l", &host, &port, &weight) == FAILURE) {
2347-
return;
2348-
}
2375+
/* Sa/|l */
2376+
ZEND_PARSE_PARAMETERS_START(2, 3)
2377+
Z_PARAM_STR(host)
2378+
Z_PARAM_LONG(port)
2379+
Z_PARAM_OPTIONAL
2380+
Z_PARAM_LONG(weight)
2381+
ZEND_PARSE_PARAMETERS_END();
23492382

23502383
MEMC_METHOD_FETCH_OBJECT;
23512384
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
@@ -2373,9 +2406,10 @@ PHP_METHOD(Memcached, addServers)
23732406
memcached_return status;
23742407
MEMC_METHOD_INIT_VARS;
23752408

2376-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/", &servers) == FAILURE) {
2377-
return;
2378-
}
2409+
/* a/ */
2410+
ZEND_PARSE_PARAMETERS_START(1, 1)
2411+
Z_PARAM_ARRAY_EX(servers, 0, 1)
2412+
ZEND_PARSE_PARAMETERS_END();
23792413

23802414
MEMC_METHOD_FETCH_OBJECT;
23812415
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
@@ -2477,9 +2511,10 @@ PHP_METHOD(Memcached, getServerByKey)
24772511
memcached_return error;
24782512
MEMC_METHOD_INIT_VARS;
24792513

2480-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &server_key) == FAILURE) {
2481-
return;
2482-
}
2514+
/* S */
2515+
ZEND_PARSE_PARAMETERS_START(1, 1)
2516+
Z_PARAM_STR(server_key)
2517+
ZEND_PARSE_PARAMETERS_END();
24832518

24842519
MEMC_METHOD_FETCH_OBJECT;
24852520
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
@@ -2697,9 +2732,11 @@ PHP_METHOD(Memcached, getStats)
26972732
zend_string *args_string = NULL;
26982733
MEMC_METHOD_INIT_VARS;
26992734

2700-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!", &args_string) == FAILURE) {
2701-
return;
2702-
}
2735+
/* |S! */
2736+
ZEND_PARSE_PARAMETERS_START(0, 1)
2737+
Z_PARAM_OPTIONAL
2738+
Z_PARAM_STR_EX(args_string, 1, 0)
2739+
ZEND_PARSE_PARAMETERS_END();
27032740

27042741
MEMC_METHOD_FETCH_OBJECT;
27052742

@@ -2791,13 +2828,15 @@ PHP_METHOD(Memcached, getAllKeys)
27912828
Flushes the data on all the servers */
27922829
static PHP_METHOD(Memcached, flush)
27932830
{
2794-
time_t delay = 0;
2831+
zend_long delay = 0;
27952832
memcached_return status;
27962833
MEMC_METHOD_INIT_VARS;
27972834

2798-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &delay) == FAILURE) {
2799-
return;
2800-
}
2835+
/* |l */
2836+
ZEND_PARSE_PARAMETERS_START(0, 1)
2837+
Z_PARAM_OPTIONAL
2838+
Z_PARAM_LONG(delay)
2839+
ZEND_PARSE_PARAMETERS_END();
28012840

28022841
MEMC_METHOD_FETCH_OBJECT;
28032842
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
@@ -2815,14 +2854,15 @@ static PHP_METHOD(Memcached, flush)
28152854
Returns the value for the given option constant */
28162855
static PHP_METHOD(Memcached, getOption)
28172856
{
2818-
long option;
2857+
zend_long option;
28192858
uint64_t result;
28202859
memcached_behavior flag;
28212860
MEMC_METHOD_INIT_VARS;
28222861

2823-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &option) == FAILURE) {
2824-
return;
2825-
}
2862+
/* l */
2863+
ZEND_PARSE_PARAMETERS_START(1, 1)
2864+
Z_PARAM_LONG(option)
2865+
ZEND_PARSE_PARAMETERS_END();
28262866

28272867
MEMC_METHOD_FETCH_OBJECT;
28282868

@@ -3064,17 +3104,20 @@ PHP_METHOD(Memcached, setBucket)
30643104
{
30653105
zval *zserver_map;
30663106
zval *zforward_map = NULL;
3067-
long replicas = 0;
3107+
zend_long replicas = 0;
30683108
zend_bool retval = 1;
30693109

30703110
uint32_t *server_map = NULL, *forward_map = NULL;
30713111
size_t server_map_len = 0, forward_map_len = 0;
30723112
memcached_return rc;
30733113
MEMC_METHOD_INIT_VARS;
30743114

3075-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "aa!l", &zserver_map, &zforward_map, &replicas) == FAILURE) {
3076-
return;
3077-
}
3115+
/* aa!l */
3116+
ZEND_PARSE_PARAMETERS_START(3, 3)
3117+
Z_PARAM_ARRAY(zserver_map)
3118+
Z_PARAM_ARRAY_EX(zforward_map, 1, 0)
3119+
Z_PARAM_LONG(replicas)
3120+
ZEND_PARSE_PARAMETERS_END();
30783121

30793122
MEMC_METHOD_FETCH_OBJECT;
30803123

@@ -3135,9 +3178,11 @@ static PHP_METHOD(Memcached, setOptions)
31353178

31363179
MEMC_METHOD_INIT_VARS;
31373180

3138-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &options) == FAILURE) {
3139-
return;
3140-
}
3181+
/* a */
3182+
ZEND_PARSE_PARAMETERS_START(1, 1)
3183+
Z_PARAM_ARRAY(options)
3184+
ZEND_PARSE_PARAMETERS_END();
3185+
31413186

31423187
MEMC_METHOD_FETCH_OBJECT;
31433188

@@ -3160,13 +3205,15 @@ static PHP_METHOD(Memcached, setOptions)
31603205
Sets the value for the given option constant */
31613206
static PHP_METHOD(Memcached, setOption)
31623207
{
3163-
long option;
3208+
zend_long option;
31643209
zval *value;
31653210
MEMC_METHOD_INIT_VARS;
31663211

3167-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz/", &option, &value) == FAILURE) {
3168-
return;
3169-
}
3212+
/* lz/ */
3213+
ZEND_PARSE_PARAMETERS_START(2, 2)
3214+
Z_PARAM_LONG(option)
3215+
Z_PARAM_ZVAL_EX(value, 0, 1)
3216+
ZEND_PARSE_PARAMETERS_END();
31703217

31713218
MEMC_METHOD_FETCH_OBJECT;
31723219

@@ -3183,9 +3230,11 @@ static PHP_METHOD(Memcached, setSaslAuthData)
31833230
memcached_return status;
31843231
zend_string *user, *pass;
31853232

3186-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &user, &pass) == FAILURE) {
3187-
return;
3188-
}
3233+
/* SS/ */
3234+
ZEND_PARSE_PARAMETERS_START(2, 2)
3235+
Z_PARAM_STR(user)
3236+
Z_PARAM_STR(pass)
3237+
ZEND_PARSE_PARAMETERS_END();
31893238

31903239
if (!php_memc_init_sasl_if_needed()) {
31913240
RETURN_FALSE;
@@ -3667,9 +3716,10 @@ PHP_METHOD(MemcachedServer, run)
36673716
php_memc_server_t *intern;
36683717
intern = Z_MEMC_SERVER_P(getThis());
36693718

3670-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &address) == FAILURE) {
3671-
return;
3672-
}
3719+
/* S */
3720+
ZEND_PARSE_PARAMETERS_START(1, 1)
3721+
Z_PARAM_STR(address)
3722+
ZEND_PARSE_PARAMETERS_END();
36733723

36743724
rc = php_memc_proto_handler_run(intern->handler, address);
36753725

@@ -3688,9 +3738,11 @@ PHP_METHOD(MemcachedServer, on)
36883738
zend_fcall_info_cache fci_cache;
36893739
zend_bool rc = 0;
36903740

3691-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lf!", &event, &fci, &fci_cache) == FAILURE) {
3692-
return;
3693-
}
3741+
/* lf! */
3742+
ZEND_PARSE_PARAMETERS_START(2, 2)
3743+
Z_PARAM_LONG(event)
3744+
Z_PARAM_FUNC_EX(fci, fci_cache, 1, 0)
3745+
ZEND_PARSE_PARAMETERS_END();
36943746

36953747
if (event <= MEMC_SERVER_ON_MIN || event >= MEMC_SERVER_ON_MAX) {
36963748
RETURN_FALSE;

0 commit comments

Comments
 (0)