-memcached_return memcached_do(memcached_server_st *ptr, char *commmand,
- size_t command_length, uint8_t with_flush);
-memcached_return memcached_version(memcached_st *ptr);
-memcached_return value_fetch(memcached_server_st *ptr,
- char *buffer,
- memcached_result_st *result);
-void server_list_free(memcached_st *ptr, memcached_server_st *servers);
-
-memcached_return memcachd_key_test(char **keys, size_t *key_length,
- unsigned int number_of_keys);
-
-#endif /* __COMMON_H__ */
+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