uint32_t weight,
memcached_return_t *error)
{
- uint32_t count;
-
memcached_return_t unused;
if (error == NULL)
+ {
error= &unused;
+ }
if (hostname == NULL)
{
{
port = 0;
}
- else if (not port)
+ else if (port == 0)
{
port= MEMCACHED_DEFAULT_PORT;
}
/* Increment count for hosts */
- count= 1;
+ uint32_t count= 1;
if (ptr != NULL)
{
count+= memcached_server_list_count(ptr);
{"lp:994772", true, (test_callback_fn*)regression_994772_TEST },
{"lp:1009493", true, (test_callback_fn*)regression_1009493_TEST },
{"lp:1021819", true, (test_callback_fn*)regression_1021819_TEST },
+ {"lp:1048945", true, (test_callback_fn*)regression_1048945_TEST },
{0, false, (test_callback_fn*)0}
};
return TEST_SUCCESS;
}
+test_return_t regression_1048945_TEST(memcached_st*)
+{
+ memcached_return status;
+
+ memcached_server_st* list= memcached_server_list_append_with_weight(NULL, "a", 11211, 0, &status);
+ test_compare(status, MEMCACHED_SUCCESS);
+
+ list= memcached_server_list_append_with_weight(list, "b", 11211, 0, &status);
+ test_compare(status, MEMCACHED_SUCCESS);
+
+ list= memcached_server_list_append_with_weight(list, "c", 11211, 0, &status);
+ test_compare(status, MEMCACHED_SUCCESS);
+
+ memcached_st* memc= memcached_create(NULL);
+
+ status= memcached_server_push(memc, list);
+ memcached_server_list_free(list);
+ test_compare(status, MEMCACHED_SUCCESS);
+
+ memcached_server_instance_st server= memcached_server_by_key(memc, test_literal_param(__func__), &status);
+ test_true(server);
+ test_compare(status, MEMCACHED_SUCCESS);
+
+ memcached_free(memc);
+
+ return TEST_SUCCESS;
+}
+
test_return_t memcached_fetch_result_NOT_FOUND(memcached_st *memc)
{
memcached_return_t rc;