Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions php_memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,15 @@ static void php_memc_deleteMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by
static void php_memc_getDelayed_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key);
static memcached_return php_memc_do_cache_callback(zval *memc_obj, zend_fcall_info *fci, zend_fcall_info_cache *fcc, char *key, size_t key_len, zval *value TSRMLS_DC);
static int php_memc_do_result_callback(zval *memc_obj, zend_fcall_info *fci, zend_fcall_info_cache *fcc, memcached_result_st *result TSRMLS_DC);
#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX >= 0x01000009
static memcached_return php_memc_do_serverlist_callback(const memcached_st *ptr, const memcached_instance_st *instance, void *in_context);
static memcached_return php_memc_do_stats_callback(const memcached_st *ptr, const memcached_instance_st *instance, void *in_context);
static memcached_return php_memc_do_version_callback(const memcached_st *ptr, const memcached_instance_st *instance, void *in_context);
#else
static memcached_return php_memc_do_serverlist_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context);
static memcached_return php_memc_do_stats_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context);
static memcached_return php_memc_do_version_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context);
#endif
static void php_memc_destroy(struct memc_obj *m_obj, zend_bool persistent TSRMLS_DC);

/****************************************
Expand Down Expand Up @@ -1862,7 +1868,7 @@ PHP_METHOD(Memcached, addServers)
zval **z_host, **z_port, **z_weight = NULL;
uint32_t weight = 0;
int entry_size, i = 0;
memcached_server_st *list = NULL;
memcached_server_list_st list = NULL;
memcached_return status;
MEMC_METHOD_INIT_VARS;

Expand Down Expand Up @@ -1965,7 +1971,11 @@ PHP_METHOD(Memcached, getServerByKey)
{
char *server_key;
int server_key_len;
#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX >= 0x01000009
memcached_instance_st *server_instance;
#else
memcached_server_instance_st *server_instance;
#endif
memcached_return error;
MEMC_METHOD_INIT_VARS;

Expand All @@ -1990,7 +2000,6 @@ PHP_METHOD(Memcached, getServerByKey)
array_init(return_value);
add_assoc_string(return_value, "host", (char*) memcached_server_name(server_instance), 1);
add_assoc_long(return_value, "port", memcached_server_port(server_instance));
add_assoc_long(return_value, "weight", 0);
}
/* }}} */

Expand Down Expand Up @@ -2083,7 +2092,11 @@ PHP_METHOD(Memcached, getLastErrorErrno)
Was added in 0.34 according to libmemcached's Changelog */
PHP_METHOD(Memcached, getLastDisconnectedServer)
{
#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX >= 0x01000009
memcached_instance_st *server_instance;
#else
memcached_server_instance_st *server_instance;
#endif
MEMC_METHOD_INIT_VARS;

if (zend_parse_parameters_none() == FAILURE) {
Expand Down Expand Up @@ -2660,7 +2673,11 @@ ZEND_RSRC_DTOR_FUNC(php_memc_sess_dtor)
/* }}} */

/* {{{ internal API functions */
#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX >= 0x01000009
static memcached_return php_memc_do_serverlist_callback(const memcached_st *ptr, const memcached_instance_st *instance, void *in_context)
#else
static memcached_return php_memc_do_serverlist_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context)
#endif
{
struct callbackContext* context = (struct callbackContext*) in_context;
zval *array;
Expand All @@ -2678,7 +2695,11 @@ static memcached_return php_memc_do_serverlist_callback(const memcached_st *ptr,
return MEMCACHED_SUCCESS;
}

#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX >= 0x01000009
static memcached_return php_memc_do_stats_callback(const memcached_st *ptr, const memcached_instance_st *instance, void *in_context)
#else
static memcached_return php_memc_do_stats_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context)
#endif
{
char *hostport = NULL;
int hostport_len;
Expand Down Expand Up @@ -2722,7 +2743,11 @@ static memcached_return php_memc_do_stats_callback(const memcached_st *ptr, memc
return MEMCACHED_SUCCESS;
}

#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX >= 0x01000009
static memcached_return php_memc_do_version_callback(const memcached_st *ptr, const memcached_instance_st *instance, void *in_context)
#else
static memcached_return php_memc_do_version_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context)
#endif
{
char *hostport = NULL;
char version[16];
Expand Down