X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Ffunction.c;fp=tests%2Ffunction.c;h=5f83e1ea2a16a05d8f5133c189aff8a212fbe172;hb=29db6c77e126d9ae0c416ad76402fdbef7372cdb;hp=7b13b1b6d9b462dd1ff856b0355eabb9567fd13c;hpb=dd306653cdd9b09904b25dc4f7ffe7c64d9fd357;p=m6w6%2Flibmemcached diff --git a/tests/function.c b/tests/function.c index 7b13b1b6..5f83e1ea 100644 --- a/tests/function.c +++ b/tests/function.c @@ -3648,7 +3648,8 @@ static test_return replication_mget_test(memcached_st *memc) * This is to verify correct behavior in the library */ memcached_result_st result_obj; - for (int host= 0; host < clone->number_of_hosts; ++host) { + for (int host= 0; host < clone->number_of_hosts; ++host) + { memcached_st *clone= memcached_clone(NULL, memc); clone->hosts[host].port= 0; @@ -3665,7 +3666,7 @@ static test_return replication_mget_test(memcached_st *memc) int hits= 0; while ((results= memcached_fetch_result(clone, &result_obj, &rc)) != NULL) { - ++hits; + hits++; } assert(hits == 4); memcached_result_free(&result_obj); @@ -3708,7 +3709,8 @@ static test_return replication_delete_test(memcached_st *memc) } memcached_result_st result_obj; - for (int host= 0; host < clone->number_of_hosts; ++host) { + for (int host= 0; host < clone->number_of_hosts; ++host) + { for (int x= 'a'; x <= 'z'; ++x) { char key[2]= { [0]= (char)x }; @@ -3745,6 +3747,7 @@ static uint16_t *get_udp_request_ids(memcached_st *memc) uint16_t *ids= malloc(sizeof(uint16_t) * memc->number_of_hosts); assert(ids != NULL); unsigned int x; + for (x= 0; x < memc->number_of_hosts; x++) ids[x]= get_udp_datagram_request_id((struct udp_datagram_header_st *) memc->hosts[x].write_buffer); @@ -3756,6 +3759,7 @@ static test_return post_udp_op_check(memcached_st *memc, uint16_t *expected_req_ unsigned int x; memcached_server_st *cur_server = memc->hosts; uint16_t *cur_req_ids = get_udp_request_ids(memc); + for (x= 0; x < memc->number_of_hosts; x++) { assert(cur_server[x].cursor_active == 0); @@ -3763,6 +3767,7 @@ static test_return post_udp_op_check(memcached_st *memc, uint16_t *expected_req_ } free(expected_req_ids); free(cur_req_ids); + return TEST_SUCCESS; } @@ -3784,6 +3789,7 @@ static memcached_return init_udp(memcached_st *memc) memcpy(servers, memc->hosts, sizeof(memcached_server_st) * num_hosts); for (x= 0; x < num_hosts; x++) memcached_server_free(&memc->hosts[x]); + memc->number_of_hosts= 0; memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_USE_UDP, 1); for (x= 0; x < num_hosts; x++) @@ -3791,6 +3797,7 @@ static memcached_return init_udp(memcached_st *memc) assert(memcached_server_add_udp(memc, servers[x].hostname, servers[x].port) == MEMCACHED_SUCCESS); assert(memc->hosts[x].write_buffer_offset == UDP_DATAGRAM_HEADER_LENGTH); } + return MEMCACHED_SUCCESS; }