mirror of
https://github.com/php-win-ext/php-memcached.git
synced 2026-03-24 00:52:18 +01:00
Use new fast_zpp parameter parsing API (#311)
The one that took a while to figure out was zpp("f!") to Z_PARAM_FUNC_EX(fci, fcc, 1, 0)
This commit is contained in:
368
php_memcached.c
368
php_memcached.c
@@ -1184,9 +1184,13 @@ static PHP_METHOD(Memcached, __construct)
|
||||
|
||||
zend_bool is_persistent = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!f!S", &persistent_id, &fci, &fci_cache, &conn_str) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "|S!f!S" */
|
||||
ZEND_PARSE_PARAMETERS_START(0, 3)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STR_EX(persistent_id, 1, 0)
|
||||
Z_PARAM_FUNC_EX(fci, fci_cache, 1, 0)
|
||||
Z_PARAM_STR(conn_str)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
intern = Z_MEMC_OBJ_P(getThis());
|
||||
intern->is_pristine = 1;
|
||||
@@ -1413,13 +1417,22 @@ void php_memc_get_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key)
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (by_key) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|f!l", &server_key, &key, &fci, &fcc, &get_flags) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "SS|f!l" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 4)
|
||||
Z_PARAM_STR(server_key)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_FUNC_EX(fci, fcc, 1, 0)
|
||||
Z_PARAM_LONG(get_flags)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|f!l", &key, &fci, &fcc, &get_flags) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "S|f!l" */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 3)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_FUNC_EX(fci, fcc, 1, 0)
|
||||
Z_PARAM_LONG(get_flags)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
}
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
@@ -1505,14 +1518,20 @@ static void php_memc_getMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_ke
|
||||
zend_bool retval, preserve_order;
|
||||
|
||||
if (by_key) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sa|l", &server_key,
|
||||
&keys, &flags) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "Sa|l" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 3)
|
||||
Z_PARAM_STR(server_key)
|
||||
Z_PARAM_ARRAY(keys)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(flags)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|l", &keys, &flags) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "a|l" */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_ARRAY(keys)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(flags)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
}
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
@@ -1642,15 +1661,22 @@ static void php_memc_getDelayed_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_
|
||||
|
||||
|
||||
if (by_key) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sa/|bf!", &server_key,
|
||||
&keys, &with_cas, &fci, &fcc) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "Sa/|bf!" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 4)
|
||||
Z_PARAM_STR(server_key)
|
||||
Z_PARAM_ARRAY_EX(keys, 0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(with_cas)
|
||||
Z_PARAM_FUNC_EX(fci, fcc, 1, 0)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/|bf!", &keys, &with_cas,
|
||||
&fci, &fcc) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "a/|bf!" */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 3)
|
||||
Z_PARAM_ARRAY_EX(keys, 0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(with_cas)
|
||||
Z_PARAM_FUNC_EX(fci, fcc, 1, 0)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
}
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
@@ -1796,7 +1822,7 @@ static void php_memc_setMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_ke
|
||||
{
|
||||
zval *entries;
|
||||
zend_string *server_key = NULL;
|
||||
time_t expiration = 0;
|
||||
zend_long expiration = 0, ignored;
|
||||
zval *value;
|
||||
zend_string *skey;
|
||||
zend_ulong num_key;
|
||||
@@ -1804,14 +1830,22 @@ static void php_memc_setMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_ke
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (by_key) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sa|ll", &server_key,
|
||||
&entries, &expiration) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "Sa|ll" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 4)
|
||||
Z_PARAM_STR(server_key)
|
||||
Z_PARAM_ARRAY(entries)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(expiration)
|
||||
Z_PARAM_LONG(ignored)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|ll", &entries, &expiration) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "a|ll" */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 3)
|
||||
Z_PARAM_ARRAY(entries)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(expiration)
|
||||
Z_PARAM_LONG(ignored)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
}
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
@@ -1921,35 +1955,56 @@ static void php_memc_store_impl(INTERNAL_FUNCTION_PARAMETERS, int op, zend_bool
|
||||
|
||||
if (by_key) {
|
||||
if (op == MEMC_OP_APPEND || op == MEMC_OP_PREPEND) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SSS", &server_key, &key, &s_value) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "SSS" */
|
||||
ZEND_PARSE_PARAMETERS_START(3, 3)
|
||||
Z_PARAM_STR(server_key)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_STR(s_value)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
value = &s_zvalue;
|
||||
ZVAL_STR(value, s_value);
|
||||
} else if (op == MEMC_OP_TOUCH) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|l", &server_key, &key, &expiration) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "SS|l" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 3)
|
||||
Z_PARAM_STR(server_key)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(expiration)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SSz|l", &server_key, &key, &value, &expiration) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "SSz|l" */
|
||||
ZEND_PARSE_PARAMETERS_START(3, 4)
|
||||
Z_PARAM_STR(server_key)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_ZVAL(value)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(expiration)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
}
|
||||
} else {
|
||||
if (op == MEMC_OP_APPEND || op == MEMC_OP_PREPEND) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &key, &s_value) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "SS" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 2)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_STR(s_value)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
value = &s_zvalue;
|
||||
ZVAL_STR(value, s_value);
|
||||
} else if (op == MEMC_OP_TOUCH) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|l", &key, &expiration) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "S|l */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(expiration)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", &key, &value, &expiration) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "Sz|l" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 3)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_ZVAL(value)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(expiration)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1984,22 +2039,34 @@ static void php_memc_cas_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key)
|
||||
zend_string *key;
|
||||
zend_string *server_key = NULL;
|
||||
zval *value;
|
||||
time_t expiration = 0;
|
||||
zend_long expiration = 0;
|
||||
zend_long ignored;
|
||||
zend_string *payload;
|
||||
uint32_t flags = 0;
|
||||
memcached_return status;
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (by_key) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zSSz|ll", &zv_cas, &server_key, &key,
|
||||
&value, &expiration) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "zSSz|ll" */
|
||||
ZEND_PARSE_PARAMETERS_START(4, 6)
|
||||
Z_PARAM_ZVAL(zv_cas)
|
||||
Z_PARAM_STR(server_key)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_ZVAL(value)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(expiration)
|
||||
Z_PARAM_LONG(ignored)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zSz|ll", &zv_cas, &key, &value,
|
||||
&expiration) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "zSz|ll" */
|
||||
ZEND_PARSE_PARAMETERS_START(3, 5)
|
||||
Z_PARAM_ZVAL(zv_cas)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_ZVAL(value)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(expiration)
|
||||
Z_PARAM_LONG(ignored)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
}
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
@@ -2081,18 +2148,25 @@ PHP_METHOD(Memcached, deleteMultiByKey)
|
||||
static void php_memc_delete_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key)
|
||||
{
|
||||
zend_string *key, *server_key;
|
||||
time_t expiration = 0;
|
||||
zend_long expiration = 0;
|
||||
memcached_return status;
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (by_key) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|l", &server_key, &key, &expiration) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "SS|l" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 3)
|
||||
Z_PARAM_STR(server_key)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(expiration)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|l", &key, &expiration) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "S|l" */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(expiration)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
server_key = key;
|
||||
}
|
||||
|
||||
@@ -2120,20 +2194,27 @@ static void php_memc_deleteMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by
|
||||
{
|
||||
zval *entries, *zv, ret;
|
||||
zend_string *server_key = NULL;
|
||||
time_t expiration = 0;
|
||||
zend_long expiration = 0;
|
||||
zend_string *entry;
|
||||
|
||||
memcached_return status;
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (by_key) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sa/|l", &server_key, &entries, &expiration) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "Sa/|l" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 3)
|
||||
Z_PARAM_STR(server_key)
|
||||
Z_PARAM_ARRAY_EX(entries, 0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(expiration)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/|l", &entries, &expiration) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "a/|l" */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_ARRAY_EX(entries, 0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(expiration)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
}
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
@@ -2172,21 +2253,33 @@ static void php_memc_incdec_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key,
|
||||
{
|
||||
zend_string *key, *server_key = NULL;
|
||||
zend_long offset = 1;
|
||||
uint64_t value = UINT64_MAX, initial = 0;
|
||||
time_t expiry = 0;
|
||||
zend_long expiry = 0;
|
||||
zend_long initial = 0;
|
||||
uint64_t value = UINT64_MAX;
|
||||
memcached_return status;
|
||||
int n_args = ZEND_NUM_ARGS();
|
||||
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (!by_key) {
|
||||
if (zend_parse_parameters(n_args, "S|lll", &key, &offset, &initial, &expiry) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "S|lll" */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 4)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(offset)
|
||||
Z_PARAM_LONG(initial)
|
||||
Z_PARAM_LONG(expiry)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
} else {
|
||||
if (zend_parse_parameters(n_args, "SS|lll", &server_key, &key, &offset, &initial, &expiry) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "SS|lll" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 5)
|
||||
Z_PARAM_STR(server_key)
|
||||
Z_PARAM_STR(key)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(offset)
|
||||
Z_PARAM_LONG(initial)
|
||||
Z_PARAM_LONG(expiry)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
}
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
@@ -2228,15 +2321,15 @@ retry_inc_dec:
|
||||
}
|
||||
if (by_key) {
|
||||
if (incr) {
|
||||
status = memcached_increment_with_initial_by_key(intern->memc, ZSTR_VAL(server_key), ZSTR_LEN(server_key), ZSTR_VAL(key), ZSTR_LEN(key), offset, initial, expiry, &value);
|
||||
status = memcached_increment_with_initial_by_key(intern->memc, ZSTR_VAL(server_key), ZSTR_LEN(server_key), ZSTR_VAL(key), ZSTR_LEN(key), offset, initial, (time_t)expiry, &value);
|
||||
} else {
|
||||
status = memcached_decrement_with_initial_by_key(intern->memc, ZSTR_VAL(server_key), ZSTR_LEN(server_key), ZSTR_VAL(key), ZSTR_LEN(key), offset, initial, expiry, &value);
|
||||
status = memcached_decrement_with_initial_by_key(intern->memc, ZSTR_VAL(server_key), ZSTR_LEN(server_key), ZSTR_VAL(key), ZSTR_LEN(key), offset, initial, (time_t)expiry, &value);
|
||||
}
|
||||
} else {
|
||||
if (incr) {
|
||||
status = memcached_increment_with_initial(intern->memc, ZSTR_VAL(key), ZSTR_LEN(key), offset, initial, expiry, &value);
|
||||
status = memcached_increment_with_initial(intern->memc, ZSTR_VAL(key), ZSTR_LEN(key), offset, initial, (time_t)expiry, &value);
|
||||
} else {
|
||||
status = memcached_decrement_with_initial(intern->memc, ZSTR_VAL(key), ZSTR_LEN(key), offset, initial, expiry, &value);
|
||||
status = memcached_decrement_with_initial(intern->memc, ZSTR_VAL(key), ZSTR_LEN(key), offset, initial, (time_t)expiry, &value);
|
||||
}
|
||||
}
|
||||
if (s_should_retry_write(intern, status) && retries-- > 0) {
|
||||
@@ -2293,13 +2386,17 @@ PHP_METHOD(Memcached, incrementByKey)
|
||||
PHP_METHOD(Memcached, addServer)
|
||||
{
|
||||
zend_string *host;
|
||||
long port, weight = 0;
|
||||
zend_long port, weight = 0;
|
||||
memcached_return status;
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl|l", &host, &port, &weight) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "Sa/|l" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 3)
|
||||
Z_PARAM_STR(host)
|
||||
Z_PARAM_LONG(port)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(weight)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
|
||||
@@ -2327,9 +2424,10 @@ PHP_METHOD(Memcached, addServers)
|
||||
memcached_return status;
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/", &servers) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "a/" */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_ARRAY_EX(servers, 0, 1)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
|
||||
@@ -2431,9 +2529,10 @@ PHP_METHOD(Memcached, getServerByKey)
|
||||
memcached_return error;
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &server_key) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "S" */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(server_key)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
|
||||
@@ -2651,9 +2750,11 @@ PHP_METHOD(Memcached, getStats)
|
||||
zend_string *args_string = NULL;
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!", &args_string) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "|S!" */
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STR_EX(args_string, 1, 0)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -2745,13 +2846,15 @@ PHP_METHOD(Memcached, getAllKeys)
|
||||
Flushes the data on all the servers */
|
||||
static PHP_METHOD(Memcached, flush)
|
||||
{
|
||||
time_t delay = 0;
|
||||
zend_long delay = 0;
|
||||
memcached_return status;
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &delay) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "|l" */
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(delay)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
s_memc_set_status(intern, MEMCACHED_SUCCESS, 0);
|
||||
@@ -2769,14 +2872,15 @@ static PHP_METHOD(Memcached, flush)
|
||||
Returns the value for the given option constant */
|
||||
static PHP_METHOD(Memcached, getOption)
|
||||
{
|
||||
long option;
|
||||
zend_long option;
|
||||
uint64_t result;
|
||||
memcached_behavior flag;
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &option) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "l" */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(option)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -3018,7 +3122,7 @@ PHP_METHOD(Memcached, setBucket)
|
||||
{
|
||||
zval *zserver_map;
|
||||
zval *zforward_map = NULL;
|
||||
long replicas = 0;
|
||||
zend_long replicas = 0;
|
||||
zend_bool retval = 1;
|
||||
|
||||
uint32_t *server_map = NULL, *forward_map = NULL;
|
||||
@@ -3026,9 +3130,12 @@ PHP_METHOD(Memcached, setBucket)
|
||||
memcached_return rc;
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "aa!l", &zserver_map, &zforward_map, &replicas) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "aa!l" */
|
||||
ZEND_PARSE_PARAMETERS_START(3, 3)
|
||||
Z_PARAM_ARRAY(zserver_map)
|
||||
Z_PARAM_ARRAY_EX(zforward_map, 1, 0)
|
||||
Z_PARAM_LONG(replicas)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -3089,9 +3196,11 @@ static PHP_METHOD(Memcached, setOptions)
|
||||
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "a" */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_ARRAY(options)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -3114,13 +3223,15 @@ static PHP_METHOD(Memcached, setOptions)
|
||||
Sets the value for the given option constant */
|
||||
static PHP_METHOD(Memcached, setOption)
|
||||
{
|
||||
long option;
|
||||
zend_long option;
|
||||
zval *value;
|
||||
MEMC_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz/", &option, &value) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "lz/" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 2)
|
||||
Z_PARAM_LONG(option)
|
||||
Z_PARAM_ZVAL_EX(value, 0, 1)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
MEMC_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -3137,9 +3248,11 @@ static PHP_METHOD(Memcached, setSaslAuthData)
|
||||
memcached_return status;
|
||||
zend_string *user, *pass;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &user, &pass) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "SS/" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 2)
|
||||
Z_PARAM_STR(user)
|
||||
Z_PARAM_STR(pass)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (!php_memc_init_sasl_if_needed()) {
|
||||
RETURN_FALSE;
|
||||
@@ -3621,9 +3734,10 @@ PHP_METHOD(MemcachedServer, run)
|
||||
php_memc_server_t *intern;
|
||||
intern = Z_MEMC_SERVER_P(getThis());
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &address) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "S" */
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(address)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
rc = php_memc_proto_handler_run(intern->handler, address);
|
||||
|
||||
@@ -3642,9 +3756,11 @@ PHP_METHOD(MemcachedServer, on)
|
||||
zend_fcall_info_cache fci_cache;
|
||||
zend_bool rc = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lf!", &event, &fci, &fci_cache) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/* "lf!" */
|
||||
ZEND_PARSE_PARAMETERS_START(2, 2)
|
||||
Z_PARAM_LONG(event)
|
||||
Z_PARAM_FUNC_EX(fci, fci_cache, 1, 0)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (event <= MEMC_SERVER_ON_MIN || event >= MEMC_SERVER_ON_MAX) {
|
||||
RETURN_FALSE;
|
||||
|
||||
Reference in New Issue
Block a user