docs/pod2htmd.tmp
docs/pod2htmi.tmp
example/memcached_light
-libmemcached-*.tar.gz
-libmemcached-0.30-1.src.rpm
-libmemcached-0.30-1.x86_64.rpm
-libmemcached-0.31-1.src.rpm
-libmemcached-0.31-1.x86_64.rpm
-libmemcached-?.??/
-libmemcached/memcached_configure.h
-libtool
-libtool.m4
-ltoptions.m4
-ltsugar.m4
-ltversion.m4
-lt~obsolete.m4
-stamp-h1
-support/Makefile
-support/Makefile.in
-support/libmemcached-fc.spec
-support/libmemcached.pc
-support/libmemcached.spec
-tests/atomsmasher
-tests/output.cmp
-tests/startservers
-tests/testapp
-tests/testhashkit
-tests/testplus
-tests/udptest
hashkit_clone.pop
hashkit_crc32.pop
hashkit_create.pop
hashkit_md5.pop
hashkit_murmur.pop
hashkit_value.pop
-libmemcached_examples.pop
+libmemcached-*.tar.gz
+libmemcached-0.30-1.src.rpm
+libmemcached-0.30-1.x86_64.rpm
+libmemcached-0.31-1.src.rpm
+libmemcached-0.31-1.x86_64.rpm
+libmemcached-?.??/
libmemcached.pop
+libmemcached/configure.h
+libmemcached/memcached_configure.h
+libmemcached_examples.pop
libmemcachedutil.pop
-memcached_add_by_key.pop
+libtool
+libtool.m4
+ltoptions.m4
+ltsugar.m4
+ltversion.m4
+lt~obsolete.m4
memcached_add.pop
+memcached_add_by_key.pop
memcached_analyze.pop
-memcached_append_by_key.pop
memcached_append.pop
+memcached_append_by_key.pop
memcached_behavior_get.pop
memcached_behavior_set.pop
memcached_callback_get.pop
memcached_callback_set.pop
-memcached_cas_by_key.pop
memcached_cas.pop
+memcached_cas_by_key.pop
memcached_clone.pop
memcached_create.pop
memcached_decrement.pop
memcached_decrement_with_initial.pop
-memcached_delete_by_key.pop
memcached_delete.pop
+memcached_delete_by_key.pop
memcached_dump.pop
-memcached_fetch_execute.pop
memcached_fetch.pop
+memcached_fetch_execute.pop
memcached_fetch_result.pop
-memcached_flush_buffers.pop
memcached_flush.pop
+memcached_flush_buffers.pop
memcached_free.pop
memcached_generate_hash_value.pop
+memcached_get.pop
memcached_get_by_key.pop
memcached_get_memory_allocators.pop
-memcached_get.pop
memcached_get_user_data.pop
memcached_increment.pop
memcached_increment_with_initial.pop
memcached_lib_version.pop
+memcached_mget.pop
memcached_mget_by_key.pop
-memcached_mget_execute_by_key.pop
memcached_mget_execute.pop
-memcached_mget.pop
+memcached_mget_execute_by_key.pop
memcached_pool_behavior_get.pop
memcached_pool_behavior_set.pop
memcached_pool_create.pop
memcached_pool_destroy.pop
memcached_pool_pop.pop
memcached_pool_push.pop
-memcached_prepend_by_key.pop
memcached_prepend.pop
+memcached_prepend_by_key.pop
memcached_quit.pop
-memcached_replace_by_key.pop
memcached_replace.pop
+memcached_replace_by_key.pop
memcached_result_cas.pop
memcached_result_create.pop
memcached_result_flags.pop
memcached_server_add.pop
memcached_server_add_unix_socket.pop
memcached_server_count.pop
+memcached_server_list.pop
memcached_server_list_append.pop
memcached_server_list_count.pop
memcached_server_list_free.pop
-memcached_server_list.pop
memcached_server_push.pop
memcached_servers_parse.pop
+memcached_set.pop
memcached_set_by_key.pop
memcached_set_memory_allocators.pop
-memcached_set.pop
memcached_set_user_data.pop
+memcached_stat.pop
memcached_stat_get_keys.pop
memcached_stat_get_value.pop
-memcached_stat.pop
memcached_stat_servername.pop
memcached_strerror.pop
memcached_verbosity.pop
memrm.pop
memslap.pop
memstat.pop
+stamp-h1
+support/Makefile
+support/Makefile.in
+support/libmemcached-fc.spec
+support/libmemcached.pc
+support/libmemcached.spec
+tests/atomsmasher
+tests/output.cmp
+tests/startservers
+tests/testapp
+tests/testhashkit
+tests/testplus
+tests/udptest
if (ptr->number_of_hosts)
{
qsort(ptr->hosts, ptr->number_of_hosts, sizeof(memcached_server_st), compare_servers);
- ptr->hosts[0].count= (uint16_t) ptr->number_of_hosts;
+ ptr->hosts[0].number_of_hosts= ptr->number_of_hosts;
}
}
void server_list_free(memcached_st *ptr, memcached_server_st *servers)
{
- unsigned int x;
+ uint32_t x;
if (servers == NULL)
return;
- for (x= 0; x < servers->count; x++)
+ for (x= 0; x < memcached_servers_count(servers); x++)
if (servers[x].address_info)
{
freeaddrinfo(servers[x].address_info);
if (!list)
return MEMCACHED_SUCCESS;
- count= list[0].count;
+ count= memcached_servers_count(list);
new_host_list= ptr->call_realloc(ptr, ptr->hosts,
sizeof(memcached_server_st) * (count + ptr->number_of_hosts));
list[x].port, list[x].weight, list[x].type);
ptr->number_of_hosts++;
}
- ptr->hosts[0].count= (uint16_t) ptr->number_of_hosts;
+ ptr->hosts[0].number_of_hosts= (uint16_t) ptr->number_of_hosts;
return run_distribution(ptr);
}
/* TODO: Check return type */
(void)memcached_server_create_with(ptr, &ptr->hosts[ptr->number_of_hosts], hostname, port, weight, type);
ptr->number_of_hosts++;
- ptr->hosts[0].count= (uint16_t) ptr->number_of_hosts;
+
+ memcached_servers_set_count(&ptr->hosts[0], ptr->number_of_hosts);
return run_distribution(ptr);
}
count= 1;
if (ptr != NULL)
{
- count+= ptr[0].count;
+ count+= memcached_servers_count(ptr);
}
new_host_list= (memcached_server_st *)realloc(ptr, sizeof(memcached_server_st) * count);
memcached_server_create_with(NULL, &new_host_list[count-1], hostname, port, weight, MEMCACHED_CONNECTION_TCP);
/* Backwards compatibility hack */
- new_host_list[0].count= (uint16_t) count;
+ memcached_servers_set_count(new_host_list, count);
*error= MEMCACHED_SUCCESS;
return new_host_list;
}
-
-unsigned int memcached_server_list_count(memcached_server_st *ptr)
-{
- if (ptr == NULL)
- return 0;
-
- return ptr[0].count;
-}
-
-void memcached_server_list_free(memcached_server_st *ptr)
-{
- server_list_free(NULL, ptr);
-}
{
return ptr->last_disconnected_server;
}
+
+uint32_t memcached_server_list_count(memcached_server_st *ptr)
+{
+ if (ptr == NULL)
+ return 0;
+
+ return memcached_servers_count(ptr);
+}
+
+void memcached_server_list_free(memcached_server_st *ptr)
+{
+ server_list_free(NULL, ptr);
+}
bool is_allocated:1;
bool sockaddr_inited:1;
} options;
- uint16_t count;
+ uint32_t number_of_hosts;
uint32_t cursor_active;
in_port_t port;
int cached_errno;
char hostname[MEMCACHED_MAX_HOST_LENGTH];
};
+static inline uint32_t memcached_servers_count(memcached_server_st *servers)
+{
+ return servers->number_of_hosts;
+}
+
+static inline uint32_t memcached_servers_set_count(memcached_server_st *servers, uint32_t count)
+{
+ return servers->number_of_hosts= count;
+}
+
#define memcached_server_count(A) (A)->number_of_hosts
#define memcached_server_name(A,B) (B).hostname
#define memcached_server_port(A,B) (B).port
test_ports[x]= (uint32_t)random() % 64000;
rc= memcached_server_add_with_weight(local_memc, "localhost", test_ports[x], 0);
test_truth(local_memc->number_of_hosts == x + 1);
- test_truth(local_memc->hosts[0].count == x+1);
+ test_truth(memcached_servers_count(local_memc->hosts) == x+1);
test_truth(rc == MEMCACHED_SUCCESS);
}
test_ports[x]= (uint32_t)(random() % 64000);
rc= memcached_server_add_with_weight(local_memc, "localhost", test_ports[x], 0);
test_truth(local_memc->number_of_hosts == x+1);
- test_truth(local_memc->hosts[0].count == x+1);
+ test_truth(memcached_servers_count(local_memc->hosts) == x+1);
test_truth(rc == MEMCACHED_SUCCESS);
}