X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fcommon.h;h=e6b24944e3c4388f3a1c0a44de90ec04e5fdff04;hb=983523c4536f12781533124cb8a00a4291b8cf79;hp=ec58fd8e2cc9c4b89cdb34c28c991cce11b66f03;hpb=67456d74f5bd4f354a360d70da503dc58cbe5971;p=m6w6%2Flibmemcached diff --git a/libmemcached/common.h b/libmemcached/common.h index ec58fd8e..e6b24944 100644 --- a/libmemcached/common.h +++ b/libmemcached/common.h @@ -44,38 +44,46 @@ #include +#ifdef __cplusplus +#include +#include +#include +#include +#include +#else #include #include #include -#include -#include -#include -#include -#include +#include +#endif + #include #include -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif +#include +#include +#include +#ifdef HAVE_STRINGS_H +#include +#endif -#include +#include #include #include +#include + +#ifdef HAVE_POLL_H +#include +#else +#include "poll/poll.h" +#endif + + #ifdef __cplusplus extern "C" { #endif -typedef struct memcached_server_st * memcached_server_write_instance_st; - typedef memcached_return_t (*memcached_server_execute_fn)(memcached_st *ptr, memcached_server_write_instance_st server, void *context); LIBMEMCACHED_LOCAL @@ -91,23 +99,46 @@ memcached_return_t memcached_server_execute(memcached_st *ptr, /* These are private not to be installed headers */ +#include +#include #include -#include +#ifdef __cplusplus +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif #include #include #include #include #include #include +#ifdef __cplusplus #include -#include +#endif +#include +#include + +#ifdef __cplusplus +#include +#include +#include +#include +#include +#include +#endif -/* string value */ -struct memcached_continuum_item_st -{ - uint32_t index; - uint32_t value; -}; +#include #if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) @@ -129,9 +160,6 @@ struct memcached_continuum_item_st extern "C" { #endif -LIBMEMCACHED_LOCAL -memcached_return_t memcached_connect(memcached_server_write_instance_st ptr); - LIBMEMCACHED_LOCAL memcached_return_t run_distribution(memcached_st *ptr); @@ -139,65 +167,9 @@ memcached_return_t run_distribution(memcached_st *ptr); #define memcached_server_response_decrement(A) (A)->cursor_active-- #define memcached_server_response_reset(A) (A)->cursor_active=0 -LIBMEMCACHED_LOCAL -void set_last_disconnected_host(memcached_server_write_instance_st ptr); - -LIBMEMCACHED_LOCAL -memcached_return_t memcached_key_test(const char * const *keys, - const size_t *key_length, - size_t number_of_keys); - LIBMEMCACHED_LOCAL memcached_return_t memcached_purge(memcached_server_write_instance_st ptr); -LIBMEMCACHED_LOCAL -memcached_server_st *memcached_server_create_with(const memcached_st *memc, - memcached_server_write_instance_st host, - const char *hostname, - in_port_t port, - uint32_t weight, - memcached_connection_t type); - - -static inline memcached_return_t memcached_validate_key_length(size_t key_length, bool binary) -{ - unlikely (key_length == 0) - return MEMCACHED_BAD_KEY_PROVIDED; - - if (binary) - { - unlikely (key_length > 0xffff) - return MEMCACHED_BAD_KEY_PROVIDED; - } - else - { - unlikely (key_length >= MEMCACHED_MAX_KEY) - return MEMCACHED_BAD_KEY_PROVIDED; - } - - return MEMCACHED_SUCCESS; -} - -static inline void libmemcached_free(const memcached_st *ptr, void *mem) -{ - ptr->allocators.free(ptr, mem, ptr->allocators.context); -} - -static inline void *libmemcached_malloc(const memcached_st *ptr, const size_t size) -{ - return ptr->allocators.malloc(ptr, size, ptr->allocators.context); -} - -static inline void *libmemcached_realloc(const memcached_st *ptr, void *mem, const size_t size) -{ - return ptr->allocators.realloc(ptr, mem, size, ptr->allocators.context); -} - -static inline void *libmemcached_calloc(const memcached_st *ptr, size_t nelem, size_t size) -{ - return ptr->allocators.calloc(ptr, nelem, size, ptr->allocators.context); -} - #ifdef __cplusplus } #endif