X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Flibmemcached%2Fhosts.cc;h=39247287666d55fed37f5b5f72242057fa5f462d;hb=6b7d2bf0319e0bd48bd6aa4ad8c56a935f98b0d2;hp=8afbdb259f5c84114299d643a69cb57742fe5abb;hpb=c8a5aecba8e189092266f304ca81ab42625edf60;p=awesomized%2Flibmemcached diff --git a/src/libmemcached/hosts.cc b/src/libmemcached/hosts.cc index 8afbdb25..39247287 100644 --- a/src/libmemcached/hosts.cc +++ b/src/libmemcached/hosts.cc @@ -17,7 +17,10 @@ #include "libmemcached/assert.hpp" #include -#include +#if HAVE_SYS_TIME_H +# include +#endif +#include /* Protoypes (static) */ static memcached_return_t update_continuum(Memcached *ptr); @@ -51,15 +54,20 @@ memcached_return_t run_distribution(Memcached *ptr) { case MEMCACHED_DISTRIBUTION_CONSISTENT: case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA: case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY: - case MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED: return update_continuum(ptr); + case MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED: + return update_continuum(ptr); case MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET: - case MEMCACHED_DISTRIBUTION_MODULA: break; + case MEMCACHED_DISTRIBUTION_MODULA: + break; - case MEMCACHED_DISTRIBUTION_RANDOM: srandom((uint32_t) time(NULL)); break; + case MEMCACHED_DISTRIBUTION_RANDOM: + srandom((uint32_t) time(NULL)); + break; case MEMCACHED_DISTRIBUTION_CONSISTENT_MAX: - default: assert_msg(0, "Invalid distribution type passed to run_distribution()"); + default: + assert_msg(0, "Invalid distribution type passed to run_distribution()"); } return MEMCACHED_SUCCESS; @@ -340,7 +348,7 @@ memcached_return_t memcached_server_push(memcached_st *shell, const memcached_se ptr->state.is_parsing = true; for (uint32_t x = 0; x < count; ++x, ++original_host_size) { - WATCHPOINT_ASSERT(list[x].hostname[0] != 0); + WATCHPOINT_ASSERT(list[x].hostname[0]); // We have extended the array, and now we will find it, and use it. memcached_instance_st *instance = memcached_instance_fetch(ptr, original_host_size); @@ -391,7 +399,7 @@ memcached_return_t memcached_instance_push(memcached_st *ptr, // We use original_host_size since size will now point to the first new // instance allocated. for (uint32_t x = 0; x < number_of_hosts; ++x, ++original_host_size) { - WATCHPOINT_ASSERT(list[x]._hostname[0] != 0); + WATCHPOINT_ASSERT(list[x]._hostname[0]); // We have extended the array, and now we will find it, and use it. memcached_instance_st *instance = memcached_instance_fetch(ptr, original_host_size);