{
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;
}
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)
{
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)