From: Brian Aker Date: Thu, 11 Oct 2007 21:49:30 +0000 (-0700) Subject: Fixed for bad call in memcached_behavior.c X-Git-Tag: 0_7~47 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=afcf6c1a1c42ed21d50fb17fc1ba6589fddb5030;p=m6w6%2Flibmemcached Fixed for bad call in memcached_behavior.c --- diff --git a/lib/memcached_behavior.c b/lib/memcached_behavior.c index 2fce7d5f..1ce495af 100644 --- a/lib/memcached_behavior.c +++ b/lib/memcached_behavior.c @@ -52,17 +52,22 @@ unsigned long long memcached_behavior_get(memcached_st *ptr, { case MEMCACHED_BEHAVIOR_NO_BLOCK: temp_flag= MEM_NO_BLOCK; + break; case MEMCACHED_BEHAVIOR_TCP_NODELAY: temp_flag= MEM_TCP_NODELAY; + break; case MEMCACHED_BEHAVIOR_MD5_HASHING: temp_flag= MEM_USE_MD5; + break; case MEMCACHED_BEHAVIOR_KETAMA: temp_flag= MEM_USE_KETAMA; - if (ptr->flags & temp_flag) - return 1; - else - return 0; + break; } + if (ptr->flags & temp_flag) + return 1; + else + return 0; + return MEMCACHED_SUCCESS; } diff --git a/lib/memcached_hash.c b/lib/memcached_hash.c index 4d0d6cf2..ca7229c2 100644 --- a/lib/memcached_hash.c +++ b/lib/memcached_hash.c @@ -5,7 +5,7 @@ static unsigned int internal_generate_hash(char *key, size_t key_length); unsigned int memcached_generate_hash(memcached_st *ptr, char *key, size_t key_length) { - unsigned int return_value; + unsigned int hash; if (ptr->flags & MEM_USE_MD5) { @@ -13,21 +13,18 @@ unsigned int memcached_generate_hash(memcached_st *ptr, char *key, size_t key_le md5_signature((unsigned char*)key, (unsigned int)key_length, results); - return_value= (unsigned int)(( results[3] << 24 ) + hash= (unsigned int)(( results[3] << 24 ) | ( results[2] << 16 ) | ( results[1] << 8 ) | results[0] ); } else - return_value= internal_generate_hash(key, key_length); + hash= internal_generate_hash(key, key_length); if (ptr->flags & MEM_USE_KETAMA) - { assert(0); - return 0; - } else - return return_value % ptr->number_of_hosts; + return hash % ptr->number_of_hosts; } static unsigned int internal_generate_hash(char *key, size_t key_length)