Skip to content

Commit 6dc7281

Browse files
committed
The rest of the fast_zpp conversions
1 parent a7c77af commit 6dc7281

File tree

1 file changed

+118
-66
lines changed

1 file changed

+118
-66
lines changed

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)
@@ -2029,22 +2032,34 @@ static void php_memc_cas_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key)
20292032
zend_string *key;
20302033
zend_string *server_key = NULL;
20312034
zval *value;
2032-
time_t expiration = 0;
2035+
zend_long expiration = 0;
2036+
zend_long ignored;
20332037
zend_string *payload;
20342038
uint32_t flags = 0;
20352039
memcached_return status;
20362040
MEMC_METHOD_INIT_VARS;
20372041

20382042
if (by_key) {
2039-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zSSz|ll", &zv_cas, &server_key, &key,
2040-
&value, &expiration) == FAILURE) {
2041-
return;
2042-
}
2043+
/* zSSz|ll */
2044+
ZEND_PARSE_PARAMETERS_START(4, 6)
2045+
Z_PARAM_ZVAL(zv_cas)
2046+
Z_PARAM_STR(server_key)
2047+
Z_PARAM_STR(key)
2048+
Z_PARAM_ZVAL(value)
2049+
Z_PARAM_OPTIONAL
2050+
Z_PARAM_LONG(expiration)
2051+
Z_PARAM_LONG(ignored)
2052+
ZEND_PARSE_PARAMETERS_END();
20432053
} else {
2044-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zSz|ll", &zv_cas, &key, &value,
2045-
&expiration) == FAILURE) {
2046-
return;
2047-
}
2054+
/* zSz|ll */
2055+
ZEND_PARSE_PARAMETERS_START(3, 5)
2056+
Z_PARAM_ZVAL(zv_cas)
2057+
Z_PARAM_STR(key)
2058+
Z_PARAM_ZVAL(value)
2059+
Z_PARAM_OPTIONAL
2060+
Z_PARAM_LONG(expiration)
2061+
Z_PARAM_LONG(ignored)
2062+
ZEND_PARSE_PARAMETERS_END();
20482063
}
20492064

20502065
MEMC_METHOD_FETCH_OBJECT;
@@ -2126,18 +2141,25 @@ PHP_METHOD(Memcached, deleteMultiByKey)
21262141
static void php_memc_delete_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key)
21272142
{
21282143
zend_string *key, *server_key;
2129-
time_t expiration = 0;
2144+
zend_long expiration = 0;
21302145
memcached_return status;
21312146
MEMC_METHOD_INIT_VARS;
21322147

21332148
if (by_key) {
2134-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|l", &server_key, &key, &expiration) == FAILURE) {
2135-
return;
2136-
}
2149+
/* SS|l */
2150+
ZEND_PARSE_PARAMETERS_START(2, 3)
2151+
Z_PARAM_STR(server_key)
2152+
Z_PARAM_STR(key)
2153+
Z_PARAM_OPTIONAL
2154+
Z_PARAM_LONG(expiration)
2155+
ZEND_PARSE_PARAMETERS_END();
21372156
} else {
2138-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|l", &key, &expiration) == FAILURE) {
2139-
return;
2140-
}
2157+
/* S|l */
2158+
ZEND_PARSE_PARAMETERS_START(1, 2)
2159+
Z_PARAM_STR(key)
2160+
Z_PARAM_OPTIONAL
2161+
Z_PARAM_LONG(expiration)
2162+
ZEND_PARSE_PARAMETERS_END();
21412163
server_key = key;
21422164
}
21432165

@@ -2165,20 +2187,27 @@ static void php_memc_deleteMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by
21652187
{
21662188
zval *entries, *zv, ret;
21672189
zend_string *server_key = NULL;
2168-
time_t expiration = 0;
2190+
zend_long expiration = 0;
21692191
zend_string *entry;
21702192

21712193
memcached_return status;
21722194
MEMC_METHOD_INIT_VARS;
21732195

21742196
if (by_key) {
2175-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sa/|l", &server_key, &entries, &expiration) == FAILURE) {
2176-
return;
2177-
}
2197+
/* Sa/|l */
2198+
ZEND_PARSE_PARAMETERS_START(2, 3)
2199+
Z_PARAM_STR(server_key)
2200+
Z_PARAM_ARRAY_EX(entries, 0, 1)
2201+
Z_PARAM_OPTIONAL
2202+
Z_PARAM_LONG(expiration)
2203+
ZEND_PARSE_PARAMETERS_END();
21782204
} else {
2179-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/|l", &entries, &expiration) == FAILURE) {
2180-
return;
2181-
}
2205+
/* a/|l */
2206+
ZEND_PARSE_PARAMETERS_START(1, 2)
2207+
Z_PARAM_ARRAY_EX(entries, 0, 1)
2208+
Z_PARAM_OPTIONAL
2209+
Z_PARAM_LONG(expiration)
2210+
ZEND_PARSE_PARAMETERS_END();
21822211
}
21832212

21842213
MEMC_METHOD_FETCH_OBJECT;
@@ -2348,13 +2377,17 @@ PHP_METHOD(Memcached, incrementByKey)
23482377
PHP_METHOD(Memcached, addServer)
23492378
{
23502379
zend_string *host;
2351-
long port, weight = 0;
2380+
zend_long port, weight = 0;
23522381
memcached_return status;
23532382
MEMC_METHOD_INIT_VARS;
23542383

2355-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl|l", &host, &port, &weight) == FAILURE) {
2356-
return;
2357-
}
2384+
/* Sa/|l */
2385+
ZEND_PARSE_PARAMETERS_START(2, 3)
2386+
Z_PARAM_STR(host)
2387+
Z_PARAM_LONG(port)
2388+
Z_PARAM_OPTIONAL
2389+
Z_PARAM_LONG(weight)
2390+
ZEND_PARSE_PARAMETERS_END();
23582391

23592392
MEMC_METHOD_FETCH_OBJECT;
23602393
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
@@ -2382,9 +2415,10 @@ PHP_METHOD(Memcached, addServers)
23822415
memcached_return status;
23832416
MEMC_METHOD_INIT_VARS;
23842417

2385-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/", &servers) == FAILURE) {
2386-
return;
2387-
}
2418+
/* a/ */
2419+
ZEND_PARSE_PARAMETERS_START(1, 1)
2420+
Z_PARAM_ARRAY_EX(servers, 0, 1)
2421+
ZEND_PARSE_PARAMETERS_END();
23882422

23892423
MEMC_METHOD_FETCH_OBJECT;
23902424
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
@@ -2486,9 +2520,10 @@ PHP_METHOD(Memcached, getServerByKey)
24862520
memcached_return error;
24872521
MEMC_METHOD_INIT_VARS;
24882522

2489-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &server_key) == FAILURE) {
2490-
return;
2491-
}
2523+
/* S */
2524+
ZEND_PARSE_PARAMETERS_START(1, 1)
2525+
Z_PARAM_STR(server_key)
2526+
ZEND_PARSE_PARAMETERS_END();
24922527

24932528
MEMC_METHOD_FETCH_OBJECT;
24942529
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
@@ -2706,9 +2741,11 @@ PHP_METHOD(Memcached, getStats)
27062741
zend_string *args_string = NULL;
27072742
MEMC_METHOD_INIT_VARS;
27082743

2709-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!", &args_string) == FAILURE) {
2710-
return;
2711-
}
2744+
/* |S! */
2745+
ZEND_PARSE_PARAMETERS_START(0, 1)
2746+
Z_PARAM_OPTIONAL
2747+
Z_PARAM_STR_EX(args_string, 1, 0)
2748+
ZEND_PARSE_PARAMETERS_END();
27122749

27132750
MEMC_METHOD_FETCH_OBJECT;
27142751

@@ -2800,13 +2837,15 @@ PHP_METHOD(Memcached, getAllKeys)
28002837
Flushes the data on all the servers */
28012838
static PHP_METHOD(Memcached, flush)
28022839
{
2803-
time_t delay = 0;
2840+
zend_long delay = 0;
28042841
memcached_return status;
28052842
MEMC_METHOD_INIT_VARS;
28062843

2807-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &delay) == FAILURE) {
2808-
return;
2809-
}
2844+
/* |l */
2845+
ZEND_PARSE_PARAMETERS_START(0, 1)
2846+
Z_PARAM_OPTIONAL
2847+
Z_PARAM_LONG(delay)
2848+
ZEND_PARSE_PARAMETERS_END();
28102849

28112850
MEMC_METHOD_FETCH_OBJECT;
28122851
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
@@ -2824,14 +2863,15 @@ static PHP_METHOD(Memcached, flush)
28242863
Returns the value for the given option constant */
28252864
static PHP_METHOD(Memcached, getOption)
28262865
{
2827-
long option;
2866+
zend_long option;
28282867
uint64_t result;
28292868
memcached_behavior flag;
28302869
MEMC_METHOD_INIT_VARS;
28312870

2832-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &option) == FAILURE) {
2833-
return;
2834-
}
2871+
/* l */
2872+
ZEND_PARSE_PARAMETERS_START(1, 1)
2873+
Z_PARAM_LONG(option)
2874+
ZEND_PARSE_PARAMETERS_END();
28352875

28362876
MEMC_METHOD_FETCH_OBJECT;
28372877

@@ -3073,17 +3113,20 @@ PHP_METHOD(Memcached, setBucket)
30733113
{
30743114
zval *zserver_map;
30753115
zval *zforward_map = NULL;
3076-
long replicas = 0;
3116+
zend_long replicas = 0;
30773117
zend_bool retval = 1;
30783118

30793119
uint32_t *server_map = NULL, *forward_map = NULL;
30803120
size_t server_map_len = 0, forward_map_len = 0;
30813121
memcached_return rc;
30823122
MEMC_METHOD_INIT_VARS;
30833123

3084-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "aa!l", &zserver_map, &zforward_map, &replicas) == FAILURE) {
3085-
return;
3086-
}
3124+
/* aa!l */
3125+
ZEND_PARSE_PARAMETERS_START(3, 3)
3126+
Z_PARAM_ARRAY(zserver_map)
3127+
Z_PARAM_ARRAY_EX(zforward_map, 1, 0)
3128+
Z_PARAM_LONG(replicas)
3129+
ZEND_PARSE_PARAMETERS_END();
30873130

30883131
MEMC_METHOD_FETCH_OBJECT;
30893132

@@ -3144,9 +3187,11 @@ static PHP_METHOD(Memcached, setOptions)
31443187

31453188
MEMC_METHOD_INIT_VARS;
31463189

3147-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &options) == FAILURE) {
3148-
return;
3149-
}
3190+
/* a */
3191+
ZEND_PARSE_PARAMETERS_START(1, 1)
3192+
Z_PARAM_ARRAY(options)
3193+
ZEND_PARSE_PARAMETERS_END();
3194+
31503195

31513196
MEMC_METHOD_FETCH_OBJECT;
31523197

@@ -3169,13 +3214,15 @@ static PHP_METHOD(Memcached, setOptions)
31693214
Sets the value for the given option constant */
31703215
static PHP_METHOD(Memcached, setOption)
31713216
{
3172-
long option;
3217+
zend_long option;
31733218
zval *value;
31743219
MEMC_METHOD_INIT_VARS;
31753220

3176-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz/", &option, &value) == FAILURE) {
3177-
return;
3178-
}
3221+
/* lz/ */
3222+
ZEND_PARSE_PARAMETERS_START(2, 2)
3223+
Z_PARAM_LONG(option)
3224+
Z_PARAM_ZVAL_EX(value, 0, 1)
3225+
ZEND_PARSE_PARAMETERS_END();
31793226

31803227
MEMC_METHOD_FETCH_OBJECT;
31813228

@@ -3192,9 +3239,11 @@ static PHP_METHOD(Memcached, setSaslAuthData)
31923239
memcached_return status;
31933240
zend_string *user, *pass;
31943241

3195-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &user, &pass) == FAILURE) {
3196-
return;
3197-
}
3242+
/* SS/ */
3243+
ZEND_PARSE_PARAMETERS_START(2, 2)
3244+
Z_PARAM_STR(user)
3245+
Z_PARAM_STR(pass)
3246+
ZEND_PARSE_PARAMETERS_END();
31983247

31993248
if (!php_memc_init_sasl_if_needed()) {
32003249
RETURN_FALSE;
@@ -3676,9 +3725,10 @@ PHP_METHOD(MemcachedServer, run)
36763725
php_memc_server_t *intern;
36773726
intern = Z_MEMC_SERVER_P(getThis());
36783727

3679-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &address) == FAILURE) {
3680-
return;
3681-
}
3728+
/* S */
3729+
ZEND_PARSE_PARAMETERS_START(1, 1)
3730+
Z_PARAM_STR(address)
3731+
ZEND_PARSE_PARAMETERS_END();
36823732

36833733
rc = php_memc_proto_handler_run(intern->handler, address);
36843734

@@ -3697,9 +3747,11 @@ PHP_METHOD(MemcachedServer, on)
36973747
zend_fcall_info_cache fci_cache;
36983748
zend_bool rc = 0;
36993749

3700-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lf!", &event, &fci, &fci_cache) == FAILURE) {
3701-
return;
3702-
}
3750+
/* lf! */
3751+
ZEND_PARSE_PARAMETERS_START(2, 2)
3752+
Z_PARAM_LONG(event)
3753+
Z_PARAM_FUNC_EX(fci, fci_cache, 1, 0)
3754+
ZEND_PARSE_PARAMETERS_END();
37033755

37043756
if (event <= MEMC_SERVER_ON_MIN || event >= MEMC_SERVER_ON_MAX) {
37053757
RETURN_FALSE;

0 commit comments

Comments
 (0)