From: Brian Aker Date: Sun, 3 Jan 2010 01:24:11 +0000 (-0800) Subject: Simple dead code removal and fix for analysis structure always being free() X-Git-Tag: 0.37~34 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=b62ff7f097d83abef0bf0d40d85e6c8734a8db94;p=m6w6%2Flibmemcached Simple dead code removal and fix for analysis structure always being free() --- diff --git a/libmemcached/analyze.c b/libmemcached/analyze.c index de628a72..d5d09751 100644 --- a/libmemcached/analyze.c +++ b/libmemcached/analyze.c @@ -67,7 +67,7 @@ memcached_analysis_st *memcached_analyze(memcached_st *memc, uint64_t total_get_cmds= 0, total_get_hits= 0; uint32_t server_count, x; memcached_analysis_st *result; - + *error= MEMCACHED_SUCCESS; server_count= memcached_server_count(memc); result= (memcached_analysis_st*)calloc(memc->number_of_hosts, @@ -79,7 +79,6 @@ memcached_analysis_st *memcached_analyze(memcached_st *memc, return NULL; } - result->options.allocated= true; result->root= memc; for (x= 0; x < server_count; x++) @@ -104,6 +103,5 @@ memcached_analysis_st *memcached_analyze(memcached_st *memc, void memcached_analyze_free(memcached_analysis_st *ptr) { - if (ptr->options.allocated) - free(ptr); + free(ptr); } diff --git a/libmemcached/analyze.h b/libmemcached/analyze.h index 3323e855..dbec8b23 100644 --- a/libmemcached/analyze.h +++ b/libmemcached/analyze.h @@ -5,7 +5,7 @@ * Use and distribution licensed under the BSD license. See * the COPYING file in the parent directory for full text. * - * Summary: Change the behavior of the memcached connection. + * Summary: Generate a memcached_analysis_st * */ @@ -18,9 +18,6 @@ extern "C" { struct memcached_analysis_st { - struct { - bool allocated:1; - } options; memcached_st *root; uint32_t average_item_size; uint32_t longest_uptime; diff --git a/libmemcached/callback.c b/libmemcached/callback.c index e87d775c..252b4334 100644 --- a/libmemcached/callback.c +++ b/libmemcached/callback.c @@ -9,17 +9,17 @@ * */ -#include "common.h" +#include "common.h" #include #include #include -/* +/* These functions provide data and function callback support */ -memcached_return_t memcached_callback_set(memcached_st *ptr, - const memcached_callback_t flag, +memcached_return_t memcached_callback_set(memcached_st *ptr, + const memcached_callback_t flag, void *data) { switch (flag) @@ -113,7 +113,7 @@ memcached_return_t memcached_callback_set(memcached_st *ptr, return MEMCACHED_SUCCESS; } -void *memcached_callback_get(memcached_st *ptr, +void *memcached_callback_get(memcached_st *ptr, const memcached_callback_t flag, memcached_return_t *error) { diff --git a/libmemcached/common.h b/libmemcached/common.h index 97899ea9..42bafd94 100644 --- a/libmemcached/common.h +++ b/libmemcached/common.h @@ -86,29 +86,6 @@ struct memcached_continuum_item_st #define SMALL_STRING_LEN 1024 #define HUGE_STRING_LEN 8196 - -typedef enum { - MEM_NO_BLOCK= (1 << 0), - MEM_TCP_NODELAY= (1 << 1), - MEM_REUSE_MEMORY= (1 << 2), - MEM_USE_MD5= (1 << 3), - /* 4 was once Ketama */ - MEM_USE_CRC= (1 << 5), - MEM_USE_CACHE_LOOKUPS= (1 << 6), - MEM_SUPPORT_CAS= (1 << 7), - MEM_BUFFER_REQUESTS= (1 << 8), - MEM_USE_SORT_HOSTS= (1 << 9), - MEM_VERIFY_KEY= (1 << 10), - /* 11 used for weighted ketama */ - MEM_KETAMA_WEIGHTED= (1 << 11), - MEM_BINARY_PROTOCOL= (1 << 12), - MEM_HASH_WITH_PREFIX_KEY= (1 << 13), - MEM_NOREPLY= (1 << 14), - MEM_USE_UDP= (1 << 15), - MEM_AUTO_EJECT_HOSTS= (1 << 16), - MEM_RANDOMIZE_REPLICA_READ= (1 << 17) -} memcached_flags; - /* Hashing algo */ LIBMEMCACHED_LOCAL @@ -149,7 +126,7 @@ LIBMEMCACHED_LOCAL void server_list_free(memcached_st *ptr, memcached_server_st *servers); LIBMEMCACHED_LOCAL -memcached_return_t memcached_key_test(const char * const *keys, +memcached_return_t memcached_key_test(const char * const *keys, const size_t *key_length, size_t number_of_keys);