From: Brian Aker Date: Sun, 31 Mar 2013 23:24:29 +0000 (-0700) Subject: Remove exposed C++ namespace. X-Git-Tag: 1.0.17~1^2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=d9db3f534bc38ea22e83e5529ff93aea4150ab19;p=awesomized%2Flibmemcached Remove exposed C++ namespace. --- diff --git a/ChangeLog b/ChangeLog index 2ffba574..2b8f23a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 1.0.17 -* +* Remove c++ namespace that was being exposed (the API should be plug +compatible).. 1.0.16 Thu Jan 31 19:14:32 EST 2013 * Added support to do two part shutdown of socket. diff --git a/clients/memstat.cc b/clients/memstat.cc index 2e7d4b81..793aab9b 100644 --- a/clients/memstat.cc +++ b/clients/memstat.cc @@ -68,12 +68,12 @@ static struct option long_options[]= }; -static memcached_return_t stat_printer(memcached_server_instance_st instance, +static memcached_return_t stat_printer(const memcached_instance_st * instance, const char *key, size_t key_length, const char *value, size_t value_length, void *context) { - static memcached_server_instance_st last= NULL; + static const memcached_instance_st * last= NULL; (void)context; if (last != instance) @@ -89,7 +89,7 @@ static memcached_return_t stat_printer(memcached_server_instance_st instance, } static memcached_return_t server_print_callback(const memcached_st *, - memcached_server_instance_st instance, + const memcached_instance_st * instance, void *) { std::cerr << memcached_server_name(instance) << ":" << memcached_server_port(instance) << @@ -230,7 +230,7 @@ static void run_analyzer(memcached_st *memc, memcached_stat_st *memc_stat) for (uint32_t x= 0; x < server_count; x++) { - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, x); if ((servers[x]= memcached_create(NULL)) == NULL) @@ -263,7 +263,7 @@ static void run_analyzer(memcached_st *memc, memcached_stat_st *memc_stat) for (uint32_t x= 0; x < server_count; x++) { - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, x); gettimeofday(&start_time, NULL); @@ -306,7 +306,7 @@ static void run_analyzer(memcached_st *memc, memcached_stat_st *memc_stat) if (server_count > 1 && slowest_time > 0) { - memcached_server_instance_st slowest= + const memcached_instance_st * slowest= memcached_server_instance_by_position(memc, slowest_server); printf("---\n"); @@ -337,9 +337,9 @@ static void print_analysis_report(memcached_st *memc, { uint32_t server_count= memcached_server_count(memc); - memcached_server_instance_st most_consumed_server= memcached_server_instance_by_position(memc, report->most_consumed_server); - memcached_server_instance_st least_free_server= memcached_server_instance_by_position(memc, report->least_free_server); - memcached_server_instance_st oldest_server= memcached_server_instance_by_position(memc, report->oldest_server); + const memcached_instance_st * most_consumed_server= memcached_server_instance_by_position(memc, report->most_consumed_server); + const memcached_instance_st * least_free_server= memcached_server_instance_by_position(memc, report->least_free_server); + const memcached_instance_st * oldest_server= memcached_server_instance_by_position(memc, report->oldest_server); printf("Memcached Cluster Analysis Report\n\n"); diff --git a/docs/memcached_server_st.rst b/docs/memcached_server_st.rst index 6bca49b8..63008795 100644 --- a/docs/memcached_server_st.rst +++ b/docs/memcached_server_st.rst @@ -11,13 +11,13 @@ SYNOPSIS #include -.. c:type:: memcached_server_instance_st +.. c:type:: const memcached_instance_st * .. c:type:: memcached_server_list_st .. c:type:: memcached_server_st -.. c:function:: const memcached_server_instance_st memcached_server_list (memcached_st *ptr) +.. c:function:: const const memcached_instance_st * memcached_server_list (memcached_st *ptr) .. c:function:: void memcached_server_list_free (memcached_server_list_st list) @@ -25,9 +25,9 @@ SYNOPSIS .. c:function:: uint32_t memcached_server_list_count (memcached_server_list_st list) -.. c:function:: const char *memcached_server_error (memcached_server_instance_st instance) +.. c:function:: const char *memcached_server_error (const memcached_instance_st * instance) -.. c:function:: void memcached_server_error_reset (memcached_server_instance_st list) +.. c:function:: void memcached_server_error_reset (const memcached_instance_st * list) .. deprecated:: 0.39 .. c:function:: void memcached_servers_parse () diff --git a/docs/memcached_servers.rst b/docs/memcached_servers.rst index e86dad81..d3c90379 100644 --- a/docs/memcached_servers.rst +++ b/docs/memcached_servers.rst @@ -20,9 +20,9 @@ SYNOPSIS .. c:function:: memcached_return_t memcached_server_push (memcached_st *ptr, const memcached_server_st *list) -.. c:function:: memcached_server_instance_st memcached_server_by_key (memcached_st *ptr, const char *key, size_t key_length, memcached_return_t *error) +.. c:function:: const memcached_instance_st * memcached_server_by_key (memcached_st *ptr, const char *key, size_t key_length, memcached_return_t *error) -.. c:function:: memcached_server_instance_st memcached_server_get_last_disconnect (const memcached_st *ptr) +.. c:function:: const memcached_instance_st * memcached_server_get_last_disconnect (const memcached_st *ptr) .. c:function:: memcached_return_t memcached_server_cursor(const memcached_st *ptr, const memcached_server_fn *callback, void *context, uint32_t number_of_callbacks) diff --git a/docs/memcached_stats.rst b/docs/memcached_stats.rst index 828ef8c6..c173619a 100644 --- a/docs/memcached_stats.rst +++ b/docs/memcached_stats.rst @@ -16,7 +16,7 @@ SYNOPSIS .. c:type:: memcached_stat_st -.. c:type:: memcached_return_t (*memcached_stat_fn)(memcached_server_instance_st server, const char *key, size_t key_length, const char *value, size_t value_length, void *context) +.. c:type:: memcached_return_t (*memcached_stat_fn)(const memcached_instance_st * server, const char *key, size_t key_length, const char *value, size_t value_length, void *context) .. c:function:: memcached_stat_st *memcached_stat (memcached_st *ptr, char *args, memcached_return_t *error) diff --git a/libmemcached-1.0/callbacks.h b/libmemcached-1.0/callbacks.h index e321ceb4..7ab8cb1c 100644 --- a/libmemcached-1.0/callbacks.h +++ b/libmemcached-1.0/callbacks.h @@ -42,8 +42,8 @@ extern "C" { #endif typedef memcached_return_t (*memcached_execute_fn)(const memcached_st *ptr, memcached_result_st *result, void *context); -typedef memcached_return_t (*memcached_server_fn)(const memcached_st *ptr, memcached_server_instance_st server, void *context); -typedef memcached_return_t (*memcached_stat_fn)(memcached_server_instance_st server, +typedef memcached_return_t (*memcached_server_fn)(const memcached_st *ptr, const memcached_instance_st * server, void *context); +typedef memcached_return_t (*memcached_stat_fn)(const memcached_instance_st * server, const char *key, size_t key_length, const char *value, size_t value_length, void *context); diff --git a/libmemcached-1.0/error.h b/libmemcached-1.0/error.h index 7fdc18b8..9346bb0b 100644 --- a/libmemcached-1.0/error.h +++ b/libmemcached-1.0/error.h @@ -57,10 +57,10 @@ LIBMEMCACHED_API int memcached_last_error_errno(const memcached_st *); LIBMEMCACHED_API - const char *memcached_server_error(const memcached_server_instance_st ptr); + const char *memcached_server_error(const memcached_instance_st * ptr); LIBMEMCACHED_API - memcached_return_t memcached_server_error_return(const memcached_server_instance_st ptr); + memcached_return_t memcached_server_error_return(const memcached_instance_st * ptr); #ifdef __cplusplus } // extern "C" diff --git a/libmemcached-1.0/memcached.h b/libmemcached-1.0/memcached.h index 23462a76..3c11f619 100644 --- a/libmemcached-1.0/memcached.h +++ b/libmemcached-1.0/memcached.h @@ -156,7 +156,7 @@ LIBMEMCACHED_API memcached_return_t memcached_push(memcached_st *destination, const memcached_st *source); LIBMEMCACHED_API -memcached_server_instance_st memcached_server_instance_by_position(const memcached_st *ptr, uint32_t server_key); +const memcached_instance_st * memcached_server_instance_by_position(const memcached_st *ptr, uint32_t server_key); LIBMEMCACHED_API uint32_t memcached_server_count(const memcached_st *); diff --git a/libmemcached-1.0/memcached.hpp b/libmemcached-1.0/memcached.hpp index 4f12e2ec..6500c0ab 100644 --- a/libmemcached-1.0/memcached.hpp +++ b/libmemcached-1.0/memcached.hpp @@ -847,7 +847,7 @@ public: */ for (uint32_t x= 0; x < server_count; x++) { - memcached_server_instance_st instance= memcached_server_instance_by_position(memc_, x); + const memcached_instance_st * instance= memcached_server_instance_by_position(memc_, x); std::ostringstream strstm; std::string server_name(memcached_server_name(instance)); server_name.append(":"); diff --git a/libmemcached-1.0/server.h b/libmemcached-1.0/server.h index dc650d2a..856c0e7e 100644 --- a/libmemcached-1.0/server.h +++ b/libmemcached-1.0/server.h @@ -51,7 +51,7 @@ memcached_return_t memcached_server_cursor(const memcached_st *ptr, uint32_t number_of_callbacks); LIBMEMCACHED_API - memcached_server_instance_st memcached_server_by_key(memcached_st *ptr, + const memcached_instance_st * memcached_server_by_key(memcached_st *ptr, const char *key, size_t key_length, memcached_return_t *error); @@ -63,7 +63,7 @@ LIBMEMCACHED_API void memcached_server_free(memcached_server_st *ptr); LIBMEMCACHED_API -memcached_server_instance_st memcached_server_get_last_disconnect(const memcached_st *ptr); +const memcached_instance_st * memcached_server_get_last_disconnect(const memcached_st *ptr); LIBMEMCACHED_API @@ -95,28 +95,28 @@ memcached_return_t memcached_server_add_with_weight(memcached_st *ptr, const cha Operations on Single Servers. */ LIBMEMCACHED_API -uint32_t memcached_server_response_count(const memcached_server_instance_st self); +uint32_t memcached_server_response_count(const memcached_instance_st * self); LIBMEMCACHED_API -const char *memcached_server_name(const memcached_server_instance_st self); +const char *memcached_server_name(const memcached_instance_st * self); LIBMEMCACHED_API -in_port_t memcached_server_port(const memcached_server_instance_st self); +in_port_t memcached_server_port(const memcached_instance_st * self); LIBMEMCACHED_API -void memcached_instance_next_retry(memcached_server_instance_st self, const time_t absolute_time); +void memcached_instance_next_retry(const memcached_instance_st * self, const time_t absolute_time); LIBMEMCACHED_API -const char *memcached_server_type(const memcached_server_instance_st ptr); +const char *memcached_server_type(const memcached_instance_st * ptr); LIBMEMCACHED_API -uint8_t memcached_server_major_version(const memcached_server_instance_st ptr); +uint8_t memcached_server_major_version(const memcached_instance_st * ptr); LIBMEMCACHED_API -uint8_t memcached_server_minor_version(const memcached_server_instance_st ptr); +uint8_t memcached_server_minor_version(const memcached_instance_st * ptr); LIBMEMCACHED_API -uint8_t memcached_server_micro_version(const memcached_server_instance_st ptr); +uint8_t memcached_server_micro_version(const memcached_instance_st * ptr); #ifdef __cplusplus } // extern "C" diff --git a/libmemcached-1.0/struct/memcached.h b/libmemcached-1.0/struct/memcached.h index 624887b7..37df2751 100644 --- a/libmemcached-1.0/struct/memcached.h +++ b/libmemcached-1.0/struct/memcached.h @@ -74,13 +74,8 @@ struct memcached_st { unsigned int version; } server_info; uint32_t number_of_hosts; -#ifdef __cplusplus - org::libmemcached::Instance* servers; - org::libmemcached::Instance* last_disconnected_server; -#else - void *servers; - void *last_disconnected_server; -#endif + memcached_instance_st *servers; + memcached_instance_st *last_disconnected_server; int32_t snd_timeout; int32_t rcv_timeout; uint32_t server_failure_limit; diff --git a/libmemcached-1.0/types.h b/libmemcached-1.0/types.h index 53992d3a..2c3f87af 100644 --- a/libmemcached-1.0/types.h +++ b/libmemcached-1.0/types.h @@ -40,8 +40,6 @@ #ifdef __cplusplus -namespace org { namespace libmemcached { struct Instance; } } - struct memcached_st; struct memcached_stat_st; struct memcached_analysis_st; @@ -52,7 +50,7 @@ struct memcached_error_t; // All of the flavors of memcache_server_st struct memcached_server_st; struct memcached_instance_st; -typedef const org::libmemcached::Instance* memcached_server_instance_st; +typedef struct memcached_instance_st memcached_instance_st; typedef struct memcached_server_st *memcached_server_list_st; struct memcached_callback_st; @@ -73,7 +71,7 @@ typedef struct memcached_error_t memcached_error_t; // All of the flavors of memcache_server_st typedef struct memcached_server_st memcached_server_st; -typedef const void *memcached_server_instance_st; +typedef struct memcached_instance_st memcached_instance_st; typedef struct memcached_server_st *memcached_server_list_st; typedef struct memcached_callback_st memcached_callback_st; diff --git a/libmemcached/auto.cc b/libmemcached/auto.cc index 85e2ae09..685528f2 100644 --- a/libmemcached/auto.cc +++ b/libmemcached/auto.cc @@ -37,7 +37,7 @@ #include -static void auto_response(org::libmemcached::Instance* instance, const bool reply, memcached_return_t& rc, uint64_t* value) +static void auto_response(memcached_instance_st* instance, const bool reply, memcached_return_t& rc, uint64_t* value) { // If the message was successfully sent, then get the response, otherwise // fail. @@ -63,7 +63,7 @@ static void auto_response(org::libmemcached::Instance* instance, const bool repl } } -static memcached_return_t text_incr_decr(org::libmemcached::Instance* instance, +static memcached_return_t text_incr_decr(memcached_instance_st* instance, const bool is_incr, const char *key, size_t key_length, const uint64_t offset, @@ -97,7 +97,7 @@ static memcached_return_t text_incr_decr(org::libmemcached::Instance* instance, return memcached_vdo(instance, vector, 7, true); } -static memcached_return_t binary_incr_decr(org::libmemcached::Instance* instance, +static memcached_return_t binary_incr_decr(memcached_instance_st* instance, protocol_binary_command cmd, const char *key, const size_t key_length, const uint64_t offset, @@ -180,7 +180,7 @@ static memcached_return_t increment_decrement_by_key(const protocol_binary_comma } uint32_t server_key= memcached_generate_hash_with_redistribution(memc, group_key, group_key_length); - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, server_key); + memcached_instance_st* instance= memcached_instance_fetch(memc, server_key); bool reply= memcached_is_replying(instance->root); @@ -239,7 +239,7 @@ static memcached_return_t increment_decrement_with_initial_by_key(const protocol } uint32_t server_key= memcached_generate_hash_with_redistribution(memc, group_key, group_key_length); - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, server_key); + memcached_instance_st* instance= memcached_instance_fetch(memc, server_key); bool reply= memcached_is_replying(instance->root); diff --git a/libmemcached/behavior.cc b/libmemcached/behavior.cc index 7a8b9853..2675e236 100644 --- a/libmemcached/behavior.cc +++ b/libmemcached/behavior.cc @@ -413,7 +413,7 @@ uint64_t memcached_behavior_get(memcached_st *shell, return (uint64_t) ptr->send_size; } - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, 0); + memcached_instance_st* instance= memcached_instance_fetch(ptr, 0); if (instance) // If we have an instance we test, otherwise we just set and pray { @@ -447,7 +447,7 @@ uint64_t memcached_behavior_get(memcached_st *shell, if (ptr->recv_size != -1) // If value is -1 then we are using the default return (uint64_t) ptr->recv_size; - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, 0); + memcached_instance_st* instance= memcached_instance_fetch(ptr, 0); /** @note REFACTOR diff --git a/libmemcached/common.h b/libmemcached/common.h index 71db19b0..897b0969 100644 --- a/libmemcached/common.h +++ b/libmemcached/common.h @@ -123,7 +123,7 @@ typedef struct memcached_st Memcached; #endif #ifdef __cplusplus -org::libmemcached::Instance* memcached_instance_fetch(memcached_st *ptr, uint32_t server_key); +memcached_instance_st* memcached_instance_fetch(memcached_st *ptr, uint32_t server_key); #endif /* These are private not to be installed headers */ @@ -198,7 +198,7 @@ extern "C" { memcached_return_t run_distribution(memcached_st *ptr); #ifdef __cplusplus -static inline void memcached_server_response_increment(org::libmemcached::Instance* instance) +static inline void memcached_server_response_increment(memcached_instance_st* instance) { instance->events(POLLIN); instance->cursor_active_++; @@ -217,6 +217,6 @@ static inline void memcached_server_response_increment(org::libmemcached::Instan #endif #ifdef __cplusplus -bool memcached_purge(org::libmemcached::Instance*); -org::libmemcached::Instance* memcached_instance_by_position(const memcached_st *ptr, uint32_t server_key); +bool memcached_purge(memcached_instance_st*); +memcached_instance_st* memcached_instance_by_position(const memcached_st *ptr, uint32_t server_key); #endif diff --git a/libmemcached/connect.cc b/libmemcached/connect.cc index 2e2dbf61..cb88c13b 100644 --- a/libmemcached/connect.cc +++ b/libmemcached/connect.cc @@ -64,7 +64,7 @@ # define TCP_KEEPIDLE 0 #endif -static memcached_return_t connect_poll(org::libmemcached::Instance* server, const int connection_error) +static memcached_return_t connect_poll(memcached_instance_st* server, const int connection_error) { struct pollfd fds[1]; fds[0].fd= server->fd; @@ -181,7 +181,7 @@ static memcached_return_t connect_poll(org::libmemcached::Instance* server, cons return memcached_set_errno(*server, connection_error, MEMCACHED_AT, memcached_literal_param("connect_poll() was exhausted")); } -static memcached_return_t set_hostinfo(org::libmemcached::Instance* server) +static memcached_return_t set_hostinfo(memcached_instance_st* server) { assert(server->type != MEMCACHED_CONNECTION_UNIX_SOCKET); server->clear_addrinfo(); @@ -245,7 +245,7 @@ static memcached_return_t set_hostinfo(org::libmemcached::Instance* server) return MEMCACHED_SUCCESS; } -static inline void set_socket_nonblocking(org::libmemcached::Instance* server) +static inline void set_socket_nonblocking(memcached_instance_st* server) { #if defined(_WIN32) u_long arg= 1; @@ -285,7 +285,7 @@ static inline void set_socket_nonblocking(org::libmemcached::Instance* server) #endif } -static bool set_socket_options(org::libmemcached::Instance* server) +static bool set_socket_options(memcached_instance_st* server) { assert_msg(server->fd != INVALID_SOCKET, "invalid socket was passed to set_socket_options()"); @@ -439,7 +439,7 @@ static bool set_socket_options(org::libmemcached::Instance* server) return true; } -static memcached_return_t unix_socket_connect(org::libmemcached::Instance* server) +static memcached_return_t unix_socket_connect(memcached_instance_st* server) { #ifndef _WIN32 WATCHPOINT_ASSERT(server->fd == INVALID_SOCKET); @@ -505,7 +505,7 @@ static memcached_return_t unix_socket_connect(org::libmemcached::Instance* serve #endif } -static memcached_return_t network_connect(org::libmemcached::Instance* server) +static memcached_return_t network_connect(memcached_instance_st* server) { bool timeout_error_occured= false; @@ -657,7 +657,7 @@ static memcached_return_t network_connect(org::libmemcached::Instance* server) Based on time/failure count fail the connect without trying. This prevents waiting in a state where we get caught spending cycles just waiting. */ -static memcached_return_t backoff_handling(org::libmemcached::Instance* server, bool& in_timeout) +static memcached_return_t backoff_handling(memcached_instance_st* server, bool& in_timeout) { struct timeval curr_time; bool _gettime_success= (gettimeofday(&curr_time, NULL) == 0); @@ -724,7 +724,7 @@ static memcached_return_t backoff_handling(org::libmemcached::Instance* server, return MEMCACHED_SUCCESS; } -static memcached_return_t _memcached_connect(org::libmemcached::Instance* server, const bool set_last_disconnected) +static memcached_return_t _memcached_connect(memcached_instance_st* server, const bool set_last_disconnected) { assert(server); if (server->fd != INVALID_SOCKET) @@ -811,7 +811,7 @@ static memcached_return_t _memcached_connect(org::libmemcached::Instance* server return rc; } -memcached_return_t memcached_connect(org::libmemcached::Instance* server) +memcached_return_t memcached_connect(memcached_instance_st* server) { return _memcached_connect(server, true); } diff --git a/libmemcached/connect.hpp b/libmemcached/connect.hpp index de1c8df5..d1dafe5e 100644 --- a/libmemcached/connect.hpp +++ b/libmemcached/connect.hpp @@ -37,4 +37,4 @@ #pragma once -memcached_return_t memcached_connect(org::libmemcached::Instance*); +memcached_return_t memcached_connect(memcached_instance_st*); diff --git a/libmemcached/delete.cc b/libmemcached/delete.cc index 67957f45..55a8b4ca 100644 --- a/libmemcached/delete.cc +++ b/libmemcached/delete.cc @@ -44,7 +44,7 @@ memcached_return_t memcached_delete(memcached_st *shell, const char *key, size_t return memcached_delete_by_key(shell, key, key_length, key, key_length, expiration); } -static inline memcached_return_t ascii_delete(org::libmemcached::Instance* instance, +static inline memcached_return_t ascii_delete(memcached_instance_st* instance, uint32_t , const char *key, const size_t key_length, @@ -65,7 +65,7 @@ static inline memcached_return_t ascii_delete(org::libmemcached::Instance* insta return memcached_vdo(instance, vector, 6, is_buffering ? false : true); } -static inline memcached_return_t binary_delete(org::libmemcached::Instance* instance, +static inline memcached_return_t binary_delete(memcached_instance_st* instance, uint32_t server_key, const char *key, const size_t key_length, @@ -118,7 +118,7 @@ static inline memcached_return_t binary_delete(org::libmemcached::Instance* inst server_key= 0; } - org::libmemcached::Instance* replica= memcached_instance_fetch(instance->root, server_key); + memcached_instance_st* replica= memcached_instance_fetch(instance->root, server_key); if (memcached_fatal(memcached_vdo(replica, vector, 4, should_flush))) { @@ -161,7 +161,7 @@ memcached_return_t memcached_delete_by_key(memcached_st *shell, } uint32_t server_key= memcached_generate_hash_with_redistribution(memc, group_key, group_key_length); - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, server_key); + memcached_instance_st* instance= memcached_instance_fetch(memc, server_key); bool is_buffering= memcached_is_buffering(instance->root); bool is_replying= memcached_is_replying(instance->root); diff --git a/libmemcached/do.cc b/libmemcached/do.cc index 73ef06d3..9ba513f2 100644 --- a/libmemcached/do.cc +++ b/libmemcached/do.cc @@ -11,7 +11,7 @@ #include -static memcached_return_t _vdo_udp(org::libmemcached::Instance* instance, +static memcached_return_t _vdo_udp(memcached_instance_st* instance, libmemcached_io_vector_st vector[], const size_t count) { @@ -64,7 +64,7 @@ static memcached_return_t _vdo_udp(org::libmemcached::Instance* instance, #endif } -memcached_return_t memcached_vdo(org::libmemcached::Instance* instance, +memcached_return_t memcached_vdo(memcached_instance_st* instance, libmemcached_io_vector_st vector[], const size_t count, const bool with_flush) diff --git a/libmemcached/do.hpp b/libmemcached/do.hpp index 109c0ac1..d2dc6671 100644 --- a/libmemcached/do.hpp +++ b/libmemcached/do.hpp @@ -2,7 +2,7 @@ * * Libmemcached library * - * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/ * Copyright (C) 2006-2009 Brian Aker All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,7 +37,7 @@ #pragma once -memcached_return_t memcached_vdo(org::libmemcached::Instance* ptr, +memcached_return_t memcached_vdo(memcached_instance_st*, libmemcached_io_vector_st vector[], const size_t count, const bool with_flush); diff --git a/libmemcached/dump.cc b/libmemcached/dump.cc index 35da13f5..8ddb2eef 100644 --- a/libmemcached/dump.cc +++ b/libmemcached/dump.cc @@ -68,7 +68,7 @@ static memcached_return_t ascii_dump(Memcached *memc, memcached_dump_fn *callbac // Send message to all servers for (uint32_t server_key= 0; server_key < memcached_server_count(memc); server_key++) { - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, server_key); + memcached_instance_st* instance= memcached_instance_fetch(memc, server_key); memcached_return_t vdo_rc; if (memcached_success((vdo_rc= memcached_vdo(instance, vector, 3, true)))) @@ -82,7 +82,7 @@ static memcached_return_t ascii_dump(Memcached *memc, memcached_dump_fn *callbac } // Collect the returned items - org::libmemcached::Instance* instance; + memcached_instance_st* instance; memcached_return_t read_ret= MEMCACHED_SUCCESS; while ((instance= memcached_io_get_readable_server(memc, read_ret))) { diff --git a/libmemcached/error.cc b/libmemcached/error.cc index 64aefa03..266f78b5 100644 --- a/libmemcached/error.cc +++ b/libmemcached/error.cc @@ -52,7 +52,7 @@ struct memcached_error_t char message[MAX_ERROR_LENGTH]; }; -static void _set(org::libmemcached::Instance& server, Memcached& memc) +static void _set(memcached_instance_st& server, Memcached& memc) { if (server.error_messages and server.error_messages->query_id != server.root->query_id) { @@ -215,7 +215,7 @@ memcached_return_t memcached_set_error(Memcached& memc, memcached_return_t rc, c return memcached_set_error(memc, rc, at, tmp); } -memcached_return_t memcached_set_error(org::libmemcached::Instance& self, memcached_return_t rc, const char *at, const char *str, size_t length) +memcached_return_t memcached_set_error(memcached_instance_st& self, memcached_return_t rc, const char *at, const char *str, size_t length) { assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client"); assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a Instance"); @@ -255,7 +255,7 @@ memcached_return_t memcached_set_parser_error(Memcached& memc, return memcached_set_error(memc, MEMCACHED_PARSE_ERROR, at, buffer, length); } -static inline size_t append_host_to_string(org::libmemcached::Instance& self, char* buffer, const size_t buffer_length) +static inline size_t append_host_to_string(memcached_instance_st& self, char* buffer, const size_t buffer_length) { size_t size= 0; switch (self.type) @@ -275,10 +275,10 @@ static inline size_t append_host_to_string(org::libmemcached::Instance& self, ch return size; } -memcached_return_t memcached_set_error(org::libmemcached::Instance& self, memcached_return_t rc, const char *at, memcached_string_t& str) +memcached_return_t memcached_set_error(memcached_instance_st& self, memcached_return_t rc, const char *at, memcached_string_t& str) { assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client"); - assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a org::libmemcached::Instance"); + assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a memcached_instance_st"); if (memcached_fatal(rc) == false and rc != MEMCACHED_CLIENT_ERROR) { return rc; @@ -313,9 +313,9 @@ memcached_return_t memcached_set_error(org::libmemcached::Instance& self, memcac return rc; } -memcached_return_t memcached_set_error(org::libmemcached::Instance& self, memcached_return_t rc, const char *at) +memcached_return_t memcached_set_error(memcached_instance_st& self, memcached_return_t rc, const char *at) { - assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a org::libmemcached::Instance"); + assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a memcached_instance_st"); if (memcached_fatal(rc) == false) { return rc; @@ -356,7 +356,7 @@ memcached_return_t memcached_set_errno(Memcached& self, int local_errno, const c return memcached_set_errno(self, local_errno, at, tmp); } -memcached_return_t memcached_set_errno(org::libmemcached::Instance& self, int local_errno, const char *at, const char *str, size_t length) +memcached_return_t memcached_set_errno(memcached_instance_st& self, int local_errno, const char *at, const char *str, size_t length) { memcached_string_t tmp= { str, length }; return memcached_set_errno(self, local_errno, at, tmp); @@ -388,7 +388,7 @@ memcached_return_t memcached_set_errno(Memcached& memc, int local_errno, const c return rc; } -memcached_return_t memcached_set_errno(org::libmemcached::Instance& self, int local_errno, const char *at, memcached_string_t& str) +memcached_return_t memcached_set_errno(memcached_instance_st& self, int local_errno, const char *at, memcached_string_t& str) { if (local_errno == 0) { @@ -427,7 +427,7 @@ memcached_return_t memcached_set_errno(org::libmemcached::Instance& self, int lo return rc; } -memcached_return_t memcached_set_errno(org::libmemcached::Instance& self, int local_errno, const char *at) +memcached_return_t memcached_set_errno(memcached_instance_st& self, int local_errno, const char *at) { if (local_errno == 0) { @@ -482,7 +482,7 @@ void memcached_error_print(const Memcached *shell) for (uint32_t x= 0; x < memcached_server_count(self); x++) { - org::libmemcached::Instance* instance= memcached_instance_by_position(self, x); + memcached_instance_st* instance= memcached_instance_by_position(self, x); _error_print(instance->error_messages); } @@ -504,7 +504,7 @@ void memcached_error_free(Memcached& self) self.error_messages= NULL; } -void memcached_error_free(org::libmemcached::Instance& self) +void memcached_error_free(memcached_instance_st& self) { _error_free(self.error_messages); self.error_messages= NULL; @@ -554,7 +554,7 @@ bool memcached_has_current_error(Memcached &memc) return false; } -bool memcached_has_current_error(org::libmemcached::Instance& server) +bool memcached_has_current_error(memcached_instance_st& server) { return memcached_has_current_error(*(server.root)); } @@ -591,7 +591,7 @@ int memcached_last_error_errno(const memcached_st *shell) return memc->error_messages->local_errno; } -const char *memcached_server_error(const memcached_server_instance_st server) +const char *memcached_server_error(const memcached_instance_st * server) { if (server == NULL) { @@ -612,7 +612,7 @@ const char *memcached_server_error(const memcached_server_instance_st server) } -memcached_error_t *memcached_error_copy(const org::libmemcached::Instance& server) +memcached_error_t *memcached_error_copy(const memcached_instance_st& server) { if (server.error_messages == NULL) { @@ -626,7 +626,7 @@ memcached_error_t *memcached_error_copy(const org::libmemcached::Instance& serve return error; } -memcached_return_t memcached_server_error_return(memcached_server_instance_st ptr) +memcached_return_t memcached_server_error_return(const memcached_instance_st * ptr) { if (ptr == NULL) { @@ -641,7 +641,7 @@ memcached_return_t memcached_server_error_return(memcached_server_instance_st pt return MEMCACHED_SUCCESS; } -memcached_return_t memcached_instance_error_return(org::libmemcached::Instance* instance) +memcached_return_t memcached_instance_error_return(memcached_instance_st* instance) { if (instance == NULL) { diff --git a/libmemcached/error.hpp b/libmemcached/error.hpp index 733f7686..847dbc24 100644 --- a/libmemcached/error.hpp +++ b/libmemcached/error.hpp @@ -51,40 +51,40 @@ memcached_return_t memcached_set_parser_error(Memcached& memc, memcached_return_t memcached_set_error(Memcached&, memcached_return_t rc, const char *at); -memcached_return_t memcached_set_error(org::libmemcached::Instance&, memcached_return_t rc, const char *at); +memcached_return_t memcached_set_error(memcached_instance_st&, memcached_return_t rc, const char *at); memcached_return_t memcached_set_error(Memcached&, memcached_return_t rc, const char *at, const char *str, size_t length); -memcached_return_t memcached_set_error(org::libmemcached::Instance&, memcached_return_t rc, const char *at, const char *str, size_t length); +memcached_return_t memcached_set_error(memcached_instance_st&, memcached_return_t rc, const char *at, const char *str, size_t length); memcached_return_t memcached_set_error(Memcached& memc, memcached_return_t rc, const char *at, memcached_string_t& str); -memcached_return_t memcached_set_error(org::libmemcached::Instance&, memcached_return_t rc, const char *at, memcached_string_t& str); +memcached_return_t memcached_set_error(memcached_instance_st&, memcached_return_t rc, const char *at, memcached_string_t& str); memcached_return_t memcached_set_errno(Memcached& memc, int local_errno, const char *at, memcached_string_t& str); -memcached_return_t memcached_set_errno(org::libmemcached::Instance&, int local_errno, const char *at, memcached_string_t& str); +memcached_return_t memcached_set_errno(memcached_instance_st&, int local_errno, const char *at, memcached_string_t& str); memcached_return_t memcached_set_errno(Memcached& memc, int local_errno, const char *at, const char *str, size_t length); -memcached_return_t memcached_set_errno(org::libmemcached::Instance&, int local_errno, const char *at, const char *str, size_t length); +memcached_return_t memcached_set_errno(memcached_instance_st&, int local_errno, const char *at, const char *str, size_t length); memcached_return_t memcached_set_errno(Memcached& memc, int local_errno, const char *at); -memcached_return_t memcached_set_errno(org::libmemcached::Instance&, int local_errno, const char *at); +memcached_return_t memcached_set_errno(memcached_instance_st&, int local_errno, const char *at); bool memcached_has_current_error(Memcached&); -bool memcached_has_current_error(org::libmemcached::Instance&); +bool memcached_has_current_error(memcached_instance_st&); void memcached_error_free(Memcached&); void memcached_error_free(memcached_server_st&); -void memcached_error_free(org::libmemcached::Instance& self); +void memcached_error_free(memcached_instance_st& self); -memcached_error_t *memcached_error_copy(const org::libmemcached::Instance&); +memcached_error_t *memcached_error_copy(const memcached_instance_st&); -memcached_return_t memcached_instance_error_return(org::libmemcached::Instance*); +memcached_return_t memcached_instance_error_return(memcached_instance_st*); #endif diff --git a/libmemcached/exist.cc b/libmemcached/exist.cc index 8ed60545..3afb42d4 100644 --- a/libmemcached/exist.cc +++ b/libmemcached/exist.cc @@ -36,7 +36,7 @@ #include -static memcached_return_t ascii_exist(Memcached *memc, org::libmemcached::Instance* instance, const char *key, size_t key_length) +static memcached_return_t ascii_exist(Memcached *memc, memcached_instance_st* instance, const char *key, size_t key_length) { libmemcached_io_vector_st vector[]= { @@ -74,7 +74,7 @@ static memcached_return_t ascii_exist(Memcached *memc, org::libmemcached::Instan return rc; } -static memcached_return_t binary_exist(Memcached *memc, org::libmemcached::Instance* instance, const char *key, size_t key_length) +static memcached_return_t binary_exist(Memcached *memc, memcached_instance_st* instance, const char *key, size_t key_length) { protocol_binary_request_set request= {}; size_t send_length= sizeof(request.bytes); @@ -144,7 +144,7 @@ memcached_return_t memcached_exist_by_key(memcached_st *shell, } uint32_t server_key= memcached_generate_hash_with_redistribution(memc, group_key, group_key_length); - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, server_key); + memcached_instance_st* instance= memcached_instance_fetch(memc, server_key); if (memcached_is_binary(memc)) { diff --git a/libmemcached/fetch.cc b/libmemcached/fetch.cc index 8eef0c78..7f677d02 100644 --- a/libmemcached/fetch.cc +++ b/libmemcached/fetch.cc @@ -192,7 +192,7 @@ memcached_result_st *memcached_fetch_result(memcached_st *ptr, } *error= MEMCACHED_MAXIMUM_RETURN; // We use this to see if we ever go into the loop - org::libmemcached::Instance *server; + memcached_instance_st *server; memcached_return_t read_ret= MEMCACHED_SUCCESS; while ((server= memcached_io_get_readable_server(ptr, read_ret))) { diff --git a/libmemcached/flush.cc b/libmemcached/flush.cc index 521515ac..cbb66bfe 100644 --- a/libmemcached/flush.cc +++ b/libmemcached/flush.cc @@ -52,7 +52,7 @@ static memcached_return_t memcached_flush_binary(Memcached *ptr, for (uint32_t x= 0; x < memcached_server_count(ptr); x++) { - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x); + memcached_instance_st* instance= memcached_instance_fetch(ptr, x); initialize_binary_request(instance, request.message.header); if (reply) @@ -84,7 +84,7 @@ static memcached_return_t memcached_flush_binary(Memcached *ptr, for (uint32_t x= 0; x < memcached_server_count(ptr); x++) { - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x); + memcached_instance_st* instance= memcached_instance_fetch(ptr, x); if (instance->response_count() > 0) { @@ -115,7 +115,7 @@ static memcached_return_t memcached_flush_textual(Memcached *ptr, memcached_return_t rc= MEMCACHED_SUCCESS; for (uint32_t x= 0; x < memcached_server_count(ptr); x++) { - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x); + memcached_instance_st* instance= memcached_instance_fetch(ptr, x); libmemcached_io_vector_st vector[]= { diff --git a/libmemcached/flush_buffers.cc b/libmemcached/flush_buffers.cc index 3fa935c8..24f7c0df 100644 --- a/libmemcached/flush_buffers.cc +++ b/libmemcached/flush_buffers.cc @@ -46,7 +46,7 @@ memcached_return_t memcached_flush_buffers(memcached_st *shell) for (uint32_t x= 0; x < memcached_server_count(memc); ++x) { - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x); + memcached_instance_st* instance= memcached_instance_fetch(memc, x); if (instance->write_buffer_offset != 0) { diff --git a/libmemcached/get.cc b/libmemcached/get.cc index 0f151e8d..1f7e775c 100644 --- a/libmemcached/get.cc +++ b/libmemcached/get.cc @@ -244,7 +244,7 @@ static memcached_return_t __mget_by_key_real(memcached_st *ptr, */ for (uint32_t x= 0; x < memcached_server_count(ptr); x++) { - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x); + memcached_instance_st* instance= memcached_instance_fetch(ptr, x); if (instance->response_count()) { @@ -293,7 +293,7 @@ static memcached_return_t __mget_by_key_real(memcached_st *ptr, server_key= memcached_generate_hash_with_redistribution(ptr, keys[x], key_length[x]); } - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, server_key); + memcached_instance_st* instance= memcached_instance_fetch(ptr, server_key); libmemcached_io_vector_st vector[]= { @@ -354,7 +354,7 @@ static memcached_return_t __mget_by_key_real(memcached_st *ptr, bool success_happened= false; for (uint32_t x= 0; x < memcached_server_count(ptr); x++) { - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x); + memcached_instance_st* instance= memcached_instance_fetch(ptr, x); if (instance->response_count()) { @@ -480,7 +480,7 @@ static memcached_return_t simple_binary_mget(memcached_st *ptr, server_key= memcached_generate_hash_with_redistribution(ptr, keys[x], key_length[x]); } - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, server_key); + memcached_instance_st* instance= memcached_instance_fetch(ptr, server_key); if (instance->response_count() == 0) { @@ -553,7 +553,7 @@ static memcached_return_t simple_binary_mget(memcached_st *ptr, for (uint32_t x= 0; x < memcached_server_count(ptr); ++x) { - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x); + memcached_instance_st* instance= memcached_instance_fetch(ptr, x); if (instance->response_count()) { @@ -618,7 +618,7 @@ static memcached_return_t replication_binary_mget(memcached_st *ptr, continue; } - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, server); + memcached_instance_st* instance= memcached_instance_fetch(ptr, server); if (instance->response_count() == 0) { diff --git a/libmemcached/hosts.cc b/libmemcached/hosts.cc index 747245f9..121e8f7c 100644 --- a/libmemcached/hosts.cc +++ b/libmemcached/hosts.cc @@ -46,8 +46,8 @@ static memcached_return_t update_continuum(Memcached *ptr); static int compare_servers(const void *p1, const void *p2) { - memcached_server_instance_st a= (memcached_server_instance_st)p1; - memcached_server_instance_st b= (memcached_server_instance_st)p2; + const memcached_instance_st * a= (const memcached_instance_st *)p1; + const memcached_instance_st * b= (const memcached_instance_st *)p2; int return_value= strcmp(a->_hostname, b->_hostname); @@ -63,7 +63,7 @@ static void sort_hosts(Memcached *ptr) { if (memcached_server_count(ptr)) { - qsort(memcached_instance_list(ptr), memcached_server_count(ptr), sizeof(org::libmemcached::Instance), compare_servers); + qsort(memcached_instance_list(ptr), memcached_server_count(ptr), sizeof(memcached_instance_st), compare_servers); } } @@ -146,7 +146,7 @@ static memcached_return_t update_continuum(Memcached *ptr) return memcached_set_errno(*ptr, errno, MEMCACHED_AT); } - org::libmemcached::Instance* list= memcached_instance_list(ptr); + memcached_instance_st* list= memcached_instance_list(ptr); /* count live servers (those without a retry delay set) */ bool is_auto_ejecting= _is_auto_eject_host(ptr); @@ -365,7 +365,7 @@ static memcached_return_t server_add(Memcached *memc, } uint32_t host_list_size= memc->number_of_hosts +1; - org::libmemcached::Instance* new_host_list= libmemcached_xrealloc(memc, memcached_instance_list(memc), host_list_size, org::libmemcached::Instance); + memcached_instance_st* new_host_list= libmemcached_xrealloc(memc, memcached_instance_list(memc), host_list_size, memcached_instance_st); if (new_host_list == NULL) { @@ -376,7 +376,7 @@ static memcached_return_t server_add(Memcached *memc, assert(memc->number_of_hosts == host_list_size); /* TODO: Check return type */ - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, memcached_server_count(memc) -1); + memcached_instance_st* instance= memcached_instance_fetch(memc, memcached_server_count(memc) -1); if (__instance_create_with(memc, instance, hostname, port, weight, type) == NULL) { @@ -409,7 +409,7 @@ memcached_return_t memcached_server_push(memcached_st *shell, const memcached_se uint32_t count= memcached_server_list_count(list); uint32_t host_list_size= count +original_host_size; - org::libmemcached::Instance* new_host_list= libmemcached_xrealloc(ptr, memcached_instance_list(ptr), host_list_size, org::libmemcached::Instance); + memcached_instance_st* new_host_list= libmemcached_xrealloc(ptr, memcached_instance_list(ptr), host_list_size, memcached_instance_st); if (new_host_list == NULL) { @@ -424,7 +424,7 @@ memcached_return_t memcached_server_push(memcached_st *shell, const memcached_se WATCHPOINT_ASSERT(list[x].hostname[0] != 0); // We have extended the array, and now we will find it, and use it. - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, original_host_size); + memcached_instance_st* instance= memcached_instance_fetch(ptr, original_host_size); WATCHPOINT_ASSERT(instance); memcached_string_t hostname= { memcached_string_make_from_cstr(list[x].hostname) }; @@ -449,7 +449,7 @@ memcached_return_t memcached_server_push(memcached_st *shell, const memcached_se return MEMCACHED_INVALID_ARGUMENTS; } -memcached_return_t memcached_instance_push(memcached_st *ptr, const struct org::libmemcached::Instance* list, uint32_t number_of_hosts) +memcached_return_t memcached_instance_push(memcached_st *ptr, const struct memcached_instance_st* list, uint32_t number_of_hosts) { if (list == NULL) { @@ -458,7 +458,7 @@ memcached_return_t memcached_instance_push(memcached_st *ptr, const struct org:: uint32_t original_host_size= memcached_server_count(ptr); uint32_t host_list_size= number_of_hosts +original_host_size; - org::libmemcached::Instance* new_host_list= libmemcached_xrealloc(ptr, memcached_instance_list(ptr), host_list_size, org::libmemcached::Instance); + memcached_instance_st* new_host_list= libmemcached_xrealloc(ptr, memcached_instance_list(ptr), host_list_size, memcached_instance_st); if (new_host_list == NULL) { @@ -477,7 +477,7 @@ memcached_return_t memcached_instance_push(memcached_st *ptr, const struct org:: WATCHPOINT_ASSERT(list[x]._hostname[0] != 0); // We have extended the array, and now we will find it, and use it. - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, original_host_size); + memcached_instance_st* instance= memcached_instance_fetch(ptr, original_host_size); WATCHPOINT_ASSERT(instance); memcached_string_t hostname= { memcached_string_make_from_cstr(list[x]._hostname) }; diff --git a/libmemcached/instance.cc b/libmemcached/instance.cc index ca3a30d8..82621f7a 100644 --- a/libmemcached/instance.cc +++ b/libmemcached/instance.cc @@ -37,7 +37,7 @@ #include -static inline void _server_init(org::libmemcached::Instance* self, Memcached *root, +static inline void _server_init(memcached_instance_st* self, Memcached *root, const memcached_string_t& hostname, in_port_t port, uint32_t weight, memcached_connection_t type) @@ -87,11 +87,11 @@ static inline void _server_init(org::libmemcached::Instance* self, Memcached *ro self->hostname(hostname); } -static org::libmemcached::Instance* _server_create(org::libmemcached::Instance* self, const memcached_st *memc) +static memcached_instance_st* _server_create(memcached_instance_st* self, const memcached_st *memc) { if (self == NULL) { - self= libmemcached_xmalloc(memc, org::libmemcached::Instance); + self= libmemcached_xmalloc(memc, memcached_instance_st); if (self == NULL) { @@ -110,7 +110,7 @@ static org::libmemcached::Instance* _server_create(org::libmemcached::Instance* return self; } -void org::libmemcached::Instance::events(short arg) +void memcached_instance_st::events(short arg) { if ((_events | arg) == _events) { @@ -120,7 +120,7 @@ void org::libmemcached::Instance::events(short arg) _events|= arg; } -void org::libmemcached::Instance::revents(short arg) +void memcached_instance_st::revents(short arg) { if (arg) { @@ -131,8 +131,8 @@ void org::libmemcached::Instance::revents(short arg) _events&= short(~arg); } -org::libmemcached::Instance* __instance_create_with(memcached_st *memc, - org::libmemcached::Instance* self, +memcached_instance_st* __instance_create_with(memcached_st *memc, + memcached_instance_st* self, const memcached_string_t& hostname, const in_port_t port, uint32_t weight, @@ -162,7 +162,7 @@ org::libmemcached::Instance* __instance_create_with(memcached_st *memc, return self; } -void __instance_free(org::libmemcached::Instance* self) +void __instance_free(memcached_instance_st* self) { memcached_quit_server(self, false); @@ -181,7 +181,7 @@ void __instance_free(org::libmemcached::Instance* self) } } -void memcached_instance_free(org::libmemcached::Instance* self) +void memcached_instance_free(memcached_instance_st* self) { if (self) { @@ -204,7 +204,7 @@ memcached_return_t memcached_server_cursor(const memcached_st* shell, size_t errors= 0; for (uint32_t x= 0; x < memcached_instance_list_count(memc); x++) { - org::libmemcached::Instance* instance= memcached_instance_by_position(memc, x); + memcached_instance_st* instance= memcached_instance_by_position(memc, x); for (uint32_t y= 0; y < number_of_callbacks; y++) { @@ -233,7 +233,7 @@ memcached_return_t memcached_server_execute(memcached_st *memc, bool some_errors= false;; for (uint32_t x= 0; x < memcached_instance_list_count(memc); x++) { - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x); + memcached_instance_st* instance= memcached_instance_fetch(memc, x); memcached_return_t rc= (*callback)(memc, instance, context); if (rc == MEMCACHED_INVALID_ARGUMENTS) @@ -250,7 +250,7 @@ memcached_return_t memcached_server_execute(memcached_st *memc, return MEMCACHED_SUCCESS; } -memcached_server_instance_st memcached_server_by_key(memcached_st *shell, +const memcached_instance_st * memcached_server_by_key(memcached_st *shell, const char *key, size_t key_length, memcached_return_t *error) @@ -283,7 +283,7 @@ memcached_server_instance_st memcached_server_by_key(memcached_st *shell, /* If we do not have a valid object to clone from, we toss an error. */ -static org::libmemcached::Instance* memcached_instance_clone(org::libmemcached::Instance* source) +static memcached_instance_st* memcached_instance_clone(memcached_instance_st* source) { /* We just do a normal create if source is missing */ if (source == NULL) @@ -299,7 +299,7 @@ static org::libmemcached::Instance* memcached_instance_clone(org::libmemcached:: source->type); } -void set_last_disconnected_host(org::libmemcached::Instance* self) +void set_last_disconnected_host(memcached_instance_st* self) { assert(self->root); if (self->root) @@ -313,54 +313,48 @@ void set_last_disconnected_host(org::libmemcached::Instance* self) // const_cast memcached_st *root= (memcached_st *)self->root; - memcached_instance_free((org::libmemcached::Instance*)(root->last_disconnected_server)); + memcached_instance_free((memcached_instance_st*)(root->last_disconnected_server)); // We set is_parsing so that no lookup happens root->state.is_parsing= true; root->last_disconnected_server= memcached_instance_clone(self); root->state.is_parsing= false; - ((org::libmemcached::Instance*)memcached_server_get_last_disconnect(root))->version= self->version; + ((memcached_instance_st*)memcached_server_get_last_disconnect(root))->version= self->version; } } -memcached_server_instance_st memcached_server_get_last_disconnect(const memcached_st *shell) +const memcached_instance_st * memcached_server_get_last_disconnect(const memcached_st *shell) { const Memcached* self= memcached2Memcached(shell); if (self) { - return (memcached_server_instance_st)self->last_disconnected_server; + return (const memcached_instance_st *)self->last_disconnected_server; } return 0; } -void memcached_instance_next_retry(memcached_server_instance_st self, const time_t absolute_time) +void memcached_instance_next_retry(const memcached_instance_st * self, const time_t absolute_time) { WATCHPOINT_ASSERT(self); if (self) { - ((org::libmemcached::Instance*)self)->next_retry= absolute_time; + ((memcached_instance_st*)self)->next_retry= absolute_time; } } -namespace org { -namespace libmemcached { - - bool Instance::valid() const +bool memcached_instance_st::valid() const +{ + if (fd == INVALID_SOCKET) { - if (fd == INVALID_SOCKET) - { - return false; - } - - return true; + return false; } - bool Instance::is_shutting_down() const - { - return options.is_shutting_down; - } + return true; +} -} // namespace libmemcached -} // namespace org +bool memcached_instance_st::is_shutting_down() const +{ + return options.is_shutting_down; +} diff --git a/libmemcached/instance.hpp b/libmemcached/instance.hpp index d0a772b9..c76dc7ee 100644 --- a/libmemcached/instance.hpp +++ b/libmemcached/instance.hpp @@ -58,11 +58,8 @@ #include "libmemcached/string.hpp" -namespace org { -namespace libmemcached { - // @todo Complete class transformation -struct Instance { +struct memcached_instance_st { in_port_t port() const { return port_; @@ -188,16 +185,13 @@ struct Instance { } }; -} // namespace libmemcached -} // namespace org - -org::libmemcached::Instance* __instance_create_with(memcached_st *memc, - org::libmemcached::Instance* self, - const memcached_string_t& _hostname, - const in_port_t port, - uint32_t weight, - const memcached_connection_t type); +memcached_instance_st* __instance_create_with(memcached_st *memc, + memcached_instance_st* self, + const memcached_string_t& _hostname, + const in_port_t port, + uint32_t weight, + const memcached_connection_t type); -memcached_return_t memcached_instance_push(memcached_st *ptr, const org::libmemcached::Instance*, uint32_t); +memcached_return_t memcached_instance_push(memcached_st *ptr, const memcached_instance_st*, uint32_t); -void __instance_free(org::libmemcached::Instance *); +void __instance_free(memcached_instance_st *); diff --git a/libmemcached/io.cc b/libmemcached/io.cc index 1cd03769..cb8ed5c2 100644 --- a/libmemcached/io.cc +++ b/libmemcached/io.cc @@ -43,7 +43,7 @@ # include #endif -void initialize_binary_request(org::libmemcached::Instance* server, protocol_binary_request_header& header) +void initialize_binary_request(memcached_instance_st* server, protocol_binary_request_header& header) { server->request_id++; header.request.magic= PROTOCOL_BINARY_REQ; @@ -61,7 +61,7 @@ enum memc_read_or_write { * * @param instance the server to pack */ -static bool repack_input_buffer(org::libmemcached::Instance* instance) +static bool repack_input_buffer(memcached_instance_st* instance) { if (instance->read_ptr != instance->read_buffer) { @@ -134,7 +134,7 @@ static bool repack_input_buffer(org::libmemcached::Instance* instance) * @param instance the server to star processing iput messages for * @return true if we processed anything, false otherwise */ -static bool process_input_buffer(org::libmemcached::Instance* instance) +static bool process_input_buffer(memcached_instance_st* instance) { /* ** We might be able to process some of the response messages if we @@ -176,7 +176,7 @@ static bool process_input_buffer(org::libmemcached::Instance* instance) return false; } -static memcached_return_t io_wait(org::libmemcached::Instance* instance, +static memcached_return_t io_wait(memcached_instance_st* instance, const memc_read_or_write read_or_write) { /* @@ -296,7 +296,7 @@ static memcached_return_t io_wait(org::libmemcached::Instance* instance, memcached_literal_param("number of attempts to call io_wait() failed")); } -static bool io_flush(org::libmemcached::Instance* instance, +static bool io_flush(memcached_instance_st* instance, const bool with_flush, memcached_return_t& error) { @@ -407,12 +407,12 @@ static bool io_flush(org::libmemcached::Instance* instance, return true; } -memcached_return_t memcached_io_wait_for_write(org::libmemcached::Instance* instance) +memcached_return_t memcached_io_wait_for_write(memcached_instance_st* instance) { return io_wait(instance, MEM_WRITE); } -static memcached_return_t _io_fill(org::libmemcached::Instance* instance) +static memcached_return_t _io_fill(memcached_instance_st* instance) { ssize_t data_read; do @@ -488,7 +488,7 @@ static memcached_return_t _io_fill(org::libmemcached::Instance* instance) return MEMCACHED_SUCCESS; } -memcached_return_t memcached_io_read(org::libmemcached::Instance* instance, +memcached_return_t memcached_io_read(memcached_instance_st* instance, void *buffer, size_t length, ssize_t& nread) { assert(memcached_is_udp(instance->root) == false); @@ -540,7 +540,7 @@ memcached_return_t memcached_io_read(org::libmemcached::Instance* instance, return MEMCACHED_SUCCESS; } -memcached_return_t memcached_io_slurp(org::libmemcached::Instance* instance) +memcached_return_t memcached_io_slurp(memcached_instance_st* instance) { assert_msg(instance, "Programmer error, invalid Instance"); assert(memcached_is_udp(instance->root) == false); @@ -597,7 +597,7 @@ memcached_return_t memcached_io_slurp(org::libmemcached::Instance* instance) return MEMCACHED_CONNECTION_FAILURE; } -static bool _io_write(org::libmemcached::Instance* instance, +static bool _io_write(memcached_instance_st* instance, const void *buffer, size_t length, bool with_flush, size_t& written) { @@ -650,13 +650,13 @@ static bool _io_write(org::libmemcached::Instance* instance, return true; } -bool memcached_io_write(org::libmemcached::Instance* instance) +bool memcached_io_write(memcached_instance_st* instance) { size_t written; return _io_write(instance, NULL, 0, true, written); } -ssize_t memcached_io_write(org::libmemcached::Instance* instance, +ssize_t memcached_io_write(memcached_instance_st* instance, const void *buffer, const size_t length, const bool with_flush) { size_t written; @@ -669,7 +669,7 @@ ssize_t memcached_io_write(org::libmemcached::Instance* instance, return ssize_t(written); } -bool memcached_io_writev(org::libmemcached::Instance* instance, +bool memcached_io_writev(memcached_instance_st* instance, libmemcached_io_vector_st vector[], const size_t number_of, const bool with_flush) { @@ -701,7 +701,7 @@ bool memcached_io_writev(org::libmemcached::Instance* instance, return (complete_total == total); } -void org::libmemcached::Instance::start_close_socket() +void memcached_instance_st::start_close_socket() { if (fd != INVALID_SOCKET) { @@ -710,7 +710,7 @@ void org::libmemcached::Instance::start_close_socket() } } -void org::libmemcached::Instance::reset_socket() +void memcached_instance_st::reset_socket() { if (fd != INVALID_SOCKET) { @@ -719,7 +719,7 @@ void org::libmemcached::Instance::reset_socket() } } -void org::libmemcached::Instance::close_socket() +void memcached_instance_st::close_socket() { if (fd != INVALID_SOCKET) { @@ -755,7 +755,7 @@ void org::libmemcached::Instance::close_socket() major_version= minor_version= micro_version= UINT8_MAX; } -org::libmemcached::Instance* memcached_io_get_readable_server(Memcached *memc, memcached_return_t&) +memcached_instance_st* memcached_io_get_readable_server(Memcached *memc, memcached_return_t&) { #define MAX_SERVERS_TO_POLL 100 struct pollfd fds[MAX_SERVERS_TO_POLL]; @@ -763,7 +763,7 @@ org::libmemcached::Instance* memcached_io_get_readable_server(Memcached *memc, m for (uint32_t x= 0; x < memcached_server_count(memc) and host_index < MAX_SERVERS_TO_POLL; ++x) { - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x); + memcached_instance_st* instance= memcached_instance_fetch(memc, x); if (instance->read_buffer_length > 0) /* I have data in the buffer */ { @@ -784,7 +784,7 @@ org::libmemcached::Instance* memcached_io_get_readable_server(Memcached *memc, m /* We have 0 or 1 server with pending events.. */ for (uint32_t x= 0; x< memcached_server_count(memc); ++x) { - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x); + memcached_instance_st* instance= memcached_instance_fetch(memc, x); if (instance->response_count() > 0) { @@ -811,7 +811,7 @@ org::libmemcached::Instance* memcached_io_get_readable_server(Memcached *memc, m { for (uint32_t y= 0; y < memcached_server_count(memc); ++y) { - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, y); + memcached_instance_st* instance= memcached_instance_fetch(memc, y); if (instance->fd == fds[x].fd) { @@ -828,7 +828,7 @@ org::libmemcached::Instance* memcached_io_get_readable_server(Memcached *memc, m /* Eventually we will just kill off the server with the problem. */ -void memcached_io_reset(org::libmemcached::Instance* instance) +void memcached_io_reset(memcached_instance_st* instance) { memcached_quit_server(instance, true); } @@ -837,7 +837,7 @@ void memcached_io_reset(org::libmemcached::Instance* instance) * Read a given number of bytes from the server and place it into a specific * buffer. Reset the IO channel on this server if an error occurs. */ -memcached_return_t memcached_safe_read(org::libmemcached::Instance* instance, +memcached_return_t memcached_safe_read(memcached_instance_st* instance, void *dta, const size_t size) { @@ -862,7 +862,7 @@ memcached_return_t memcached_safe_read(org::libmemcached::Instance* instance, return MEMCACHED_SUCCESS; } -memcached_return_t memcached_io_readline(org::libmemcached::Instance* instance, +memcached_return_t memcached_io_readline(memcached_instance_st* instance, char *buffer_ptr, size_t size, size_t& total_nr) diff --git a/libmemcached/io.hpp b/libmemcached/io.hpp index bf2133e8..f3fed345 100644 --- a/libmemcached/io.hpp +++ b/libmemcached/io.hpp @@ -38,35 +38,35 @@ #pragma once -void initialize_binary_request(org::libmemcached::Instance* server, protocol_binary_request_header&); +void initialize_binary_request(memcached_instance_st* server, protocol_binary_request_header&); -bool memcached_io_write(org::libmemcached::Instance* ptr); +bool memcached_io_write(memcached_instance_st* ptr); -ssize_t memcached_io_write(org::libmemcached::Instance* ptr, +ssize_t memcached_io_write(memcached_instance_st* ptr, const void *buffer, size_t length, bool with_flush); -bool memcached_io_writev(org::libmemcached::Instance* ptr, +bool memcached_io_writev(memcached_instance_st* ptr, libmemcached_io_vector_st vector[], const size_t number_of, const bool with_flush); -memcached_return_t memcached_io_wait_for_write(org::libmemcached::Instance* ptr); +memcached_return_t memcached_io_wait_for_write(memcached_instance_st* ptr); -void memcached_io_reset(org::libmemcached::Instance* ptr); +void memcached_io_reset(memcached_instance_st* ptr); -memcached_return_t memcached_io_read(org::libmemcached::Instance* ptr, +memcached_return_t memcached_io_read(memcached_instance_st* ptr, void *buffer, size_t length, ssize_t& nread); /* Read a line (terminated by '\n') into the buffer */ -memcached_return_t memcached_io_readline(org::libmemcached::Instance* ptr, +memcached_return_t memcached_io_readline(memcached_instance_st* ptr, char *buffer_ptr, size_t size, size_t& total); /* Read n bytes of data from the server and store them in dta */ -memcached_return_t memcached_safe_read(org::libmemcached::Instance* ptr, +memcached_return_t memcached_safe_read(memcached_instance_st* ptr, void *dta, const size_t size); -org::libmemcached::Instance* memcached_io_get_readable_server(memcached_st *memc, memcached_return_t&); +memcached_instance_st* memcached_io_get_readable_server(memcached_st *memc, memcached_return_t&); -memcached_return_t memcached_io_slurp(org::libmemcached::Instance* ptr); +memcached_return_t memcached_io_slurp(memcached_instance_st* ptr); diff --git a/libmemcached/memcached.cc b/libmemcached/memcached.cc index a5d1a527..a3c6a679 100644 --- a/libmemcached/memcached.cc +++ b/libmemcached/memcached.cc @@ -136,7 +136,7 @@ static void __memcached_free(Memcached *ptr, bool release_st) memcached_virtual_bucket_free(ptr); - memcached_instance_free((org::libmemcached::Instance*)ptr->last_disconnected_server); + memcached_instance_free((memcached_instance_st*)ptr->last_disconnected_server); if (ptr->on_cleanup) { @@ -297,7 +297,7 @@ void memcached_reset_last_disconnected_server(memcached_st *shell) Memcached* self= memcached2Memcached(shell); if (self) { - memcached_instance_free((org::libmemcached::Instance*)self->last_disconnected_server); + memcached_instance_free((memcached_instance_st*)self->last_disconnected_server); self->last_disconnected_server= NULL; } } @@ -432,10 +432,10 @@ void *memcached_set_user_data(memcached_st *shell, void *data) memcached_return_t memcached_push(memcached_st *destination, const memcached_st *source) { - return memcached_instance_push(destination, (org::libmemcached::Instance*)source->servers, source->number_of_hosts); + return memcached_instance_push(destination, (memcached_instance_st*)source->servers, source->number_of_hosts); } -org::libmemcached::Instance* memcached_instance_fetch(Memcached *ptr, uint32_t server_key) +memcached_instance_st* memcached_instance_fetch(Memcached *ptr, uint32_t server_key) { if (ptr == NULL) { @@ -445,7 +445,7 @@ org::libmemcached::Instance* memcached_instance_fetch(Memcached *ptr, uint32_t s return &ptr->servers[server_key]; } -memcached_server_instance_st memcached_server_instance_by_position(const memcached_st *shell, uint32_t server_key) +const memcached_instance_st * memcached_server_instance_by_position(const memcached_st *shell, uint32_t server_key) { const Memcached* memc= memcached2Memcached(shell); if (memc) @@ -456,7 +456,7 @@ memcached_server_instance_st memcached_server_instance_by_position(const memcach return NULL; } -org::libmemcached::Instance* memcached_instance_by_position(const memcached_st *shell, uint32_t server_key) +memcached_instance_st* memcached_instance_by_position(const memcached_st *shell, uint32_t server_key) { const Memcached* memc= memcached2Memcached(shell); if (memc) @@ -478,12 +478,12 @@ uint64_t memcached_query_id(const memcached_st *shell) return 0; } -org::libmemcached::Instance* memcached_instance_list(const memcached_st *shell) +memcached_instance_st* memcached_instance_list(const memcached_st *shell) { const Memcached* memc= memcached2Memcached(shell); if (memc) { - return (org::libmemcached::Instance*)memc->servers; + return (memcached_instance_st*)memc->servers; } return NULL; diff --git a/libmemcached/purge.cc b/libmemcached/purge.cc index b1390d9c..5f6d4bb7 100644 --- a/libmemcached/purge.cc +++ b/libmemcached/purge.cc @@ -79,7 +79,7 @@ private: int32_t& _origin; }; -bool memcached_purge(org::libmemcached::Instance* ptr) +bool memcached_purge(memcached_instance_st* ptr) { Memcached *root= (Memcached *)ptr->root; diff --git a/libmemcached/quit.cc b/libmemcached/quit.cc index 61930beb..7ece03b9 100644 --- a/libmemcached/quit.cc +++ b/libmemcached/quit.cc @@ -38,7 +38,7 @@ #include namespace { - memcached_return_t send_quit_message(org::libmemcached::Instance* instance) + memcached_return_t send_quit_message(memcached_instance_st* instance) { memcached_return_t rc; if (instance->root->flags.binary_protocol) @@ -70,7 +70,7 @@ namespace { return rc; } - void drain_instance(org::libmemcached::Instance* instance) + void drain_instance(memcached_instance_st* instance) { /* read until socket is closed, or there is an error * closing the socket before all data is read @@ -105,7 +105,7 @@ namespace { will force data to be completed. */ -void memcached_quit_server(org::libmemcached::Instance* instance, bool io_death) +void memcached_quit_server(memcached_instance_st* instance, bool io_death) { if (instance->valid()) { @@ -130,7 +130,7 @@ void send_quit(Memcached *memc) { for (uint32_t x= 0; x < memcached_server_count(memc); x++) { - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x); + memcached_instance_st* instance= memcached_instance_fetch(memc, x); memcached_quit_server(instance, false); } diff --git a/libmemcached/quit.hpp b/libmemcached/quit.hpp index 76737b95..a48a8a7e 100644 --- a/libmemcached/quit.hpp +++ b/libmemcached/quit.hpp @@ -36,6 +36,6 @@ #pragma once -void memcached_quit_server(org::libmemcached::Instance* ptr, bool io_death); +void memcached_quit_server(memcached_instance_st* ptr, bool io_death); void send_quit(memcached_st *ptr); diff --git a/libmemcached/response.cc b/libmemcached/response.cc index 7503c5a0..c01d5089 100644 --- a/libmemcached/response.cc +++ b/libmemcached/response.cc @@ -38,7 +38,7 @@ #include #include -static memcached_return_t textual_value_fetch(org::libmemcached::Instance* instance, +static memcached_return_t textual_value_fetch(memcached_instance_st* instance, char *buffer, memcached_result_st *result) { @@ -210,7 +210,7 @@ read_error: return MEMCACHED_PARTIAL_READ; } -static memcached_return_t textual_read_one_response(org::libmemcached::Instance* instance, +static memcached_return_t textual_read_one_response(memcached_instance_st* instance, char *buffer, const size_t buffer_length, memcached_result_st *result) { @@ -493,7 +493,7 @@ static memcached_return_t textual_read_one_response(org::libmemcached::Instance* buffer, total_read); } -static memcached_return_t binary_read_one_response(org::libmemcached::Instance* instance, +static memcached_return_t binary_read_one_response(memcached_instance_st* instance, char *buffer, const size_t buffer_length, memcached_result_st *result) { @@ -831,7 +831,7 @@ static memcached_return_t binary_read_one_response(org::libmemcached::Instance* return rc; } -static memcached_return_t _read_one_response(org::libmemcached::Instance* instance, +static memcached_return_t _read_one_response(memcached_instance_st* instance, char *buffer, const size_t buffer_length, memcached_result_st *result) { @@ -861,7 +861,7 @@ static memcached_return_t _read_one_response(org::libmemcached::Instance* instan return rc; } -memcached_return_t memcached_read_one_response(org::libmemcached::Instance* instance, +memcached_return_t memcached_read_one_response(memcached_instance_st* instance, memcached_result_st *result) { char buffer[SMALL_STRING_LEN]; @@ -875,7 +875,7 @@ memcached_return_t memcached_read_one_response(org::libmemcached::Instance* inst return _read_one_response(instance, buffer, sizeof(buffer), result); } -memcached_return_t memcached_response(org::libmemcached::Instance* instance, +memcached_return_t memcached_response(memcached_instance_st* instance, memcached_result_st *result) { char buffer[1024]; @@ -883,7 +883,7 @@ memcached_return_t memcached_response(org::libmemcached::Instance* instance, return memcached_response(instance, buffer, sizeof(buffer), result); } -memcached_return_t memcached_response(org::libmemcached::Instance* instance, +memcached_return_t memcached_response(memcached_instance_st* instance, char *buffer, size_t buffer_length, memcached_result_st *result) { diff --git a/libmemcached/response.h b/libmemcached/response.h index 6d6d5644..c066f3b3 100644 --- a/libmemcached/response.h +++ b/libmemcached/response.h @@ -38,12 +38,12 @@ #pragma once /* Read a single response from the server */ -memcached_return_t memcached_read_one_response(org::libmemcached::Instance* ptr, +memcached_return_t memcached_read_one_response(memcached_instance_st* ptr, memcached_result_st *result); -memcached_return_t memcached_response(org::libmemcached::Instance* ptr, +memcached_return_t memcached_response(memcached_instance_st* ptr, memcached_result_st *result); -memcached_return_t memcached_response(org::libmemcached::Instance* ptr, +memcached_return_t memcached_response(memcached_instance_st* ptr, char *buffer, size_t buffer_length, memcached_result_st *result); diff --git a/libmemcached/sasl.cc b/libmemcached/sasl.cc index 8e180d6f..ee225868 100644 --- a/libmemcached/sasl.cc +++ b/libmemcached/sasl.cc @@ -75,7 +75,7 @@ sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *shell) * @param raddr remote address (out) * @return true on success false otherwise (errno contains more info) */ -static memcached_return_t resolve_names(org::libmemcached::Instance& server, char *laddr, size_t laddr_length, char *raddr, size_t raddr_length) +static memcached_return_t resolve_names(memcached_instance_st& server, char *laddr, size_t laddr_length, char *raddr, size_t raddr_length) { char host[MEMCACHED_NI_MAXHOST]; char port[MEMCACHED_NI_MAXSERV]; @@ -133,7 +133,7 @@ static void sasl_startup_function(void) } // extern "C" -memcached_return_t memcached_sasl_authenticate_connection(org::libmemcached::Instance* server) +memcached_return_t memcached_sasl_authenticate_connection(memcached_instance_st* server) { if (LIBMEMCACHED_WITH_SASL_SUPPORT == 0) { diff --git a/libmemcached/sasl.hpp b/libmemcached/sasl.hpp index c990cfb8..bda6b227 100644 --- a/libmemcached/sasl.hpp +++ b/libmemcached/sasl.hpp @@ -39,4 +39,4 @@ memcached_return_t memcached_clone_sasl(memcached_st *clone, const memcached_st *source); -memcached_return_t memcached_sasl_authenticate_connection(org::libmemcached::Instance* server); +memcached_return_t memcached_sasl_authenticate_connection(memcached_instance_st* server); diff --git a/libmemcached/server.cc b/libmemcached/server.cc index ba40a6ee..b38120ad 100644 --- a/libmemcached/server.cc +++ b/libmemcached/server.cc @@ -191,7 +191,7 @@ uint32_t memcached_server_count(const memcached_st *self) return self->number_of_hosts; } -const char *memcached_server_name(const memcached_server_instance_st self) +const char *memcached_server_name(const memcached_instance_st * self) { WATCHPOINT_ASSERT(self); if (self) @@ -202,7 +202,7 @@ const char *memcached_server_name(const memcached_server_instance_st self) return NULL; } -in_port_t memcached_server_port(const memcached_server_instance_st self) +in_port_t memcached_server_port(const memcached_instance_st * self) { WATCHPOINT_ASSERT(self); if (self == NULL) @@ -213,7 +213,7 @@ in_port_t memcached_server_port(const memcached_server_instance_st self) return self->port(); } -uint32_t memcached_server_response_count(const memcached_server_instance_st self) +uint32_t memcached_server_response_count(const memcached_instance_st * self) { WATCHPOINT_ASSERT(self); if (self == NULL) @@ -224,7 +224,7 @@ uint32_t memcached_server_response_count(const memcached_server_instance_st self return self->cursor_active_; } -const char *memcached_server_type(const memcached_server_instance_st ptr) +const char *memcached_server_type(const memcached_instance_st * ptr) { if (ptr) { @@ -244,7 +244,7 @@ const char *memcached_server_type(const memcached_server_instance_st ptr) return "UNKNOWN"; } -uint8_t memcached_server_major_version(const memcached_server_instance_st instance) +uint8_t memcached_server_major_version(const memcached_instance_st * instance) { if (instance) { @@ -254,7 +254,7 @@ uint8_t memcached_server_major_version(const memcached_server_instance_st instan return UINT8_MAX; } -uint8_t memcached_server_minor_version(const memcached_server_instance_st instance) +uint8_t memcached_server_minor_version(const memcached_instance_st * instance) { if (instance) { @@ -264,7 +264,7 @@ uint8_t memcached_server_minor_version(const memcached_server_instance_st instan return UINT8_MAX; } -uint8_t memcached_server_micro_version(const memcached_server_instance_st instance) +uint8_t memcached_server_micro_version(const memcached_instance_st * instance) { if (instance) { diff --git a/libmemcached/server.hpp b/libmemcached/server.hpp index 8cbdc151..0c6ac798 100644 --- a/libmemcached/server.hpp +++ b/libmemcached/server.hpp @@ -68,11 +68,11 @@ static inline bool memcached_is_valid_filename(const memcached_string_t& arg) return arg.c_str != NULL and arg.size > 0 and arg.size < MEMCACHED_NI_MAXHOST; } -void memcached_instance_free(org::libmemcached::Instance *); +void memcached_instance_free(memcached_instance_st *); -void set_last_disconnected_host(org::libmemcached::Instance* self); +void set_last_disconnected_host(memcached_instance_st* self); -static inline void memcached_mark_server_for_timeout(org::libmemcached::Instance* server) +static inline void memcached_mark_server_for_timeout(memcached_instance_st* server) { if (server->state != MEMCACHED_SERVER_STATE_IN_TIMEOUT) { diff --git a/libmemcached/server_instance.h b/libmemcached/server_instance.h index 3b69b77b..187f2744 100644 --- a/libmemcached/server_instance.h +++ b/libmemcached/server_instance.h @@ -38,8 +38,7 @@ #pragma once #ifdef __cplusplus -namespace org { namespace libmemcached { struct Instance; } } -typedef struct org::libmemcached::Instance* memcached_server_write_instance_st; +typedef struct memcached_instance_st* memcached_server_write_instance_st; #else typedef void* memcached_server_write_instance_st; #endif diff --git a/libmemcached/server_list.cc b/libmemcached/server_list.cc index b42a9095..b5d5b72e 100644 --- a/libmemcached/server_list.cc +++ b/libmemcached/server_list.cc @@ -127,7 +127,7 @@ uint32_t memcached_instance_list_count(const memcached_st* self) : self->number_of_hosts; } -void memcached_instance_set(memcached_st* memc, org::libmemcached::Instance* list, const uint32_t host_list_size) +void memcached_instance_set(memcached_st* memc, memcached_instance_st* list, const uint32_t host_list_size) { assert(memc); memc->servers= list; @@ -148,7 +148,7 @@ void memcached_server_list_free(memcached_server_list_st self) } } -void memcached_instance_list_free(org::libmemcached::Instance* self, uint32_t instance_count) +void memcached_instance_list_free(memcached_instance_st* self, uint32_t instance_count) { if (self) { diff --git a/libmemcached/server_list.hpp b/libmemcached/server_list.hpp index ffbb6a36..0280332c 100644 --- a/libmemcached/server_list.hpp +++ b/libmemcached/server_list.hpp @@ -36,12 +36,12 @@ #pragma once -org::libmemcached::Instance* memcached_instance_list(const memcached_st *); +memcached_instance_st* memcached_instance_list(const memcached_st *); uint32_t memcached_instance_list_count(const memcached_st*); uint32_t memcached_servers_set_count(memcached_server_list_st servers, uint32_t count); -void memcached_instance_list_free(org::libmemcached::Instance* self, uint32_t count); +void memcached_instance_list_free(memcached_instance_st* self, uint32_t count); -void memcached_instance_set(memcached_st*, org::libmemcached::Instance*, const uint32_t host_list_size); +void memcached_instance_set(memcached_st*, memcached_instance_st*, const uint32_t host_list_size); diff --git a/libmemcached/stats.cc b/libmemcached/stats.cc index 01a8baf6..d70972ef 100644 --- a/libmemcached/stats.cc +++ b/libmemcached/stats.cc @@ -477,7 +477,7 @@ char *memcached_stat_get_value(const memcached_st *, memcached_stat_st *memc_sta static memcached_return_t binary_stats_fetch(memcached_stat_st *memc_stat, const char *args, const size_t args_length, - org::libmemcached::Instance* instance, + memcached_instance_st* instance, struct local_context *check) { char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE]; @@ -567,7 +567,7 @@ static memcached_return_t binary_stats_fetch(memcached_stat_st *memc_stat, static memcached_return_t ascii_stats_fetch(memcached_stat_st *memc_stat, const char *args, const size_t args_length, - org::libmemcached::Instance* instance, + memcached_instance_st* instance, struct local_context *check) { libmemcached_io_vector_st vector[]= @@ -684,7 +684,7 @@ memcached_stat_st *memcached_stat(memcached_st *shell, char *args, memcached_ret stat_instance->pid= -1; stat_instance->root= self; - org::libmemcached::Instance* instance= memcached_instance_fetch(self, x); + memcached_instance_st* instance= memcached_instance_fetch(self, x); memcached_return_t temp_return; if (memcached_is_binary(self)) @@ -751,7 +751,7 @@ memcached_return_t memcached_stat_servername(memcached_stat_st *memc_stat, char if (memcached_success(rc)) { - org::libmemcached::Instance* instance= memcached_instance_fetch(memc_ptr, 0); + memcached_instance_st* instance= memcached_instance_fetch(memc_ptr, 0); if (memc.flags.binary_protocol) { rc= binary_stats_fetch(memc_stat, args, args_length, instance, NULL); @@ -813,7 +813,7 @@ void memcached_stat_free(const memcached_st *, memcached_stat_st *memc_stat) } static memcached_return_t call_stat_fn(memcached_st *memc, - org::libmemcached::Instance* instance, + memcached_instance_st* instance, void *context) { if (memc) diff --git a/libmemcached/storage.cc b/libmemcached/storage.cc index 558d2ed5..80b5a7f1 100644 --- a/libmemcached/storage.cc +++ b/libmemcached/storage.cc @@ -139,7 +139,7 @@ static inline uint8_t get_com_code(const memcached_storage_action_t verb, const } static memcached_return_t memcached_send_binary(Memcached *ptr, - org::libmemcached::Instance* server, + memcached_instance_st* server, uint32_t server_key, const char *key, const size_t key_length, @@ -218,7 +218,7 @@ static memcached_return_t memcached_send_binary(Memcached *ptr, server_key= 0; } - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, server_key); + memcached_instance_st* instance= memcached_instance_fetch(ptr, server_key); if (memcached_vdo(instance, vector, 5, false) != MEMCACHED_SUCCESS) { @@ -246,7 +246,7 @@ static memcached_return_t memcached_send_binary(Memcached *ptr, } static memcached_return_t memcached_send_ascii(Memcached *ptr, - org::libmemcached::Instance* instance, + memcached_instance_st* instance, const char *key, const size_t key_length, const char *value, @@ -373,7 +373,7 @@ static inline memcached_return_t memcached_send(memcached_st *shell, } uint32_t server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length); - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, server_key); + memcached_instance_st* instance= memcached_instance_fetch(ptr, server_key); WATCHPOINT_SET(instance->io_wait_count.read= 0); WATCHPOINT_SET(instance->io_wait_count.write= 0); diff --git a/libmemcached/touch.cc b/libmemcached/touch.cc index 0c24aed1..1f793c55 100644 --- a/libmemcached/touch.cc +++ b/libmemcached/touch.cc @@ -38,7 +38,7 @@ #include #include -static memcached_return_t ascii_touch(org::libmemcached::Instance* instance, +static memcached_return_t ascii_touch(memcached_instance_st* instance, const char *key, size_t key_length, time_t expiration) { @@ -70,7 +70,7 @@ static memcached_return_t ascii_touch(org::libmemcached::Instance* instance, return rc; } -static memcached_return_t binary_touch(org::libmemcached::Instance* instance, +static memcached_return_t binary_touch(memcached_instance_st* instance, const char *key, size_t key_length, time_t expiration) { @@ -130,7 +130,7 @@ memcached_return_t memcached_touch_by_key(memcached_st *shell, } uint32_t server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length); - org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, server_key); + memcached_instance_st* instance= memcached_instance_fetch(ptr, server_key); if (ptr->flags.binary_protocol) { diff --git a/libmemcached/udp.cc b/libmemcached/udp.cc index 923e2734..5d21f9ff 100644 --- a/libmemcached/udp.cc +++ b/libmemcached/udp.cc @@ -48,7 +48,7 @@ * extracts the message number from message_id, increments it and then * writes the new value back into the header */ -void increment_udp_message_id(org::libmemcached::Instance* ptr) +void increment_udp_message_id(memcached_instance_st* ptr) { struct udp_datagram_header_st *header= (struct udp_datagram_header_st *)ptr->write_buffer; uint16_t cur_req= get_udp_datagram_request_id(header); @@ -61,7 +61,7 @@ void increment_udp_message_id(org::libmemcached::Instance* ptr) header->request_id= htons((uint16_t) (thread_id | msg_num)); } -bool memcached_io_init_udp_header(org::libmemcached::Instance* ptr, const uint16_t thread_id) +bool memcached_io_init_udp_header(memcached_instance_st* ptr, const uint16_t thread_id) { if (thread_id > UDP_REQUEST_ID_MAX_THREAD_ID) { diff --git a/libmemcached/udp.hpp b/libmemcached/udp.hpp index b2d2e9e9..7442c597 100644 --- a/libmemcached/udp.hpp +++ b/libmemcached/udp.hpp @@ -55,5 +55,5 @@ struct udp_datagram_header_st uint16_t reserved; }; -bool memcached_io_init_udp_header(org::libmemcached::Instance*, const uint16_t thread_id); -void increment_udp_message_id(org::libmemcached::Instance*); +bool memcached_io_init_udp_header(memcached_instance_st*, const uint16_t thread_id); +void increment_udp_message_id(memcached_instance_st*); diff --git a/libmemcached/verbosity.cc b/libmemcached/verbosity.cc index 7f3a16e4..ed0e2440 100644 --- a/libmemcached/verbosity.cc +++ b/libmemcached/verbosity.cc @@ -44,7 +44,7 @@ struct context_st }; static memcached_return_t _set_verbosity(const Memcached *, - const memcached_server_instance_st server, + const memcached_instance_st * server, void *context) { libmemcached_io_vector_st *vector= (libmemcached_io_vector_st *)context; @@ -56,7 +56,7 @@ static memcached_return_t _set_verbosity(const Memcached *, if (rc == MEMCACHED_SUCCESS) { - org::libmemcached::Instance* instance= memcached_instance_fetch(memc_ptr, 0); + memcached_instance_st* instance= memcached_instance_fetch(memc_ptr, 0); rc= memcached_vdo(instance, vector, 4, true); diff --git a/libmemcached/version.cc b/libmemcached/version.cc index bbe46cc5..5f074912 100644 --- a/libmemcached/version.cc +++ b/libmemcached/version.cc @@ -52,7 +52,7 @@ static inline memcached_return_t memcached_version_textual(Memcached *memc) bool errors_happened= false; for (uint32_t x= 0; x < memcached_server_count(memc); x++) { - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x); + memcached_instance_st* instance= memcached_instance_fetch(memc, x); // Optimization, we only fetch version once. if (instance->major_version != UINT8_MAX) @@ -73,7 +73,7 @@ static inline memcached_return_t memcached_version_textual(Memcached *memc) if (success) { // Collect the returned items - org::libmemcached::Instance* instance; + memcached_instance_st* instance; memcached_return_t readable_error; while ((instance= memcached_io_get_readable_server(memc, readable_error))) { @@ -105,7 +105,7 @@ static inline memcached_return_t memcached_version_binary(Memcached *memc) bool errors_happened= false; for (uint32_t x= 0; x < memcached_server_count(memc); x++) { - org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x); + memcached_instance_st* instance= memcached_instance_fetch(memc, x); initialize_binary_request(instance, request.message.header); @@ -128,7 +128,7 @@ static inline memcached_return_t memcached_version_binary(Memcached *memc) if (success) { // Collect the returned items - org::libmemcached::Instance* instance; + memcached_instance_st* instance; memcached_return_t readable_error; while ((instance= memcached_io_get_readable_server(memc, readable_error))) { @@ -145,7 +145,7 @@ static inline memcached_return_t memcached_version_binary(Memcached *memc) return errors_happened ? MEMCACHED_SOME_ERRORS : MEMCACHED_SUCCESS; } -static inline void version_ascii_instance(org::libmemcached::Instance* instance) +static inline void version_ascii_instance(memcached_instance_st* instance) { if (instance->major_version != UINT8_MAX) { @@ -158,7 +158,7 @@ static inline void version_ascii_instance(org::libmemcached::Instance* instance) } } -static inline void version_binary_instance(org::libmemcached::Instance* instance) +static inline void version_binary_instance(memcached_instance_st* instance) { if (instance->major_version != UINT8_MAX) { @@ -178,7 +178,7 @@ static inline void version_binary_instance(org::libmemcached::Instance* instance } } -void memcached_version_instance(org::libmemcached::Instance* instance) +void memcached_version_instance(memcached_instance_st* instance) { if (instance) { diff --git a/libmemcached/version.hpp b/libmemcached/version.hpp index b4a8234b..f420a262 100644 --- a/libmemcached/version.hpp +++ b/libmemcached/version.hpp @@ -41,4 +41,4 @@ #pragma once -void memcached_version_instance(org::libmemcached::Instance*); +void memcached_version_instance(memcached_instance_st*); diff --git a/libmemcachedutil/pid.cc b/libmemcachedutil/pid.cc index 51948383..34656118 100644 --- a/libmemcachedutil/pid.cc +++ b/libmemcachedutil/pid.cc @@ -74,7 +74,7 @@ pid_t libmemcached_util_getpid(const char *hostname, in_port_t port, memcached_r } else if (rc == MEMCACHED_SOME_ERRORS) // Generic answer, we will now find the specific reason (if one exists) { - memcached_server_instance_st instance= memcached_server_instance_by_position(memc_ptr, 0); + const memcached_instance_st * instance= memcached_server_instance_by_position(memc_ptr, 0); assert_msg(instance and memcached_server_error(instance), " "); if (instance and memcached_server_error(instance)) @@ -139,7 +139,7 @@ pid_t libmemcached_util_getpid2(const char *hostname, in_port_t port, const char } else if (rc == MEMCACHED_SOME_ERRORS) // Generic answer, we will now find the specific reason (if one exists) { - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc_ptr, 0); #if 0 diff --git a/libmemcachedutil/ping.cc b/libmemcachedutil/ping.cc index e2831beb..a867c56b 100644 --- a/libmemcachedutil/ping.cc +++ b/libmemcachedutil/ping.cc @@ -64,7 +64,7 @@ bool libmemcached_util_ping(const char *hostname, in_port_t port, memcached_retu if (memcached_failed(rc) and rc == MEMCACHED_SOME_ERRORS) { - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc_ptr, 0); assert_msg(instance and memcached_server_error(instance), " "); @@ -119,7 +119,7 @@ bool libmemcached_util_ping2(const char *hostname, in_port_t port, const char *u if (memcached_failed(rc) and rc == MEMCACHED_SOME_ERRORS) { - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc_ptr, 0); assert_msg(instance and memcached_server_error(instance), " "); diff --git a/libmemcachedutil/version.cc b/libmemcachedutil/version.cc index 9674c059..0fcfb5c5 100644 --- a/libmemcachedutil/version.cc +++ b/libmemcachedutil/version.cc @@ -49,7 +49,7 @@ struct local_context }; static memcached_return_t check_server_version(const memcached_st *, - memcached_server_instance_st instance, + const memcached_instance_st * instance, void *context) { /* Do Nothing */ diff --git a/tests/libmemcached-1.0/debug.cc b/tests/libmemcached-1.0/debug.cc index f7d4b34c..83241f43 100644 --- a/tests/libmemcached-1.0/debug.cc +++ b/tests/libmemcached-1.0/debug.cc @@ -62,7 +62,7 @@ static memcached_return_t print_keys_callback(const memcached_st *, } static memcached_return_t server_wrapper_for_dump_callback(const memcached_st *, - memcached_server_instance_st server, + const memcached_instance_st * server, void *) { memcached_st *memc= memcached_create(NULL); diff --git a/tests/libmemcached-1.0/dump.cc b/tests/libmemcached-1.0/dump.cc index 107828d4..03704cf6 100644 --- a/tests/libmemcached-1.0/dump.cc +++ b/tests/libmemcached-1.0/dump.cc @@ -65,7 +65,7 @@ static memcached_return_t callback_dump_counter(const memcached_st *, return MEMCACHED_SUCCESS; } -static memcached_return_t item_counter(memcached_server_instance_st , +static memcached_return_t item_counter(const memcached_instance_st * , const char *key, size_t key_length, const char *value, size_t, // value_length, void *context) diff --git a/tests/libmemcached-1.0/generate.cc b/tests/libmemcached-1.0/generate.cc index f14d2bf7..ada9d2c2 100644 --- a/tests/libmemcached-1.0/generate.cc +++ b/tests/libmemcached-1.0/generate.cc @@ -131,7 +131,7 @@ test_return_t generate_data_with_stats(memcached_st *memc) /* This test was changes so that "make test" would work properlly */ if (DEBUG) { - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, host_index); printf("\nserver %u|%s|%u bytes: %llu\n", diff --git a/tests/libmemcached-1.0/ketama.cc b/tests/libmemcached-1.0/ketama.cc index 44fefc7e..4dfaf2bf 100644 --- a/tests/libmemcached-1.0/ketama.cc +++ b/tests/libmemcached-1.0/ketama.cc @@ -83,7 +83,7 @@ test_return_t ketama_compatibility_libmemcached(memcached_st *) for (uint32_t x= 0; x < 99; x++) { uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key)); - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, server_idx); const char *hostname = memcached_server_name(instance); @@ -145,7 +145,7 @@ test_return_t user_supplied_bug18(memcached_st *trash) { uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key)); - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, server_idx); const char *hostname = memcached_server_name(instance); @@ -201,7 +201,7 @@ test_return_t auto_eject_hosts(memcached_st *trash) test_true(server_pool[7].port == 11211); test_true(server_pool[7].weight == 100); - memcached_server_instance_st instance= memcached_server_instance_by_position(memc, 2); + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 2); memcached_instance_next_retry(instance, time(NULL) +15); memc->ketama.next_distribution_rebuild= time(NULL) - 1; @@ -276,7 +276,7 @@ test_return_t ketama_compatibility_spymemcached(memcached_st *) { uint32_t server_idx= memcached_generate_hash(memc, ketama_test_cases_spy[x].key, strlen(ketama_test_cases_spy[x].key)); - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, server_idx); const char *hostname= memcached_server_name(instance); diff --git a/tests/libmemcached-1.0/mem_functions.cc b/tests/libmemcached-1.0/mem_functions.cc index f26f7c4c..eb74f00e 100644 --- a/tests/libmemcached-1.0/mem_functions.cc +++ b/tests/libmemcached-1.0/mem_functions.cc @@ -112,7 +112,7 @@ static memcached_st * create_single_instance_memcached(const memcached_st *origi * I only want to hit _one_ server so I know the number of requests I'm * sending in the pipeline. */ - memcached_server_instance_st instance= memcached_server_instance_by_position(original_memc, 0); + const memcached_instance_st * instance= memcached_server_instance_by_position(original_memc, 0); char server_string[1024]; int server_string_length; @@ -175,7 +175,7 @@ test_return_t init_test(memcached_st *not_used) in_port_t test_ports[TEST_PORT_COUNT]; static memcached_return_t server_display_function(const memcached_st *ptr, - memcached_server_instance_st server, + const memcached_instance_st * server, void *context) { /* Do Nothing */ @@ -188,7 +188,7 @@ static memcached_return_t server_display_function(const memcached_st *ptr, } static memcached_return_t dump_server_information(const memcached_st *ptr, - memcached_server_instance_st instance, + const memcached_instance_st * instance, void *context) { /* Do Nothing */ @@ -243,7 +243,7 @@ test_return_t server_sort2_test(memcached_st *ptr) size_t bigger= 0; /* Prime the value for the test_true in server_display_function */ memcached_server_fn callbacks[1]; memcached_st *local_memc; - memcached_server_instance_st instance; + const memcached_instance_st * instance; (void)ptr; local_memc= memcached_create(NULL); @@ -294,7 +294,7 @@ test_return_t memcached_server_remove_test(memcached_st*) } static memcached_return_t server_display_unsort_function(const memcached_st*, - memcached_server_instance_st server, + const memcached_instance_st * server, void *context) { /* Do Nothing */ @@ -955,7 +955,7 @@ test_return_t flush_test(memcached_st *memc) } static memcached_return_t server_function(const memcached_st *, - memcached_server_instance_st, + const memcached_instance_st *, void *) { /* Do Nothing */ @@ -1258,7 +1258,7 @@ test_return_t mget_end(memcached_st *memc) test_return_t stats_servername_test(memcached_st *memc) { memcached_stat_st memc_stat; - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0); if (LIBMEMCACHED_WITH_SASL_SUPPORT and memcached_get_sasl_callbacks(memc)) @@ -1941,7 +1941,7 @@ test_return_t regression_1048945_TEST(memcached_st*) memcached_server_list_free(list); test_compare(status, MEMCACHED_SUCCESS); - memcached_server_instance_st server= memcached_server_by_key(memc, test_literal_param(__func__), &status); + const memcached_instance_st * server= memcached_server_by_key(memc, test_literal_param(__func__), &status); test_true(server); test_compare(status, MEMCACHED_SUCCESS); @@ -2690,7 +2690,7 @@ test_return_t user_supplied_bug19(memcached_st *) memcached_st *memc= memcached(test_literal_param("--server=localhost:11311/?100 --server=localhost:11312/?100")); - memcached_server_instance_st server= memcached_server_by_key(memc, "a", 1, &res); + const memcached_instance_st * server= memcached_server_by_key(memc, "a", 1, &res); test_true(server); memcached_free(memc); @@ -2891,7 +2891,7 @@ test_return_t output_ketama_weighted_keys(memcached_st *) char *hostname = memc->hosts[server_idx].hostname; in_port_t port = memc->hosts[server_idx].port; fprintf(fp, "key %s is on host /%s:%u\n", key, hostname, port); - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, host_index); } fclose(fp); @@ -3264,7 +3264,7 @@ test_return_t check_for_1_2_3(memcached_st *memc) { memcached_version(memc); - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0); if ((instance->major_version >= 1 && (instance->minor_version == 2 && instance->micro_version >= 4)) @@ -3344,7 +3344,7 @@ test_return_t noreply_test(memcached_st *memc) int no_msg=0; for (uint32_t x= 0; x < memcached_server_count(memc); ++x) { - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, x); no_msg+=(int)(instance->cursor_active); } @@ -3473,7 +3473,7 @@ test_return_t util_version_test(memcached_st *memc) } test_true(if_successful == false); - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0); memcached_version(memc); @@ -3519,7 +3519,7 @@ test_return_t getpid_connection_failure_test(memcached_st *memc) { test_skip(memc->servers[0].type, MEMCACHED_CONNECTION_TCP); memcached_return_t rc; - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0); // Test both the version that returns a code, and the one that does not. @@ -3537,7 +3537,7 @@ test_return_t getpid_connection_failure_test(memcached_st *memc) test_return_t getpid_test(memcached_st *memc) { memcached_return_t rc; - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0); // Test both the version that returns a code, and the one that does not. @@ -3552,7 +3552,7 @@ test_return_t getpid_test(memcached_st *memc) } static memcached_return_t ping_each_server(const memcached_st*, - memcached_server_instance_st instance, + const memcached_instance_st * instance, void*) { // Test both the version that returns a code, and the one that does not. @@ -4206,8 +4206,8 @@ test_return_t regression_bug_447342(memcached_st *memc) * This is to verify correct behavior in the library. Fake that two servers * are dead.. */ - memcached_server_instance_st instance_one= memcached_server_instance_by_position(memc, 0); - memcached_server_instance_st instance_two= memcached_server_instance_by_position(memc, 2); + const memcached_instance_st * instance_one= memcached_server_instance_by_position(memc, 0); + const memcached_instance_st * instance_two= memcached_server_instance_by_position(memc, 2); in_port_t port0= instance_one->port(); in_port_t port2= instance_two->port(); @@ -4270,7 +4270,7 @@ test_return_t regression_bug_463297(memcached_st *memc) test_true(memc_clone); test_true(memcached_version(memc_clone) == MEMCACHED_SUCCESS); - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc_clone, 0); if (instance->major_version > 1 || @@ -4334,7 +4334,7 @@ test_return_t regression_bug_463297(memcached_st *memc) test_return_t test_get_last_disconnect(memcached_st *memc) { memcached_return_t rc; - memcached_server_instance_st disconnected_server; + const memcached_instance_st * disconnected_server; /* With the working set of server */ const char *key= "marmotte"; @@ -4401,7 +4401,7 @@ test_return_t test_multiple_get_last_disconnect(memcached_st *) memcached_return_t ret= memcached_set(memc, msg, strlen(msg), NULL, 0, (time_t)0, (uint32_t)0); test_true_got((ret == MEMCACHED_CONNECTION_FAILURE or ret == MEMCACHED_SERVER_TEMPORARILY_DISABLED), memcached_last_error_message(memc)); - memcached_server_instance_st disconnected_server= memcached_server_get_last_disconnect(memc); + const memcached_instance_st * disconnected_server= memcached_server_get_last_disconnect(memc); test_true(disconnected_server); test_strcmp("localhost", memcached_server_name(disconnected_server)); test_true(memcached_server_port(disconnected_server) >= 8888 and memcached_server_port(disconnected_server) <= 8892); @@ -4426,7 +4426,7 @@ test_return_t test_verbosity(memcached_st *memc) } -static memcached_return_t stat_printer(memcached_server_instance_st server, +static memcached_return_t stat_printer(const memcached_instance_st * server, const char *key, size_t key_length, const char *value, size_t value_length, void *context) @@ -4474,7 +4474,7 @@ test_return_t wrong_failure_counter_test(memcached_st *original_memc) test_true(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED); - memcached_server_instance_st instance= memcached_server_instance_by_position(memc, 0); + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0); /* The test is to see that the memcached_quit doesn't increase the * the server failure conter, so let's ensure that it is zero @@ -4997,7 +4997,7 @@ test_return_t kill_HUP_TEST(memcached_st *original_memc) memcached_st *memc= create_single_instance_memcached(original_memc, 0); test_true(memc); - memcached_server_instance_st instance= memcached_server_instance_by_position(memc, 0); + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0); pid_t pid; test_true((pid= libmemcached_util_getpid(memcached_server_name(instance), diff --git a/tests/libmemcached-1.0/parser.cc b/tests/libmemcached-1.0/parser.cc index 2e8e5cd6..7e48760e 100644 --- a/tests/libmemcached-1.0/parser.cc +++ b/tests/libmemcached-1.0/parser.cc @@ -85,7 +85,7 @@ struct scanner_variable_t { // Check and make sure the first host is what we expect it to be static test_return_t __check_host(memcached_st *memc, const scanner_string_st &hostname) { - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0); test_true(instance); @@ -617,7 +617,7 @@ test_return_t random_statement_build_test(memcached_st*) } static memcached_return_t dump_server_information(const memcached_st *, - memcached_server_instance_st instance, + const memcached_instance_st * instance, void *) { if (strcmp(memcached_server_name(instance), "localhost")) @@ -667,7 +667,7 @@ struct socket_weight_t { }; static memcached_return_t dump_socket_information(const memcached_st *, - memcached_server_instance_st instance, + const memcached_instance_st * instance, void *context) { socket_weight_t *check= (socket_weight_t *)context; diff --git a/tests/libmemcached-1.0/plus.cpp b/tests/libmemcached-1.0/plus.cpp index 34fe7f28..145f9797 100644 --- a/tests/libmemcached-1.0/plus.cpp +++ b/tests/libmemcached-1.0/plus.cpp @@ -218,7 +218,7 @@ static test_return_t lp_1010899_with_args_TEST(memcached_st *original) { // Check to see everything is setup internally even when a host is specified // on creation. - memcached_server_instance_st instance= memcached_server_instance_by_position(original, 0); + const memcached_instance_st* instance= memcached_server_instance_by_position(original, 0); Memcache memc(memcached_server_name(instance), memcached_server_port(instance)); test_false(memc.increment(__func__, 0, NULL)); diff --git a/tests/libmemcached-1.0/pool.cc b/tests/libmemcached-1.0/pool.cc index ed290ab9..a09faa69 100644 --- a/tests/libmemcached-1.0/pool.cc +++ b/tests/libmemcached-1.0/pool.cc @@ -340,7 +340,7 @@ static memcached_st * create_single_instance_memcached(const memcached_st *origi * I only want to hit _one_ server so I know the number of requests I'm * sending in the pipeline. */ - memcached_server_instance_st instance= memcached_server_instance_by_position(original_memc, 0); + const memcached_instance_st * instance= memcached_server_instance_by_position(original_memc, 0); char server_string[1024]; int server_string_length; diff --git a/tests/libmemcached-1.0/print.cc b/tests/libmemcached-1.0/print.cc index 161223de..00222de3 100644 --- a/tests/libmemcached-1.0/print.cc +++ b/tests/libmemcached-1.0/print.cc @@ -48,7 +48,7 @@ using namespace libtest; #include "tests/print.h" memcached_return_t server_print_callback(const memcached_st*, - memcached_server_instance_st server, + const memcached_instance_st * server, void *context) { if (context) @@ -59,18 +59,8 @@ memcached_return_t server_print_callback(const memcached_st*, return MEMCACHED_SUCCESS; } -const char * print_version(memcached_st *memc) -{ - memcached_server_fn callbacks[1]; - callbacks[0]= server_print_version_callback; - memcached_server_cursor(memc, callbacks, NULL, 1); - - return "print_version()"; -} - - memcached_return_t server_print_version_callback(const memcached_st *, - memcached_server_instance_st server, + const memcached_instance_st * server, void *) { std::cerr << "Server: " << memcached_server_name(server) << ":" << memcached_server_port(server) << " " @@ -81,3 +71,12 @@ memcached_return_t server_print_version_callback(const memcached_st *, return MEMCACHED_SUCCESS; } + +const char * print_version(memcached_st *memc) +{ + memcached_server_fn callbacks[1]; + callbacks[0]= server_print_version_callback; + memcached_server_cursor(memc, callbacks, NULL, 1); + + return "print_version()"; +} diff --git a/tests/libmemcached-1.0/replication.cc b/tests/libmemcached-1.0/replication.cc index 1a22a220..937041f2 100644 --- a/tests/libmemcached-1.0/replication.cc +++ b/tests/libmemcached-1.0/replication.cc @@ -126,7 +126,7 @@ test_return_t replication_get_test(memcached_st *memc) for (uint32_t host= 0; host < memcached_server_count(memc); ++host) { memcached_st *memc_clone= memcached_clone(NULL, memc); - org::libmemcached::Instance* instance= (org::libmemcached::Instance*)memcached_server_instance_by_position(memc_clone, host); + memcached_instance_st* instance= (memcached_instance_st*)memcached_server_instance_by_position(memc_clone, host); instance->port(0); @@ -188,7 +188,7 @@ test_return_t replication_mget_test(memcached_st *memc) for (uint32_t host= 0; host < memcached_server_count(memc_clone); host++) { memcached_st *new_clone= memcached_clone(NULL, memc); - memcached_server_instance_st instance= memcached_server_instance_by_position(new_clone, host); + const memcached_instance_st * instance= memcached_server_instance_by_position(new_clone, host); ((memcached_server_write_instance_st)instance)->port(0); for (int x= 'a'; x <= 'z'; ++x) diff --git a/tests/libmemcached-1.0/stat.cc b/tests/libmemcached-1.0/stat.cc index f92c88e5..fe92230e 100644 --- a/tests/libmemcached-1.0/stat.cc +++ b/tests/libmemcached-1.0/stat.cc @@ -48,7 +48,7 @@ using namespace libtest; #include "tests/libmemcached-1.0/stat.h" -static memcached_return_t item_counter(memcached_server_instance_st , +static memcached_return_t item_counter(const memcached_instance_st * , const char *key, size_t key_length, const char *value, size_t, // value_length, void *context) diff --git a/tests/mem_udp.cc b/tests/mem_udp.cc index 732773d7..2267fac0 100644 --- a/tests/mem_udp.cc +++ b/tests/mem_udp.cc @@ -106,9 +106,9 @@ static void get_udp_request_ids(memcached_st *memc, Expected &ids) { for (uint32_t x= 0; x < memcached_server_count(memc); x++) { - memcached_server_instance_st instance= memcached_server_instance_by_position(memc, x); + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, x); - ids.push_back(get_udp_datagram_request_id((struct udp_datagram_header_st *) ((memcached_server_instance_st )instance)->write_buffer)); + ids.push_back(get_udp_datagram_request_id((struct udp_datagram_header_st *) ((const memcached_instance_st * )instance)->write_buffer)); } } @@ -173,7 +173,7 @@ static test_return_t add_tcp_server_udp_client_test(memcached_st *memc) (void)memc; #if 0 memcached_server_st server; - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0); memcached_server_clone(&server, &memc->hosts[0]); test_true(memcached_server_remove(&(memc->hosts[0])) == MEMCACHED_SUCCESS); @@ -188,7 +188,7 @@ static test_return_t add_udp_server_tcp_client_test(memcached_st *memc) (void)memc; #if 0 memcached_server_st server; - memcached_server_instance_st instance= + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0); memcached_server_clone(&server, &memc->hosts[0]); test_true(memcached_server_remove(&(memc->hosts[0])) == MEMCACHED_SUCCESS); @@ -284,7 +284,7 @@ static test_return_t udp_set_test(memcached_st *memc) get_udp_request_ids(memc, expected_ids); unsigned int server_key= memcached_generate_hash(memc, test_literal_param("foo")); test_true(server_key < memcached_server_count(memc)); - memcached_server_instance_st instance= memcached_server_instance_by_position(memc, server_key); + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, server_key); size_t init_offset= instance->write_buffer_offset; test_compare_hint(MEMCACHED_SUCCESS, @@ -349,7 +349,7 @@ static test_return_t udp_delete_test(memcached_st *memc) get_udp_request_ids(memc, expected_ids); unsigned int server_key= memcached_generate_hash(memc, test_literal_param("foo")); - memcached_server_instance_st instance= memcached_server_instance_by_position(memc, server_key); + const memcached_instance_st * instance= memcached_server_instance_by_position(memc, server_key); size_t init_offset= instance->write_buffer_offset; test_compare(MEMCACHED_SUCCESS, diff --git a/tests/print.h b/tests/print.h index 7460dc3b..f5fcf899 100644 --- a/tests/print.h +++ b/tests/print.h @@ -38,11 +38,11 @@ #pragma once memcached_return_t server_print_callback(const memcached_st *ptr, - memcached_server_instance_st server, + const memcached_instance_st *server, void *context); memcached_return_t server_print_version_callback(const memcached_st *ptr, - memcached_server_instance_st server, + const memcached_server_st *server, void *context); const char * print_version(memcached_st *memc);