From: Brian Aker Date: Thu, 21 Jan 2010 23:45:12 +0000 (-0800) Subject: Style cleanup. X-Git-Tag: 0.40~66 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=284978b1dc258cb8cd2a32d6a0f25f2f9b284149;p=m6w6%2Flibmemcached Style cleanup. --- diff --git a/libhashkit/hashkit.h b/libhashkit/hashkit.h index 8b7985ac..5f19f9d3 100644 --- a/libhashkit/hashkit.h +++ b/libhashkit/hashkit.h @@ -86,6 +86,7 @@ struct hashkit_st hashkit_st& operator=(const hashkit_st& source) { + hashkit_free(this); hashkit_clone(this, &source); return *this; diff --git a/libmemcached/allocators.h b/libmemcached/allocators.h index c87cd2ec..b525e901 100644 --- a/libmemcached/allocators.h +++ b/libmemcached/allocators.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_ALLOCATORS_H__ -#define __MEMCACHED_ALLOCATORS_H__ +#ifndef __LIBMEMCACHED_ALLOCATORS_H__ +#define __LIBMEMCACHED_ALLOCATORS_H__ #ifdef __cplusplus extern "C" { @@ -49,9 +49,8 @@ void *_libmemcached_calloc(const memcached_st *ptr, size_t nelem, size_t size, v LIBMEMCACHED_LOCAL struct _allocators_st memcached_allocators_return_default(void); - #ifdef __cplusplus } #endif -#endif /* __MEMCACHED_ALLOCATORS_H__ */ +#endif /* __LIBMEMCACHED_ALLOCATORS_H__ */ diff --git a/libmemcached/analyze.h b/libmemcached/analyze.h index dbec8b23..4a8128bd 100644 --- a/libmemcached/analyze.h +++ b/libmemcached/analyze.h @@ -9,13 +9,8 @@ * */ -#ifndef __MEMCACHED_ANALYZE_H__ -#define __MEMCACHED_ANALYZE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - +#ifndef __LIBMEMCACHED_ANALYZE_H__ +#define __LIBMEMCACHED_ANALYZE_H__ struct memcached_analysis_st { memcached_st *root; @@ -29,6 +24,9 @@ struct memcached_analysis_st { uint64_t least_remaining_bytes; }; +#ifdef __cplusplus +extern "C" { +#endif LIBMEMCACHED_API memcached_analysis_st *memcached_analyze(memcached_st *memc, @@ -42,4 +40,4 @@ void memcached_analyze_free(memcached_analysis_st *); } #endif -#endif /* __MEMCACHED_ANALYZE_H__ */ +#endif /* __LIBMEMCACHED_ANALYZE_H__ */ diff --git a/libmemcached/auto.h b/libmemcached/auto.h index c80d0bd0..227be9df 100644 --- a/libmemcached/auto.h +++ b/libmemcached/auto.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_AUTO_H__ -#define __MEMCACHED_AUTO_H__ +#ifndef __LIBMEMCACHED_AUTO_H__ +#define __LIBMEMCACHED_AUTO_H__ #ifdef __cplusplus extern "C" { @@ -82,4 +82,4 @@ memcached_return_t memcached_decrement_with_initial_by_key(memcached_st *ptr, } #endif -#endif /* __MEMCACHED_AUTO_H__ */ +#endif /* __LIBMEMCACHED_AUTO_H__ */ diff --git a/libmemcached/behavior.h b/libmemcached/behavior.h index 7a008731..1bc51b7d 100644 --- a/libmemcached/behavior.h +++ b/libmemcached/behavior.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_BEHAVIOR_H__ -#define __MEMCACHED_BEHAVIOR_H__ +#ifndef __LIBMEMCACHED_BEHAVIOR_H__ +#define __LIBMEMCACHED_BEHAVIOR_H__ #ifdef __cplusplus extern "C" { @@ -45,4 +45,4 @@ memcached_hash_t memcached_behavior_get_distribution_hash(memcached_st *ptr); } #endif -#endif /* __MEMCACHED_BEHAVIOR_H__ */ +#endif /* __LIBMEMCACHED_BEHAVIOR_H__ */ diff --git a/libmemcached/byteorder.h b/libmemcached/byteorder.h index 17e66a78..df47cc69 100644 --- a/libmemcached/byteorder.h +++ b/libmemcached/byteorder.h @@ -9,8 +9,8 @@ * */ -#ifndef LIBMEMCACHED_BYTEORDER_H -#define LIBMEMCACHED_BYTEORDER_H +#ifndef __LIBMEMCACHED_BYTEORDER_H__ +#define __LIBMEMCACHED_BYTEORDER_H__ #include "config.h" @@ -40,4 +40,4 @@ uint64_t htonll(uint64_t); #undef htonl #endif -#endif /* LIBMEMCACHED_BYTEORDER_H */ +#endif /*__LIBMEMCACHED_BYTEORDER_H__ */ diff --git a/libmemcached/callback.h b/libmemcached/callback.h index de64a199..4c3a95f4 100644 --- a/libmemcached/callback.h +++ b/libmemcached/callback.h @@ -9,8 +9,14 @@ * */ -#ifndef __MEMCACHED_CALLBACK_H__ -#define __MEMCACHED_CALLBACK_H__ +#ifndef __LIBMEMCACHED_CALLBACK_H__ +#define __LIBMEMCACHED_CALLBACK_H__ + +struct memcached_callback_st { + memcached_execute_fn *callback; + void *context; + uint32_t number_of_callback; +}; #ifdef __cplusplus extern "C" { @@ -29,4 +35,4 @@ void *memcached_callback_get(memcached_st *ptr, } #endif -#endif /* __MEMCACHED_CALLBACK_H__ */ +#endif /* __LIBMEMCACHED_CALLBACK_H__ */ diff --git a/libmemcached/common.h b/libmemcached/common.h index 1e1db2f5..c1cd0d8d 100644 --- a/libmemcached/common.h +++ b/libmemcached/common.h @@ -13,8 +13,8 @@ Common include file for libmemached */ -#ifndef LIBMEMCACHED_COMMON_H -#define LIBMEMCACHED_COMMON_H +#ifndef __LIBMEMCACHED_COMMON_H__ +#define __LIBMEMCACHED_COMMON_H__ #include "config.h" @@ -95,6 +95,10 @@ typedef enum { #define SMALL_STRING_LEN 1024 #define HUGE_STRING_LEN 8196 +#ifdef __cplusplus +extern "C" { +#endif + LIBMEMCACHED_LOCAL memcached_return_t memcached_connect(memcached_server_instance_st *ptr); LIBMEMCACHED_LOCAL @@ -217,5 +221,8 @@ static inline void *libmemcached_calloc(const memcached_st *ptr, size_t nelem, s return ptr->allocators.calloc(ptr, nelem, size, ptr->allocators.context); } +#ifdef __cplusplus +} +#endif -#endif /* LIBMEMCACHED_COMMON_H */ +#endif /* __LIBMEMCACHED_COMMON_H__ */ diff --git a/libmemcached/configure.h.in b/libmemcached/configure.h.in index c4301df9..17ec8645 100644 --- a/libmemcached/configure.h.in +++ b/libmemcached/configure.h.in @@ -9,8 +9,8 @@ * */ -#ifndef MEMCACHED_CONFIGURE_H -#define MEMCACHED_CONFIGURE_H +#ifndef __LIBMEMCACHED_CONFIGURE_H +#define __LIBMEMCACHED_CONFIGURE_H #ifdef __cplusplus extern "C" { @@ -25,4 +25,4 @@ extern "C" { } #endif -#endif /* MEMCACHED_CONFIGURE_H */ +#endif /* __LIBMEMCACHED_CONFIGURE_H */ diff --git a/libmemcached/constants.h b/libmemcached/constants.h index ab210c3c..561f00c4 100644 --- a/libmemcached/constants.h +++ b/libmemcached/constants.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_CONSTANTS_H__ -#define __MEMCACHED_CONSTANTS_H__ +#ifndef __LIBMEMCACHED_CONSTANTS_H__ +#define __LIBMEMCACHED_CONSTANTS_H__ /* Public defines */ #define MEMCACHED_DEFAULT_PORT 11211 @@ -157,4 +157,4 @@ typedef enum { MEMCACHED_CONNECTION_MAX } memcached_connection_t; -#endif /* __MEMCACHED_CONSTANTS_H__ */ +#endif /* __LIBMEMCACHED_CONSTANTS_H__ */ diff --git a/libmemcached/delete.h b/libmemcached/delete.h index 1992ac36..54736c0e 100644 --- a/libmemcached/delete.h +++ b/libmemcached/delete.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_DELETE_H__ -#define __MEMCACHED_DELETE_H__ +#ifndef __LIBMEMCACHED_DELETE_H__ +#define __LIBMEMCACHED_DELETE_H__ #ifdef __cplusplus extern "C" { @@ -30,4 +30,4 @@ memcached_return_t memcached_delete_by_key(memcached_st *ptr, } #endif -#endif /* __MEMCACHED_DELETE_H__ */ +#endif /* __LIBMEMCACHED_DELETE_H__ */ diff --git a/libmemcached/dump.h b/libmemcached/dump.h index 3b3d11df..6fcdb257 100644 --- a/libmemcached/dump.h +++ b/libmemcached/dump.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_DUMP_H__ -#define __MEMCACHED_DUMP_H__ +#ifndef __LIBMEMCACHED_DUMP_H__ +#define __LIBMEMCACHED_DUMP_H__ #ifdef __cplusplus extern "C" { @@ -24,4 +24,4 @@ memcached_return_t memcached_dump(memcached_st *ptr, memcached_dump_fn *function } #endif -#endif /* __MEMCACHED_DUMP_H__ */ +#endif /* __LIBMEMCACHED_DUMP_H__ */ diff --git a/libmemcached/fetch.h b/libmemcached/fetch.h index cd12d384..353cca5e 100644 --- a/libmemcached/fetch.h +++ b/libmemcached/fetch.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_FETCH_H__ -#define __MEMCACHED_FETCH_H__ +#ifndef __LIBMEMCACHED_FETCH_H__ +#define __LIBMEMCACHED_FETCH_H__ #ifdef __cplusplus extern "C" { @@ -26,4 +26,4 @@ memcached_return_t memcached_fetch_execute(memcached_st *ptr, } #endif -#endif /* __MEMCACHED_FETCH_H__ */ +#endif /* __LIBMEMCACHED_FETCH_H__ */ diff --git a/libmemcached/flush.h b/libmemcached/flush.h index dd2f5aef..36c07598 100644 --- a/libmemcached/flush.h +++ b/libmemcached/flush.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_FLUSH_H__ -#define __MEMCACHED_FLUSH_H__ +#ifndef __LIBMEMCACHED_FLUSH_H__ +#define __LIBMEMCACHED_FLUSH_H__ #ifdef __cplusplus extern "C" { @@ -23,4 +23,4 @@ memcached_return_t memcached_flush(memcached_st *ptr, time_t expiration); } #endif -#endif /* __MEMCACHED_FLUSH_H__ */ +#endif /* __LIBMEMCACHED_FLUSH_H__ */ diff --git a/libmemcached/flush_buffers.h b/libmemcached/flush_buffers.h index a7d1e19a..88d8a81c 100644 --- a/libmemcached/flush_buffers.h +++ b/libmemcached/flush_buffers.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_FLUSH_BUFFERS_H__ -#define __MEMCACHED_FLUSH_BUFFERS_H__ +#ifndef __LIBMEMCACHED_FLUSH_BUFFERS_H__ +#define __LIBMEMCACHED_FLUSH_BUFFERS_H__ #ifdef __cplusplus extern "C" { @@ -23,4 +23,4 @@ memcached_return_t memcached_flush_buffers(memcached_st *mem); } #endif -#endif /* __MEMCACHED_FLUSH_BUFFERS_H__ */ +#endif /* __LIBMEMCACHED_FLUSH_BUFFERS_H__ */ diff --git a/libmemcached/get.h b/libmemcached/get.h index 2e5b2f99..a6d6b264 100644 --- a/libmemcached/get.h +++ b/libmemcached/get.h @@ -9,8 +9,8 @@ * */ -#ifndef LIBMEMCACHED_MEMCACHED_GET_H -#define LIBMEMCACHED_MEMCACHED_GET_H +#ifndef __LIBMEMCACHED_GET_H__ +#define __LIBMEMCACHED_GET_H__ #ifdef __cplusplus extern "C" { @@ -83,4 +83,4 @@ memcached_return_t memcached_mget_execute_by_key(memcached_st *ptr, } #endif -#endif /* LIBMEMCACHED_MEMCACHED_GET_H */ +#endif /* __LIBMEMCACHED_GET_H__ */ diff --git a/libmemcached/internal.h b/libmemcached/internal.h index a02a30de..743bf870 100644 --- a/libmemcached/internal.h +++ b/libmemcached/internal.h @@ -9,8 +9,8 @@ * */ -#ifndef LIBMEMCACHED_MEMCACHED_INTERNAL_H -#define LIBMEMCACHED_MEMCACHED_INTERNAL_H +#ifndef __LIBMEMCACHED_INTERNAL_H__ +#define __LIBMEMCACHED_INTERNAL_H__ #if defined(BUILDING_LIBMEMCACHED) @@ -23,4 +23,4 @@ extern "C" { #endif #endif /* BUILDING_LIBMEMCACHED */ -#endif /* LIBMEMCACHED_MEMCACHED_INTERNAL_H */ +#endif /* __LIBMEMCACHED_INTERNAL_H__ */ diff --git a/libmemcached/io.h b/libmemcached/io.h index df7708c8..5530d146 100644 --- a/libmemcached/io.h +++ b/libmemcached/io.h @@ -9,17 +9,17 @@ * */ -#ifndef LIBMEMCACHED_MEMCACHED_IO_H -#define LIBMEMCACHED_MEMCACHED_IO_H - -#ifdef __cplusplus -extern "C" { -#endif +#ifndef __LIBMEMCACHED_IO_H__ +#define __LIBMEMCACHED_IO_H__ #if defined(BUILDING_LIBMEMCACHED) #include "libmemcached/memcached.h" +#ifdef __cplusplus +extern "C" { +#endif + #define MAX_UDP_DATAGRAM_LENGTH 1400 #define UDP_DATAGRAM_HEADER_LENGTH 8 #define UDP_REQUEST_ID_MSG_SIG_DIGITS 10 @@ -73,10 +73,10 @@ memcached_return_t memcached_io_init_udp_header(memcached_server_instance_st *pt LIBMEMCACHED_LOCAL memcached_server_instance_st *memcached_io_get_readable_server(memcached_st *memc); -#endif /* BUILDING_LIBMEMCACHED */ - #ifdef __cplusplus } #endif -#endif /* LIBMEMCACHED_MEMCACHED_IO_H */ +#endif /* BUILDING_LIBMEMCACHED */ + +#endif /* __LIBMEMCACHED_IO_H__ */ diff --git a/libmemcached/libmemcached_probes.h b/libmemcached/libmemcached_probes.h index ddc9ef47..46f8a21f 100644 --- a/libmemcached/libmemcached_probes.h +++ b/libmemcached/libmemcached_probes.h @@ -15,8 +15,8 @@ * implementation of the following macros to create your own sort of * probing :) */ -#ifndef LIBMEMCACHED_PROBES_H -#define LIBMEMCACHED_PROBES_H +#ifndef __LIBMEMCACHED_PROBES_H__ +#define __LIBMEMCACHED_PROBES_H__ #ifdef HAVE_DTRACE /* @@ -86,4 +86,4 @@ #endif -#endif /* LIBMEMCACHED_PROBES_H */ +#endif /* __LIBMEMCACHED_PROBES_H__ */ diff --git a/libmemcached/memcached.h b/libmemcached/memcached.h index 62d3b1dc..5b92d635 100644 --- a/libmemcached/memcached.h +++ b/libmemcached/memcached.h @@ -10,8 +10,8 @@ * */ -#ifndef __MEMCACHED_H__ -#define __MEMCACHED_H__ +#ifndef __LIBMEMCACHED_MEMCACHED_H__ +#define __LIBMEMCACHED_MEMCACHED_H__ #include #include @@ -74,6 +74,10 @@ void *memcached_get_user_data(const memcached_st *ptr); LIBMEMCACHED_API void *memcached_set_user_data(memcached_st *ptr, void *data); +#ifdef __cplusplus +} // extern "C" +#endif + struct memcached_st { /** @@ -237,6 +241,7 @@ struct memcached_st { memcached_st& operator=(const memcached_st& source) { + memcached_free(this); memcached_clone(this, &source); return *this; @@ -245,16 +250,11 @@ struct memcached_st { #endif }; + // Local Only Inline static inline memcached_server_st *memcached_server_instance_fetch(memcached_st *ptr, uint32_t server_key) { return &ptr->servers[server_key]; } - -#ifdef __cplusplus -} // extern "C" -#endif - - -#endif /* __MEMCACHED_H__ */ +#endif /* __LIBMEMCACHED_MEMCACHED_H__ */ diff --git a/libmemcached/memcached_util.h b/libmemcached/memcached_util.h index 0c2c6777..a20b665b 100644 --- a/libmemcached/memcached_util.h +++ b/libmemcached/memcached_util.h @@ -12,9 +12,9 @@ */ -#ifndef MEMCACHED_UTIL_H -#define MEMCACHED_UTIL_H +#ifndef __LIBMEMCACHED__MEMCACHED_UTIL_H__ +#define __LIBMEMCACHED__MEMCACHED_UTIL_H__ #include -#endif /* MEMCACHED_UTIL_H */ +#endif /* __LIBMEMCACHED__MEMCACHED_UTIL_H__ */ diff --git a/libmemcached/parse.h b/libmemcached/parse.h index d3a08f1a..9409d454 100644 --- a/libmemcached/parse.h +++ b/libmemcached/parse.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_PARSE_H__ -#define __MEMCACHED_PARSE_H__ +#ifndef __LIBMEMCACHED_PARSE_H__ +#define __LIBMEMCACHED_PARSE_H__ #ifdef __cplusplus extern "C" { @@ -23,4 +23,4 @@ memcached_server_st *memcached_servers_parse(const char *server_strings); } #endif -#endif /* __MEMCACHED_PARSE_H__ */ +#endif /* __LIBMEMCACHED_PARSE_H__ */ diff --git a/libmemcached/protocol_handler.h b/libmemcached/protocol_handler.h index 3e4531bb..78eda077 100644 --- a/libmemcached/protocol_handler.h +++ b/libmemcached/protocol_handler.h @@ -11,8 +11,8 @@ * */ -#ifndef MEMCACHED_PROTOCOL_H -#define MEMCACHED_PROTOCOL_H +#ifndef __LIBMEMCACHED_PROTOCOL_H__ +#define __LIBMEMCACHED_PROTOCOL_H__ #include #if !defined(__cplusplus) @@ -32,6 +32,10 @@ typedef struct memcached_protocol_st memcached_protocol_st; typedef struct memcached_protocol_client_st memcached_protocol_client_st; +#ifdef __cplusplus +extern "C" { +#endif + /** * Function the protocol handler should call to receive data. * This function should behave exactly like read(2) @@ -205,4 +209,9 @@ int memcached_protocol_client_get_errno(memcached_protocol_client_st *client); */ LIBMEMCACHED_API memcached_binary_protocol_raw_response_handler memcached_binary_protocol_get_raw_response_handler(const void *cookie); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/libmemcached/quit.h b/libmemcached/quit.h index 7b98427f..453adeaa 100644 --- a/libmemcached/quit.h +++ b/libmemcached/quit.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_QUIT_H__ -#define __MEMCACHED_QUIT_H__ +#ifndef __LIBMEMCACHED_QUIT_H__ +#define __LIBMEMCACHED_QUIT_H__ #ifdef __cplusplus extern "C" { @@ -23,4 +23,4 @@ void memcached_quit(memcached_st *ptr); } #endif -#endif /* __MEMCACHED_QUIT_H__ */ +#endif /* __LIBMEMCACHED_QUIT_H__ */ diff --git a/libmemcached/response.h b/libmemcached/response.h index d6168f87..6599b8a7 100644 --- a/libmemcached/response.h +++ b/libmemcached/response.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_RESPONSE_H__ -#define __MEMCACHED_RESPONSE_H__ +#ifndef __LIBMEMCACHED_RESPONSE_H__ +#define __LIBMEMCACHED_RESPONSE_H__ #ifdef __cplusplus extern "C" { @@ -31,4 +31,4 @@ memcached_return_t memcached_response(memcached_server_instance_st *ptr, } #endif -#endif /* __MEMCACHED_RESPONSE_H__ */ +#endif /* __LIBMEMCACHED_RESPONSE_H__ */ diff --git a/libmemcached/result.h b/libmemcached/result.h index 5e7bb69d..ea057569 100644 --- a/libmemcached/result.h +++ b/libmemcached/result.h @@ -9,12 +9,8 @@ * */ -#ifndef __MEMCACHED_RESULT_H__ -#define __MEMCACHED_RESULT_H__ - -#ifdef __cplusplus -extern "C" { -#endif +#ifndef __LIBMEMCACHED_RESULT_H__ +#define __LIBMEMCACHED_RESULT_H__ struct memcached_result_st { uint32_t item_flags; @@ -31,6 +27,10 @@ struct memcached_result_st { /* Add result callback function */ }; +#ifdef __cplusplus +extern "C" { +#endif + /* Result Struct */ LIBMEMCACHED_API void memcached_result_free(memcached_result_st *result); @@ -88,7 +88,8 @@ static inline void memcached_result_set_expiration(memcached_result_st *self, ti } #ifdef __cplusplus -} +} // extern "C" #endif -#endif /* __MEMCACHED_RESULT_H__ */ + +#endif /* __LIBMEMCACHED_RESULT_H__ */ diff --git a/libmemcached/server.h b/libmemcached/server.h index d1a1cdac..76400ee3 100644 --- a/libmemcached/server.h +++ b/libmemcached/server.h @@ -9,12 +9,9 @@ * */ -#ifndef __MEMCACHED_SERVER_H__ -#define __MEMCACHED_SERVER_H__ +#ifndef __LIBMEMCACHED_SERVER_H__ +#define __LIBMEMCACHED_SERVER_H__ -#ifdef __cplusplus -extern "C" { -#endif struct memcached_server_st { struct { @@ -51,26 +48,10 @@ struct memcached_server_st { char hostname[MEMCACHED_MAX_HOST_LENGTH]; }; -// Local Only Inline -static inline uint32_t memcached_servers_count(memcached_server_st *servers) -{ - return servers->number_of_hosts; -} -// Local Only Inline -static inline uint32_t memcached_servers_set_count(memcached_server_st *servers, uint32_t count) -{ - return servers->number_of_hosts= count; -} - - - -#define memcached_server_count(A) (A)->number_of_hosts -#define memcached_server_name(A,B) (B).hostname -#define memcached_server_port(A,B) (B).port -#define memcached_server_list(A) (A)->servers -#define memcached_server_list_set(A,B) (A)->servers=(B) -#define memcached_server_response_count(A) (A)->cursor_active +#ifdef __cplusplus +extern "C" { +#endif LIBMEMCACHED_API memcached_return_t memcached_server_cursor(memcached_st *ptr, @@ -163,9 +144,28 @@ memcached_server_st *memcached_server_list_append_with_weight(memcached_server_s LIBMEMCACHED_API unsigned int memcached_server_list_count(memcached_server_st *ptr); +// Local Only Inline +static inline uint32_t memcached_servers_count(memcached_server_st *servers) +{ + return servers->number_of_hosts; +} -#ifdef __cplusplus +// Local Only Inline +static inline uint32_t memcached_servers_set_count(memcached_server_st *servers, uint32_t count) +{ + return servers->number_of_hosts= count; } + + +#define memcached_server_count(A) (A)->number_of_hosts +#define memcached_server_name(A,B) (B).hostname +#define memcached_server_port(A,B) (B).port +#define memcached_server_list(A) (A)->servers +#define memcached_server_list_set(A,B) (A)->servers=(B) +#define memcached_server_response_count(A) (A)->cursor_active + +#ifdef __cplusplus +} // extern "C" #endif -#endif /* __MEMCACHED_SERVER_H__ */ +#endif /* __LIBMEMCACHED_SERVER_H__ */ diff --git a/libmemcached/stats.h b/libmemcached/stats.h index c7d554b2..245f0711 100644 --- a/libmemcached/stats.h +++ b/libmemcached/stats.h @@ -9,12 +9,8 @@ * */ -#ifndef __MEMCACHED_STATS_H__ -#define __MEMCACHED_STATS_H__ - -#ifdef __cplusplus -extern "C" { -#endif +#ifndef __LIBMEMCACHED_STATS_H__ +#define __LIBMEMCACHED_STATS_H__ struct memcached_stat_st { uint32_t connection_structures; @@ -44,6 +40,10 @@ struct memcached_stat_st { memcached_st *root; }; +#ifdef __cplusplus +extern "C" { +#endif + LIBMEMCACHED_API void memcached_stat_free(memcached_st *, memcached_stat_st *); @@ -63,7 +63,7 @@ char ** memcached_stat_get_keys(memcached_st *ptr, memcached_stat_st *memc_stat, memcached_return_t *error); #ifdef __cplusplus -} +} // extern "C" #endif -#endif /* __MEMCACHED_STATS_H__ */ +#endif /* __LIBMEMCACHED_STATS_H__ */ diff --git a/libmemcached/storage.h b/libmemcached/storage.h index 8f233967..58edb479 100644 --- a/libmemcached/storage.h +++ b/libmemcached/storage.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_STORAGE_H__ -#define __MEMCACHED_STORAGE_H__ +#ifndef __LIBMEMCACHED_STORAGE_H__ +#define __LIBMEMCACHED_STORAGE_H__ #include "libmemcached/memcached.h" @@ -107,4 +107,4 @@ memcached_return_t memcached_cas_by_key(memcached_st *ptr, } #endif -#endif /* __MEMCACHED_STORAGE_H__ */ +#endif /* __LIBMEMCACHED_STORAGE_H__ */ diff --git a/libmemcached/strerror.h b/libmemcached/strerror.h index 064b6460..b2dc8c9a 100644 --- a/libmemcached/strerror.h +++ b/libmemcached/strerror.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_STRERROR_H__ -#define __MEMCACHED_STRERROR_H__ +#ifndef __LIBMEMCACHED_STRERROR_H__ +#define __LIBMEMCACHED_STRERROR_H__ #ifdef __cplusplus extern "C" { @@ -23,4 +23,4 @@ const char *memcached_strerror(memcached_st *ptr, memcached_return_t rc); } #endif -#endif /* __MEMCACHED_STRERROR_H__ */ +#endif /* __LIBMEMCACHED_STRERROR_H__ */ diff --git a/libmemcached/string.h b/libmemcached/string.h index 9e064d9a..168172ea 100644 --- a/libmemcached/string.h +++ b/libmemcached/string.h @@ -9,12 +9,8 @@ * */ -#ifndef __MEMCACHED_STRING_H__ -#define __MEMCACHED_STRING_H__ - -#ifdef __cplusplus -extern "C" { -#endif +#ifndef __LIBMEMCACHED_STRING_H__ +#define __LIBMEMCACHED_STRING_H__ /** Strings are always under our control so we make some assumptions @@ -37,27 +33,9 @@ struct memcached_string_st { } options; }; -static inline size_t memcached_string_length(const memcached_string_st *self) -{ - return (size_t)(self->end - self->string); -} - -static inline size_t memcached_string_size(const memcached_string_st *self) -{ - return self->current_size; -} - -static inline const char *memcached_string_value(const memcached_string_st *self) -{ - return self->string; -} - -static inline char *memcached_string_value_mutable(const memcached_string_st *self) -{ - return self->string; -} - -#define memcached_string_set_length(A, B) (A)->end= (A)->string + B +#ifdef __cplusplus +extern "C" { +#endif LIBMEMCACHED_LOCAL memcached_string_st *memcached_string_create(const memcached_st *ptr, @@ -81,8 +59,31 @@ memcached_return_t memcached_string_reset(memcached_string_st *string); LIBMEMCACHED_LOCAL void memcached_string_free(memcached_string_st *string); +static inline size_t memcached_string_length(const memcached_string_st *self) +{ + return (size_t)(self->end - self->string); +} + +static inline size_t memcached_string_size(const memcached_string_st *self) +{ + return self->current_size; +} + +static inline const char *memcached_string_value(const memcached_string_st *self) +{ + return self->string; +} + +static inline char *memcached_string_value_mutable(const memcached_string_st *self) +{ + return self->string; +} + +#define memcached_string_set_length(A, B) (A)->end= (A)->string + B + #ifdef __cplusplus } #endif -#endif /* __MEMCACHED_STRING_H__ */ + +#endif /* __LIBMEMCACHED_STRING_H__ */ diff --git a/libmemcached/types.h b/libmemcached/types.h index 0c78eb30..c262b58d 100644 --- a/libmemcached/types.h +++ b/libmemcached/types.h @@ -9,19 +9,17 @@ * */ -#ifndef LIBMEMCACHED_MEMCACHED_TYPES_H -#define LIBMEMCACHED_MEMCACHED_TYPES_H - -#ifdef __cplusplus -extern "C" { -#endif +#ifndef __LIBMEMCACHED_TYPES_H__ +#define __LIBMEMCACHED_TYPES_H__ typedef struct memcached_st memcached_st; typedef struct memcached_stat_st memcached_stat_st; typedef struct memcached_analysis_st memcached_analysis_st; typedef struct memcached_result_st memcached_result_st; -typedef struct memcached_string_st memcached_string_st; typedef struct memcached_server_st memcached_server_st; +typedef struct memcached_callback_st memcached_callback_st; + +typedef struct memcached_string_st memcached_string_st; typedef struct memcached_continuum_item_st memcached_continuum_item_st; typedef memcached_return_t (*memcached_clone_fn)(memcached_st *destination, const memcached_st *source); @@ -52,12 +50,6 @@ typedef memcached_return_t (*memcached_dump_fn)(const memcached_st *ptr, size_t key_length, void *context); -typedef struct { - memcached_execute_fn *callback; - void *context; - uint32_t number_of_callback; -} memcached_callback_st; - /** @note The following definitions are just here for backwards compatibility. @@ -70,19 +62,10 @@ typedef memcached_hash_t memcached_hash; typedef memcached_connection_t memcached_connection; typedef memcached_clone_fn memcached_clone_func; typedef memcached_cleanup_fn memcached_cleanup_func; -typedef memcached_free_fn memcached_free_function; -typedef memcached_malloc_fn memcached_malloc_function; -typedef memcached_realloc_fn memcached_realloc_function; -typedef memcached_calloc_fn memcached_calloc_function; typedef memcached_execute_fn memcached_execute_function; typedef memcached_server_fn memcached_server_function; typedef memcached_trigger_key_fn memcached_trigger_key; typedef memcached_trigger_delete_key_fn memcached_trigger_delete_key; typedef memcached_dump_fn memcached_dump_func; - - -#ifdef __cplusplus -} -#endif -#endif /* LIBMEMCACHED_MEMCACHED_TYPES_H */ +#endif /* __LIBMEMCACHED_TYPES_H__ */ diff --git a/libmemcached/verbosity.h b/libmemcached/verbosity.h index 172ab9f6..b28458e4 100644 --- a/libmemcached/verbosity.h +++ b/libmemcached/verbosity.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_VERBOSITY_H__ -#define __MEMCACHED_VERBOSITY_H__ +#ifndef __LIBMEMCACHED_VERBOSITY_H__ +#define __LIBMEMCACHED_VERBOSITY_H__ #ifdef __cplusplus extern "C" { @@ -24,4 +24,4 @@ memcached_return_t memcached_verbosity(memcached_st *ptr, uint32_t verbosity); } #endif -#endif /* __MEMCACHED_VERBOSITY_H__ */ +#endif /* __LIBMEMCACHED_VERBOSITY_H__ */ diff --git a/libmemcached/version.h b/libmemcached/version.h index 8df9f0ac..7e6f607a 100644 --- a/libmemcached/version.h +++ b/libmemcached/version.h @@ -9,8 +9,8 @@ * */ -#ifndef __MEMCACHED_VERSION_H__ -#define __MEMCACHED_VERSION_H__ +#ifndef __LIBMEMCACHED_VERSION_H__ +#define __LIBMEMCACHED_VERSION_H__ #ifdef __cplusplus extern "C" { @@ -26,4 +26,4 @@ const char * memcached_lib_version(void); } #endif -#endif /* __MEMCACHED_VERSION_H__ */ +#endif /* __LIBMEMCACHED_VERSION_H__ */ diff --git a/libmemcached/visibility.h b/libmemcached/visibility.h index 6ee38533..7d9af058 100644 --- a/libmemcached/visibility.h +++ b/libmemcached/visibility.h @@ -16,8 +16,8 @@ * @brief Visibility control macros */ -#ifndef __LIBMEMCACHED_VISIBILITY_H -#define __LIBMEMCACHED_VISIBILITY_H +#ifndef __LIBMEMCACHED_VISIBILITY_H__ +#define __LIBMEMCACHED_VISIBILITY_H__ /** * @@ -51,4 +51,4 @@ # endif /* defined(_MSC_VER) */ #endif /* defined(BUILDING_LIBMEMCACHED) */ -#endif /* __LIBMEMCACHED_VISIBILITY_H */ +#endif /* __LIBMEMCACHED_VISIBILITY_H__ */ diff --git a/libmemcached/watchpoint.h b/libmemcached/watchpoint.h index a69d3916..38410194 100644 --- a/libmemcached/watchpoint.h +++ b/libmemcached/watchpoint.h @@ -9,8 +9,8 @@ * */ -#ifndef LIBMEMCACHED_MEMCACHED_WATCHPOINT_H -#define LIBMEMCACHED_MEMCACHED_WATCHPOINT_H +#ifndef __LIBMEMCACHED_WATCHPOINT_H__ +#define __LIBMEMCACHED_WATCHPOINT_H__ /* Some personal debugging functions */ #if defined(DEBUG) @@ -42,4 +42,4 @@ #endif /* DEBUG */ -#endif /* LIBMEMCACHED_MEMCACHED_WATCHPOINT_H */ +#endif /* __LIBMEMCACHED_WATCHPOINT_H__ */