[W_FAIL=""])
#[W_FAIL="-Werror"])
- BASE_WARNINGS="-pedantic -Wall -Wextra ${W_FAIL} -Wundef -Wshadow -Wmissing-declarations -Wstrict-aliasing -Wformat=2 ${F_DIAGNOSTICS_SHOW_OPTION} ${W_CONVERSION}"
+ BASE_WARNINGS="-pedantic -Wall -Wextra ${W_FAIL} -Wundef -Wshadow -Wmissing-declarations -Wstrict-aliasing -Wformat=2 ${F_DIAGNOSTICS_SHOW_OPTION} ${W_CONVERSION} ${CFLAG_VISIBILITY}"
CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wswitch-default -Wswitch-enum -Wcast-align"
CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wold-style-cast -Weffc++ -Wno-long-long"
libmemcachedcallbacks_la_CFLAGS = ${AM_CFLAGS} ${NO_STRICT_ALIASING}
libmemcachedcallbacks_la_SOURCES = memcached_callback.c
-libmemcached_la_CFLAGS= ${AM_CFLAGS} ${NO_CONVERSION} -DBUILDING_LIBMEMCACHED
+libmemcached_la_CFLAGS= ${AM_CFLAGS} ${NO_CONVERSION}
libmemcached_la_SOURCES = crc.c \
memcached.c \
memcached_auto.c \
# endif
#endif
+/* Define this here, which will turn on the visibilty controls while we're
+ * building libmemcached.
+ */
+#define BUILDING_LIBMEMCACHED 1
+
#include "libmemcached/memcached.h"
#include "libmemcached/memcached_watchpoint.h"
-#if defined(BUILDING_LIBMEMCACHED)
/* These are private not to be installed headers */
#include "libmemcached/memcached_io.h"
#include "libmemcached/memcached_internal.h"
uint32_t value;
};
-#endif
-
-
-
#if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
MEM_AUTO_EJECT_HOSTS= (1 << 16)
} memcached_flags;
-#if defined(BUILDING_LIBMEMCACHED)
/* Hashing algo */
+
+LIBMEMCACHED_LOCAL
void md5_signature(const unsigned char *key, unsigned int length, unsigned char *result);
+LIBMEMCACHED_LOCAL
uint32_t hash_crc32(const char *data,
size_t data_len);
#ifdef HAVE_HSIEH_HASH
+LIBMEMCACHED_LOCAL
uint32_t hsieh_hash(const char *key, size_t key_length);
#endif
+LIBMEMCACHED_LOCAL
uint32_t murmur_hash(const char *key, size_t key_length);
+LIBMEMCACHED_LOCAL
uint32_t jenkins_hash(const void *key, size_t length, uint32_t initval);
+LIBMEMCACHED_LOCAL
memcached_return memcached_connect(memcached_server_st *ptr);
+LIBMEMCACHED_LOCAL
memcached_return memcached_response(memcached_server_st *ptr,
char *buffer, size_t buffer_length,
memcached_result_st *result);
+LIBMEMCACHED_LOCAL
void memcached_quit_server(memcached_server_st *ptr, uint8_t io_death);
#define memcached_server_response_increment(A) (A)->cursor_active++
#define memcached_server_response_decrement(A) (A)->cursor_active--
#define memcached_server_response_reset(A) (A)->cursor_active=0
+LIBMEMCACHED_LOCAL
memcached_return memcached_do(memcached_server_st *ptr, const void *commmand,
size_t command_length, uint8_t with_flush);
-memcached_return memcached_version(memcached_st *ptr);
+LIBMEMCACHED_LOCAL
memcached_return value_fetch(memcached_server_st *ptr,
char *buffer,
memcached_result_st *result);
+LIBMEMCACHED_LOCAL
void server_list_free(memcached_st *ptr, memcached_server_st *servers);
+LIBMEMCACHED_LOCAL
memcached_return memcached_key_test(char **keys, size_t *key_length,
unsigned int number_of_keys);
-memcached_return run_distribution(memcached_st *ptr);
+LIBMEMCACHED_LOCAL
uint32_t generate_hash(memcached_st *ptr, const char *key, size_t key_length);
-memcached_return memcached_server_remove(memcached_server_st *st_ptr);
#ifndef HAVE_HTONLL
+LIBMEMCACHED_LOCAL
extern uint64_t ntohll(uint64_t);
+LIBMEMCACHED_LOCAL
extern uint64_t htonll(uint64_t);
#endif
+LIBMEMCACHED_LOCAL
memcached_return memcached_purge(memcached_server_st *ptr);
static inline memcached_return memcached_validate_key_length(size_t key_length,
return MEMCACHED_SUCCESS;
}
-#endif /* BUILDING_LIBMEMCACHED */
-#endif /* !defined(LIBMEMCACHED_COMMON_H) && defined(BUILDING_LIBMEMCACHED) */
+#endif /* LIBMEMCACHED_COMMON_H */
#include <sys/types.h>
#include <netinet/in.h>
+#include <libmemcached/visibility.h>
#include <libmemcached/memcached_configure.h>
#include <libmemcached/memcached_constants.h>
#include <libmemcached/memcached_types.h>
#include <libmemcached/memcached_server.h>
#include <libmemcached/memcached_string.h>
#include <libmemcached/memcached_result.h>
+#include <libmemcached/memcached_storage.h>
#ifdef __cplusplus
extern "C" {
uint32_t number_of_replicas;
};
+LIBMEMCACHED_API
+memcached_return memcached_version(memcached_st *ptr);
/* Public API */
+
+LIBMEMCACHED_API
const char * memcached_lib_version(void);
+LIBMEMCACHED_API
memcached_st *memcached_create(memcached_st *ptr);
+LIBMEMCACHED_API
void memcached_free(memcached_st *ptr);
+LIBMEMCACHED_API
memcached_st *memcached_clone(memcached_st *clone, memcached_st *ptr);
+LIBMEMCACHED_API
memcached_return memcached_delete(memcached_st *ptr, const char *key, size_t key_length,
time_t expiration);
+LIBMEMCACHED_API
memcached_return memcached_increment(memcached_st *ptr,
const char *key, size_t key_length,
uint32_t offset,
uint64_t *value);
+LIBMEMCACHED_API
memcached_return memcached_decrement(memcached_st *ptr,
const char *key, size_t key_length,
uint32_t offset,
uint64_t *value);
+LIBMEMCACHED_API
memcached_return memcached_increment_with_initial(memcached_st *ptr,
const char *key,
size_t key_length,
uint64_t initial,
time_t expiration,
uint64_t *value);
+LIBMEMCACHED_API
memcached_return memcached_decrement_with_initial(memcached_st *ptr,
const char *key,
size_t key_length,
uint64_t initial,
time_t expiration,
uint64_t *value);
+LIBMEMCACHED_API
void memcached_stat_free(memcached_st *, memcached_stat_st *);
+LIBMEMCACHED_API
memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_return *error);
+LIBMEMCACHED_API
memcached_return memcached_stat_servername(memcached_stat_st *stat, char *args,
char *hostname, unsigned int port);
+LIBMEMCACHED_API
memcached_return memcached_flush(memcached_st *ptr, time_t expiration);
+LIBMEMCACHED_API
memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbosity);
+LIBMEMCACHED_API
void memcached_quit(memcached_st *ptr);
+LIBMEMCACHED_API
char *memcached_strerror(memcached_st *ptr, memcached_return rc);
+LIBMEMCACHED_API
memcached_return memcached_behavior_set(memcached_st *ptr, memcached_behavior flag, uint64_t data);
+LIBMEMCACHED_API
uint64_t memcached_behavior_get(memcached_st *ptr, memcached_behavior flag);
/* The two public hash bits */
+LIBMEMCACHED_API
uint32_t memcached_generate_hash_value(const char *key, size_t key_length, memcached_hash hash_algorithm);
+LIBMEMCACHED_API
uint32_t memcached_generate_hash(memcached_st *ptr, const char *key, size_t key_length);
+LIBMEMCACHED_API
memcached_return memcached_flush_buffers(memcached_st *mem);
/* Server Public functions */
+LIBMEMCACHED_API
memcached_return memcached_server_add_udp(memcached_st *ptr,
const char *hostname,
unsigned int port);
+LIBMEMCACHED_API
memcached_return memcached_server_add_unix_socket(memcached_st *ptr,
const char *filename);
+LIBMEMCACHED_API
memcached_return memcached_server_add(memcached_st *ptr, const char *hostname,
unsigned int port);
+LIBMEMCACHED_API
memcached_return memcached_server_add_udp_with_weight(memcached_st *ptr,
const char *hostname,
unsigned int port,
uint32_t weight);
+LIBMEMCACHED_API
memcached_return memcached_server_add_unix_socket_with_weight(memcached_st *ptr,
const char *filename,
uint32_t weight);
+LIBMEMCACHED_API
memcached_return memcached_server_add_with_weight(memcached_st *ptr, const char *hostname,
unsigned int port,
uint32_t weight);
+LIBMEMCACHED_API
void memcached_server_list_free(memcached_server_st *ptr);
+LIBMEMCACHED_API
memcached_return memcached_server_push(memcached_st *ptr, memcached_server_st *list);
+LIBMEMCACHED_API
memcached_server_st *memcached_server_list_append(memcached_server_st *ptr,
const char *hostname,
unsigned int port,
memcached_return *error);
+LIBMEMCACHED_API
memcached_server_st *memcached_server_list_append_with_weight(memcached_server_st *ptr,
const char *hostname,
unsigned int port,
uint32_t weight,
memcached_return *error);
+LIBMEMCACHED_API
unsigned int memcached_server_list_count(memcached_server_st *ptr);
+LIBMEMCACHED_API
memcached_server_st *memcached_servers_parse(const char *server_strings);
+LIBMEMCACHED_API
char *memcached_stat_get_value(memcached_st *ptr, memcached_stat_st *stat,
const char *key, memcached_return *error);
+LIBMEMCACHED_API
char ** memcached_stat_get_keys(memcached_st *ptr, memcached_stat_st *stat,
memcached_return *error);
+LIBMEMCACHED_API
memcached_return memcached_delete_by_key(memcached_st *ptr,
const char *master_key, size_t master_key_length,
const char *key, size_t key_length,
time_t expiration);
+LIBMEMCACHED_API
memcached_return memcached_fetch_execute(memcached_st *ptr,
memcached_execute_function *callback,
void *context,
unsigned int number_of_callbacks);
+LIBMEMCACHED_API
memcached_return memcached_callback_set(memcached_st *ptr,
memcached_callback flag,
void *data);
+LIBMEMCACHED_API
void *memcached_callback_get(memcached_st *ptr,
memcached_callback flag,
memcached_return *error);
+LIBMEMCACHED_API
memcached_return memcached_dump(memcached_st *ptr, memcached_dump_func *function, void *context, uint32_t number_of_callbacks);
+LIBMEMCACHED_API
memcached_return memcached_set_memory_allocators(memcached_st *ptr,
memcached_malloc_function mem_malloc,
memcached_free_function mem_free,
memcached_realloc_function mem_realloc,
memcached_calloc_function mem_calloc);
+LIBMEMCACHED_API
void memcached_get_memory_allocators(memcached_st *ptr,
memcached_malloc_function *mem_malloc,
memcached_free_function *mem_free,
memcached_realloc_function *mem_realloc,
memcached_calloc_function *mem_calloc);
+LIBMEMCACHED_API
void *memcached_get_user_data(memcached_st *ptr);
+LIBMEMCACHED_API
void *memcached_set_user_data(memcached_st *ptr, void *data);
+LIBMEMCACHED_API
+memcached_return run_distribution(memcached_st *ptr);
#ifdef __cplusplus
}
#endif
-#include <libmemcached/memcached_storage.h>
#endif /* __MEMCACHED_H__ */
#ifndef __MEMCACHED_CONSTANTS_H__
#define __MEMCACHED_CONSTANTS_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Public defines */
#define MEMCACHED_DEFAULT_PORT 11211
#define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */
MEMCACHED_CONNECTION_UNIX_SOCKET
} memcached_connection;
-#ifdef __cplusplus
-}
-#endif
-
#endif /* __MEMCACHED_CONSTANTS_H__ */
#endif
/* Public defines */
+LIBMEMCACHED_API
char *memcached_get(memcached_st *ptr,
const char *key, size_t key_length,
size_t *value_length,
uint32_t *flags,
memcached_return *error);
+LIBMEMCACHED_API
memcached_return memcached_mget(memcached_st *ptr,
char **keys, size_t *key_length,
unsigned int number_of_keys);
+LIBMEMCACHED_API
char *memcached_get_by_key(memcached_st *ptr,
const char *master_key, size_t master_key_length,
const char *key, size_t key_length,
uint32_t *flags,
memcached_return *error);
+LIBMEMCACHED_API
memcached_return memcached_mget_by_key(memcached_st *ptr,
const char *master_key, size_t
master_key_length,
size_t *key_length,
unsigned int number_of_keys);
+LIBMEMCACHED_API
char *memcached_fetch(memcached_st *ptr,
char *key, size_t *key_length,
size_t *value_length, uint32_t *flags,
memcached_return *error);
+LIBMEMCACHED_API
memcached_result_st *memcached_fetch_result(memcached_st *ptr,
memcached_result_st *result,
memcached_return *error);
extern "C" {
#endif
+LIBMEMCACHED_LOCAL
void libmemcached_free(memcached_st *ptr, void *mem);
+LIBMEMCACHED_LOCAL
void *libmemcached_malloc(memcached_st *ptr, const size_t size);
+LIBMEMCACHED_LOCAL
void *libmemcached_realloc(memcached_st *ptr, void *mem, const size_t size);
+LIBMEMCACHED_LOCAL
void *libmemcached_calloc(memcached_st *ptr, size_t nelem, size_t size);
#ifdef __cplusplus
Frankly its too damn useful not to be here though.
*/
-#include "libmemcached/memcached.h"
#include "common.h"
memcached_server_st *memcached_servers_parse(const char *server_strings)
struct memcached_pool_st;
typedef struct memcached_pool_st memcached_pool_st;
+
+LIBMEMCACHED_API
memcached_pool_st *memcached_pool_create(memcached_st* mmc, uint32_t initial,
uint32_t max);
+LIBMEMCACHED_API
memcached_st* memcached_pool_destroy(memcached_pool_st* pool);
+LIBMEMCACHED_API
memcached_st* memcached_pool_pop(memcached_pool_st* pool,
bool block,
memcached_return* rc);
+LIBMEMCACHED_API
memcached_return memcached_pool_push(memcached_pool_st* pool,
memcached_st* mmc);
};
/* Result Struct */
+LIBMEMCACHED_API
void memcached_result_free(memcached_result_st *result);
+LIBMEMCACHED_API
void memcached_result_reset(memcached_result_st *ptr);
+LIBMEMCACHED_API
memcached_result_st *memcached_result_create(memcached_st *ptr,
memcached_result_st *result);
#define memcached_result_key_value(A) (A)->key
#define memcached_result_value(A) memcached_string_value((A)->value)
#define memcached_result_length(A) memcached_string_length((A)->value)
#else
+LIBMEMCACHED_API
char *memcached_result_value(memcached_result_st *ptr);
+LIBMEMCACHED_API
size_t memcached_result_length(memcached_result_st *ptr);
#endif
#define memcached_result_flags(A) (A)->flags
#define memcached_result_cas(A) (A)->cas
+LIBMEMCACHED_API
memcached_return memcached_result_set_value(memcached_result_st *ptr, char *value, size_t length);
#define memcached_result_set_flags(A,B) (A)->flags=(B)
#define memcached_result_set_expiration(A,B) (A)->expiration=(B)
#define memcached_server_list(A) (A)->hosts
#define memcached_server_response_count(A) (A)->cursor_active
+LIBMEMCACHED_API
memcached_return memcached_server_cursor(memcached_st *ptr,
memcached_server_function *callback,
void *context,
unsigned int number_of_callbacks);
+LIBMEMCACHED_API
memcached_server_st *memcached_server_by_key(memcached_st *ptr, const char *key,
size_t key_length, memcached_return *error);
/* These should not currently be used by end users */
+/* TODO: Is the above comment valid? If so, how can we unit test these if they
+ * aren't exported. If not, we should remove the comment */
+LIBMEMCACHED_API
memcached_server_st *memcached_server_create(memcached_st *memc, memcached_server_st *ptr);
+LIBMEMCACHED_API
memcached_server_st *memcached_server_create_with(memcached_st *memc, memcached_server_st *host,
const char *hostname, unsigned int port,
uint32_t weight, memcached_connection type);
+LIBMEMCACHED_API
void memcached_server_free(memcached_server_st *ptr);
+LIBMEMCACHED_API
memcached_server_st *memcached_server_clone(memcached_server_st *clone, memcached_server_st *ptr);
+LIBMEMCACHED_API
memcached_analysis_st *memcached_analyze(memcached_st *memc, memcached_stat_st *stat,
memcached_return *error);
+LIBMEMCACHED_API
+memcached_return memcached_server_remove(memcached_server_st *st_ptr);
#ifdef __cplusplus
}
#ifndef __MEMCACHED_STORAGE_H__
#define __MEMCACHED_STORAGE_H__
+#include "libmemcached/memcached_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
/* All of the functions for adding data to the server */
+LIBMEMCACHED_API
memcached_return memcached_set(memcached_st *ptr, const char *key, size_t key_length,
const char *value, size_t value_length,
time_t expiration,
uint32_t flags);
+LIBMEMCACHED_API
memcached_return memcached_add(memcached_st *ptr, const char *key, size_t key_length,
const char *value, size_t value_length,
time_t expiration,
uint32_t flags);
+LIBMEMCACHED_API
memcached_return memcached_replace(memcached_st *ptr, const char *key, size_t key_length,
const char *value, size_t value_length,
time_t expiration,
uint32_t flags);
+LIBMEMCACHED_API
memcached_return memcached_append(memcached_st *ptr,
const char *key, size_t key_length,
const char *value, size_t value_length,
time_t expiration,
uint32_t flags);
+LIBMEMCACHED_API
memcached_return memcached_prepend(memcached_st *ptr,
const char *key, size_t key_length,
const char *value, size_t value_length,
time_t expiration,
uint32_t flags);
+LIBMEMCACHED_API
memcached_return memcached_cas(memcached_st *ptr,
const char *key, size_t key_length,
const char *value, size_t value_length,
uint32_t flags,
uint64_t cas);
+LIBMEMCACHED_API
memcached_return memcached_set_by_key(memcached_st *ptr,
const char *master_key, size_t master_key_length,
const char *key, size_t key_length,
time_t expiration,
uint32_t flags);
+LIBMEMCACHED_API
memcached_return memcached_add_by_key(memcached_st *ptr,
const char *master_key, size_t master_key_length,
const char *key, size_t key_length,
time_t expiration,
uint32_t flags);
+LIBMEMCACHED_API
memcached_return memcached_replace_by_key(memcached_st *ptr,
const char *master_key, size_t master_key_length,
const char *key, size_t key_length,
time_t expiration,
uint32_t flags);
+LIBMEMCACHED_API
memcached_return memcached_prepend_by_key(memcached_st *ptr,
const char *master_key, size_t master_key_length,
const char *key, size_t key_length,
time_t expiration,
uint32_t flags);
+LIBMEMCACHED_API
memcached_return memcached_append_by_key(memcached_st *ptr,
const char *master_key, size_t master_key_length,
const char *key, size_t key_length,
time_t expiration,
uint32_t flags);
+LIBMEMCACHED_API
memcached_return memcached_cas_by_key(memcached_st *ptr,
const char *master_key, size_t master_key_length,
const char *key, size_t key_length,
#define memcached_string_size(A) (A)->current_size
#define memcached_string_value(A) (A)->string
+LIBMEMCACHED_API
memcached_string_st *memcached_string_create(memcached_st *ptr,
memcached_string_st *string,
size_t initial_size);
+LIBMEMCACHED_API
memcached_return memcached_string_check(memcached_string_st *string, size_t need);
+LIBMEMCACHED_API
char *memcached_string_c_copy(memcached_string_st *string);
+LIBMEMCACHED_API
memcached_return memcached_string_append_character(memcached_string_st *string,
char character);
+LIBMEMCACHED_API
memcached_return memcached_string_append(memcached_string_st *string,
char *value, size_t length);
+LIBMEMCACHED_API
memcached_return memcached_string_reset(memcached_string_st *string);
+LIBMEMCACHED_API
void memcached_string_free(memcached_string_st *string);
#ifdef __cplusplus
#ifndef MEMCACHED_UTIL_H
#define MEMCACHED_UTIL_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <libmemcached/memcached_pool.h>
-#ifdef __cplusplus
-}
-#endif
-
#endif /* MEMCACHED_UTIL_H */
-#include "config.h"
+#include "libmemcached/common.h"
#include "libmemcached/memcached_pool.h"
#include <errno.h>
AC_DEFUN([PROTOCOL_BINARY_TEST],
[AC_LANG_PUSH([C])
save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -I${srcdir}"
+ CFLAGS="$CFLAGS -I${srcdir} -DBUILDING_LIBMEMCACHED"
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
#include "libmemcached/memcached/protocol_binary.h"
Sample test application.
*/
-/* TODO: I'm torn about this. The file seems like a functional test, which
- * should use only the exported API of the library. On the other hand,
- * something needs to test some of the internals - so we're going to turn on
- * internal symbols here... but I'd like to come up with another way to test
- * the internals
- */
-#define BUILDING_LIBMEMCACHED 1
#include "libmemcached/common.h"
#include <assert.h>
static test_return replication_set_test(memcached_st *memc)
{
memcached_return rc;
- memcached_st *clone= memcached_clone(NULL, memc);
- memcached_behavior_set(clone, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, 0);
+ memcached_st *memc_clone= memcached_clone(NULL, memc);
+ memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, 0);
rc= memcached_set(memc, "bubba", 5, "0", 1, 0, 0);
assert(rc == MEMCACHED_SUCCESS);
char key[2]= { [0]= (char)x };
size_t len;
uint32_t flags;
- char *val= memcached_get_by_key(clone, key, 1, "bubba", 5,
+ char *val= memcached_get_by_key(memc_clone, key, 1, "bubba", 5,
&len, &flags, &rc);
assert(rc == MEMCACHED_SUCCESS);
assert(val != NULL);
free(val);
}
- memcached_free(clone);
+ memcached_free(memc_clone);
return TEST_SUCCESS;
}
*/
for (uint32_t host= 0; host < memc->number_of_hosts; ++host)
{
- memcached_st *clone= memcached_clone(NULL, memc);
- clone->hosts[host].port= 0;
+ memcached_st *memc_clone= memcached_clone(NULL, memc);
+ memc_clone->hosts[host].port= 0;
for (int x= 'a'; x <= 'z'; ++x)
{
char key[2]= { [0]= (char)x };
size_t len;
uint32_t flags;
- char *val= memcached_get_by_key(clone, key, 1, "bubba", 5,
+ char *val= memcached_get_by_key(memc_clone, key, 1, "bubba", 5,
&len, &flags, &rc);
assert(rc == MEMCACHED_SUCCESS);
assert(val != NULL);
free(val);
}
- memcached_free(clone);
+ memcached_free(memc_clone);
}
return TEST_SUCCESS;
static test_return replication_mget_test(memcached_st *memc)
{
memcached_return rc;
- memcached_st *clone= memcached_clone(NULL, memc);
- memcached_behavior_set(clone, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, 0);
+ memcached_st *memc_clone= memcached_clone(NULL, memc);
+ memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, 0);
char *keys[]= { "bubba", "key1", "key2", "key3" };
size_t len[]= { 5, 4, 4, 4 };
* This is to verify correct behavior in the library
*/
memcached_result_st result_obj;
- for (uint32_t host= 0; host < clone->number_of_hosts; host++)
+ for (uint32_t host= 0; host < memc_clone->number_of_hosts; host++)
{
memcached_st *new_clone= memcached_clone(NULL, memc);
new_clone->hosts[host].port= 0;
static test_return replication_delete_test(memcached_st *memc)
{
memcached_return rc;
- memcached_st *clone= memcached_clone(NULL, memc);
+ memcached_st *memc_clone= memcached_clone(NULL, memc);
/* Delete the items from all of the servers except 1 */
uint64_t repl= memcached_behavior_get(memc,
MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS);
uint32_t hash= memcached_generate_hash(memc, keys[0], len[0]);
for (uint32_t x= 0; x < (repl + 1); ++x)
{
- clone->hosts[hash].port= 0;
- if (++hash == clone->number_of_hosts)
+ memc_clone->hosts[hash].port= 0;
+ if (++hash == memc_clone->number_of_hosts)
hash= 0;
}
memcached_result_st result_obj;
- for (uint32_t host= 0; host < clone->number_of_hosts; ++host)
+ for (uint32_t host= 0; host < memc_clone->number_of_hosts; ++host)
{
for (int x= 'a'; x <= 'z'; ++x)
{
char key[2]= { [0]= (char)x };
- rc= memcached_mget_by_key(clone, key, 1, keys, len, 4);
+ rc= memcached_mget_by_key(memc_clone, key, 1, keys, len, 4);
assert(rc == MEMCACHED_SUCCESS);
- memcached_result_st *results= memcached_result_create(clone, &result_obj);
+ memcached_result_st *results= memcached_result_create(memc_clone, &result_obj);
assert(results);
int hits= 0;
- while ((results= memcached_fetch_result(clone, &result_obj, &rc)) != NULL)
+ while ((results= memcached_fetch_result(memc_clone, &result_obj, &rc)) != NULL)
{
++hits;
}
memcached_result_free(&result_obj);
}
}
- memcached_free(clone);
+ memcached_free(memc_clone);
return TEST_SUCCESS;
}