Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3ab1bb6

Browse files
committedFeb 4, 2017
The rest of the fast_zpp conversions
1 parent 3037eba commit 3ab1bb6

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
@@ -1190,6 +1190,7 @@ static PHP_METHOD(Memcached, __construct)
11901190

11911191
zend_bool is_persistent = 0;
11921192

1193+
/* |S!f!S */
11931194
ZEND_PARSE_PARAMETERS_START(0, 3)
11941195
Z_PARAM_OPTIONAL
11951196
Z_PARAM_STR_EX(persistent_id, 1, 0)
@@ -1422,15 +1423,17 @@ void php_memc_get_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key)
14221423
MEMC_METHOD_INIT_VARS;
14231424

14241425
if (by_key) {
1425-
ZEND_PARSE_PARAMETERS_START(2, 5)
1426+
/* SS|f!l */
1427+
ZEND_PARSE_PARAMETERS_START(2, 4)
14261428
Z_PARAM_STR(server_key)
14271429
Z_PARAM_STR(key)
14281430
Z_PARAM_OPTIONAL
14291431
Z_PARAM_FUNC_EX(fci, fcc, 1, 0)
14301432
Z_PARAM_LONG(get_flags)
14311433
ZEND_PARSE_PARAMETERS_END();
14321434
} else {
1433-
ZEND_PARSE_PARAMETERS_START(1, 4)
1435+
/* S|f!l */
1436+
ZEND_PARSE_PARAMETERS_START(1, 3)
14341437
Z_PARAM_STR(key)
14351438
Z_PARAM_OPTIONAL
14361439
Z_PARAM_FUNC_EX(fci, fcc, 1, 0)
@@ -2045,22 +2048,34 @@ static void php_memc_cas_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key)
20452048
zend_string *key;
20462049
zend_string *server_key = NULL;
20472050
zval *value;
2048-
time_t expiration = 0;
2051+
zend_long expiration = 0;
2052+
zend_long ignored;
20492053
zend_string *payload;
20502054
uint32_t flags = 0;
20512055
memcached_return status;
20522056
MEMC_METHOD_INIT_VARS;
20532057

20542058
if (by_key) {
2055-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zSSz|ll", &zv_cas, &server_key, &key,
2056-
&value, &expiration) == FAILURE) {
2057-
return;
2058-
}
2059+
/* zSSz|ll */
2060+
ZEND_PARSE_PARAMETERS_START(4, 6)
2061+
Z_PARAM_ZVAL(zv_cas)
2062+
Z_PARAM_STR(server_key)
2063+
Z_PARAM_STR(key)
2064+
Z_PARAM_ZVAL(value)
2065+
Z_PARAM_OPTIONAL
2066+
Z_PARAM_LONG(expiration)
2067+
Z_PARAM_LONG(ignored)
2068+
ZEND_PARSE_PARAMETERS_END();
20592069
} else {
2060-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zSz|ll", &zv_cas, &key, &value,
2061-
&expiration) == FAILURE) {
2062-
return;
2063-
}
2070+
/* zSz|ll */
2071+
ZEND_PARSE_PARAMETERS_START(3, 5)
2072+
Z_PARAM_ZVAL(zv_cas)
2073+
Z_PARAM_STR(key)
2074+
Z_PARAM_ZVAL(value)
2075+
Z_PARAM_OPTIONAL
2076+
Z_PARAM_LONG(expiration)
2077+
Z_PARAM_LONG(ignored)
2078+
ZEND_PARSE_PARAMETERS_END();
20642079
}
20652080

20662081
MEMC_METHOD_FETCH_OBJECT;
@@ -2142,18 +2157,25 @@ PHP_METHOD(Memcached, deleteMultiByKey)
21422157
static void php_memc_delete_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key)
21432158
{
21442159
zend_string *key, *server_key;
2145-
time_t expiration = 0;
2160+
zend_long expiration = 0;
21462161
memcached_return status;
21472162
MEMC_METHOD_INIT_VARS;
21482163

21492164
if (by_key) {
2150-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|l", &server_key, &key, &expiration) == FAILURE) {
2151-
return;
2152-
}
2165+
/* SS|l */
2166+
ZEND_PARSE_PARAMETERS_START(2, 3)
2167+
Z_PARAM_STR(server_key)
2168+
Z_PARAM_STR(key)
2169+
Z_PARAM_OPTIONAL
2170+
Z_PARAM_LONG(expiration)
2171+
ZEND_PARSE_PARAMETERS_END();
21532172
} else {
2154-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|l", &key, &expiration) == FAILURE) {
2155-
return;
2156-
}
2173+
/* S|l */
2174+
ZEND_PARSE_PARAMETERS_START(1, 2)
2175+
Z_PARAM_STR(key)
2176+
Z_PARAM_OPTIONAL
2177+
Z_PARAM_LONG(expiration)
2178+
ZEND_PARSE_PARAMETERS_END();
21572179
server_key = key;
21582180
}
21592181

@@ -2181,20 +2203,27 @@ static void php_memc_deleteMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by
21812203
{
21822204
zval *entries, *zv, ret;
21832205
zend_string *server_key = NULL;
2184-
time_t expiration = 0;
2206+
zend_long expiration = 0;
21852207
zend_string *entry;
21862208

21872209
memcached_return status;
21882210
MEMC_METHOD_INIT_VARS;
21892211

21902212
if (by_key) {
2191-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sa/|l", &server_key, &entries, &expiration) == FAILURE) {
2192-
return;
2193-
}
2213+
/* Sa/|l */
2214+
ZEND_PARSE_PARAMETERS_START(2, 3)
2215+
Z_PARAM_STR(server_key)
2216+
Z_PARAM_ARRAY_EX(entries, 0, 1)
2217+
Z_PARAM_OPTIONAL
2218+
Z_PARAM_LONG(expiration)
2219+
ZEND_PARSE_PARAMETERS_END();
21942220
} else {
2195-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/|l", &entries, &expiration) == FAILURE) {
2196-
return;
2197-
}
2221+
/* a/|l */
2222+
ZEND_PARSE_PARAMETERS_START(1, 2)
2223+
Z_PARAM_ARRAY_EX(entries, 0, 1)
2224+
Z_PARAM_OPTIONAL
2225+
Z_PARAM_LONG(expiration)
2226+
ZEND_PARSE_PARAMETERS_END();
21982227
}
21992228

22002229
MEMC_METHOD_FETCH_OBJECT;
@@ -2364,13 +2393,17 @@ PHP_METHOD(Memcached, incrementByKey)
23642393
PHP_METHOD(Memcached, addServer)
23652394
{
23662395
zend_string *host;
2367-
long port, weight = 0;
2396+
zend_long port, weight = 0;
23682397
memcached_return status;
23692398
MEMC_METHOD_INIT_VARS;
23702399

2371-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl|l", &host, &port, &weight) == FAILURE) {
2372-
return;
2373-
}
2400+
/* Sa/|l */
2401+
ZEND_PARSE_PARAMETERS_START(2, 3)
2402+
Z_PARAM_STR(host)
2403+
Z_PARAM_LONG(port)
2404+
Z_PARAM_OPTIONAL
2405+
Z_PARAM_LONG(weight)
2406+
ZEND_PARSE_PARAMETERS_END();
23742407

23752408
MEMC_METHOD_FETCH_OBJECT;
23762409
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
@@ -2398,9 +2431,10 @@ PHP_METHOD(Memcached, addServers)
23982431
memcached_return status;
23992432
MEMC_METHOD_INIT_VARS;
24002433

2401-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/", &servers) == FAILURE) {
2402-
return;
2403-
}
2434+
/* a/ */
2435+
ZEND_PARSE_PARAMETERS_START(1, 1)
2436+
Z_PARAM_ARRAY_EX(servers, 0, 1)
2437+
ZEND_PARSE_PARAMETERS_END();
24042438

24052439
MEMC_METHOD_FETCH_OBJECT;
24062440
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
@@ -2502,9 +2536,10 @@ PHP_METHOD(Memcached, getServerByKey)
25022536
memcached_return error;
25032537
MEMC_METHOD_INIT_VARS;
25042538

2505-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &server_key) == FAILURE) {
2506-
return;
2507-
}
2539+
/* S */
2540+
ZEND_PARSE_PARAMETERS_START(1, 1)
2541+
Z_PARAM_STR(server_key)
2542+
ZEND_PARSE_PARAMETERS_END();
25082543

25092544
MEMC_METHOD_FETCH_OBJECT;
25102545
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
@@ -2722,9 +2757,11 @@ PHP_METHOD(Memcached, getStats)
27222757
zend_string *args_string = NULL;
27232758
MEMC_METHOD_INIT_VARS;
27242759

2725-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!", &args_string) == FAILURE) {
2726-
return;
2727-
}
2760+
/* |S! */
2761+
ZEND_PARSE_PARAMETERS_START(0, 1)
2762+
Z_PARAM_OPTIONAL
2763+
Z_PARAM_STR_EX(args_string, 1, 0)
2764+
ZEND_PARSE_PARAMETERS_END();
27282765

27292766
MEMC_METHOD_FETCH_OBJECT;
27302767

@@ -2808,13 +2845,15 @@ PHP_METHOD(Memcached, getAllKeys)
28082845
Flushes the data on all the servers */
28092846
static PHP_METHOD(Memcached, flush)
28102847
{
2811-
time_t delay = 0;
2848+
zend_long delay = 0;
28122849
memcached_return status;
28132850
MEMC_METHOD_INIT_VARS;
28142851

2815-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &delay) == FAILURE) {
2816-
return;
2817-
}
2852+
/* |l */
2853+
ZEND_PARSE_PARAMETERS_START(0, 1)
2854+
Z_PARAM_OPTIONAL
2855+
Z_PARAM_LONG(delay)
2856+
ZEND_PARSE_PARAMETERS_END();
28182857

28192858
MEMC_METHOD_FETCH_OBJECT;
28202859
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
@@ -2832,14 +2871,15 @@ static PHP_METHOD(Memcached, flush)
28322871
Returns the value for the given option constant */
28332872
static PHP_METHOD(Memcached, getOption)
28342873
{
2835-
long option;
2874+
zend_long option;
28362875
uint64_t result;
28372876
memcached_behavior flag;
28382877
MEMC_METHOD_INIT_VARS;
28392878

2840-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &option) == FAILURE) {
2841-
return;
2842-
}
2879+
/* l */
2880+
ZEND_PARSE_PARAMETERS_START(1, 1)
2881+
Z_PARAM_LONG(option)
2882+
ZEND_PARSE_PARAMETERS_END();
28432883

28442884
MEMC_METHOD_FETCH_OBJECT;
28452885

@@ -3081,17 +3121,20 @@ PHP_METHOD(Memcached, setBucket)
30813121
{
30823122
zval *zserver_map;
30833123
zval *zforward_map = NULL;
3084-
long replicas = 0;
3124+
zend_long replicas = 0;
30853125
zend_bool retval = 1;
30863126

30873127
uint32_t *server_map = NULL, *forward_map = NULL;
30883128
size_t server_map_len = 0, forward_map_len = 0;
30893129
memcached_return rc;
30903130
MEMC_METHOD_INIT_VARS;
30913131

3092-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "aa!l", &zserver_map, &zforward_map, &replicas) == FAILURE) {
3093-
return;
3094-
}
3132+
/* aa!l */
3133+
ZEND_PARSE_PARAMETERS_START(3, 3)
3134+
Z_PARAM_ARRAY(zserver_map)
3135+
Z_PARAM_ARRAY_EX(zforward_map, 1, 0)
3136+
Z_PARAM_LONG(replicas)
3137+
ZEND_PARSE_PARAMETERS_END();
30953138

30963139
MEMC_METHOD_FETCH_OBJECT;
30973140

@@ -3152,9 +3195,11 @@ static PHP_METHOD(Memcached, setOptions)
31523195

31533196
MEMC_METHOD_INIT_VARS;
31543197

3155-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &options) == FAILURE) {
3156-
return;
3157-
}
3198+
/* a */
3199+
ZEND_PARSE_PARAMETERS_START(1, 1)
3200+
Z_PARAM_ARRAY(options)
3201+
ZEND_PARSE_PARAMETERS_END();
3202+
31583203

31593204
MEMC_METHOD_FETCH_OBJECT;
31603205

@@ -3177,13 +3222,15 @@ static PHP_METHOD(Memcached, setOptions)
31773222
Sets the value for the given option constant */
31783223
static PHP_METHOD(Memcached, setOption)
31793224
{
3180-
long option;
3225+
zend_long option;
31813226
zval *value;
31823227
MEMC_METHOD_INIT_VARS;
31833228

3184-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz/", &option, &value) == FAILURE) {
3185-
return;
3186-
}
3229+
/* lz/ */
3230+
ZEND_PARSE_PARAMETERS_START(2, 2)
3231+
Z_PARAM_LONG(option)
3232+
Z_PARAM_ZVAL_EX(value, 0, 1)
3233+
ZEND_PARSE_PARAMETERS_END();
31873234

31883235
MEMC_METHOD_FETCH_OBJECT;
31893236

@@ -3200,9 +3247,11 @@ static PHP_METHOD(Memcached, setSaslAuthData)
32003247
memcached_return status;
32013248
zend_string *user, *pass;
32023249

3203-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &user, &pass) == FAILURE) {
3204-
return;
3205-
}
3250+
/* SS/ */
3251+
ZEND_PARSE_PARAMETERS_START(2, 2)
3252+
Z_PARAM_STR(user)
3253+
Z_PARAM_STR(pass)
3254+
ZEND_PARSE_PARAMETERS_END();
32063255

32073256
if (!php_memc_init_sasl_if_needed()) {
32083257
RETURN_FALSE;
@@ -3684,9 +3733,10 @@ PHP_METHOD(MemcachedServer, run)
36843733
php_memc_server_t *intern;
36853734
intern = Z_MEMC_SERVER_P(getThis());
36863735

3687-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &address) == FAILURE) {
3688-
return;
3689-
}
3736+
/* S */
3737+
ZEND_PARSE_PARAMETERS_START(1, 1)
3738+
Z_PARAM_STR(address)
3739+
ZEND_PARSE_PARAMETERS_END();
36903740

36913741
rc = php_memc_proto_handler_run(intern->handler, address);
36923742

@@ -3705,9 +3755,11 @@ PHP_METHOD(MemcachedServer, on)
37053755
zend_fcall_info_cache fci_cache;
37063756
zend_bool rc = 0;
37073757

3708-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lf!", &event, &fci, &fci_cache) == FAILURE) {
3709-
return;
3710-
}
3758+
/* lf! */
3759+
ZEND_PARSE_PARAMETERS_START(2, 2)
3760+
Z_PARAM_LONG(event)
3761+
Z_PARAM_FUNC_EX(fci, fci_cache, 1, 0)
3762+
ZEND_PARSE_PARAMETERS_END();
37113763

37123764
if (event <= MEMC_SERVER_ON_MIN || event >= MEMC_SERVER_ON_MAX) {
37133765
RETURN_FALSE;

0 commit comments

Comments
 (0)
Please sign in to comment.