+ Memcached* ptr= memcached2Memcached(shell);
+ if (ptr)
+ {
+ uint32_t original_host_size= memcached_server_count(ptr);
+ uint32_t count= memcached_server_list_count(list);
+ uint32_t host_list_size= count +original_host_size;
+
+ memcached_instance_st* new_host_list= libmemcached_xrealloc(ptr, memcached_instance_list(ptr), host_list_size, memcached_instance_st);
+
+ if (new_host_list == NULL)
+ {
+ return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
+ }
+
+ memcached_instance_set(ptr, new_host_list, host_list_size);
+
+ ptr->state.is_parsing= true;
+ for (uint32_t x= 0; x < count; ++x, ++original_host_size)
+ {
+ WATCHPOINT_ASSERT(list[x].hostname[0] != 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);
+ WATCHPOINT_ASSERT(instance);
+
+ memcached_string_t hostname= { memcached_string_make_from_cstr(list[x].hostname) };
+ if (__instance_create_with(ptr, instance,
+ hostname,
+ list[x].port, list[x].weight, list[x].type) == NULL)
+ {
+ ptr->state.is_parsing= false;
+ return memcached_set_error(*ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT);
+ }
+
+ if (list[x].weight > 1)
+ {
+ memcached_set_weighted_ketama(ptr, true);
+ }
+ }
+ ptr->state.is_parsing= false;
+
+ return run_distribution(ptr);
+ }
+
+ return MEMCACHED_INVALID_ARGUMENTS;
+}
+
+memcached_return_t memcached_instance_push(memcached_st *ptr, const struct memcached_instance_st* list, uint32_t number_of_hosts)
+{
+ if (list == NULL)
+ {
+ return MEMCACHED_SUCCESS;
+ }