+ memcached_string_st *result_buffer;
+ result_buffer= &ptr->result_buffer;
+
+ while (ptr->cursor_server < ptr->number_of_hosts)
+ {
+ if (!ptr->hosts[ptr->cursor_server].cursor_active)
+ {
+ ptr->cursor_server++;
+ continue;
+ }
+
+ *error = memcached_value_fetch(ptr, key, key_length, result_buffer,
+ flags, 1, ptr->cursor_server);
+ *value_length= memcached_string_length(result_buffer);
+
+ if (*error == MEMCACHED_NOTFOUND)
+ ptr->cursor_server++;
+ else if (*error == MEMCACHED_END && *value_length == 0)
+ return NULL;
+ else if (*error == MEMCACHED_END)
+ {
+ WATCHPOINT_ASSERT(0); /* If this happens we have somehow messed up the fetch */
+ return NULL;
+ }
+ else if (*error != MEMCACHED_SUCCESS)
+ return NULL;
+ else
+ return memcached_string_c_copy(result_buffer);
+
+ }
+
+ *value_length= 0;
+ return NULL;
+}
+
+memcached_result_st *memcached_fetch_result(memcached_st *ptr,
+ memcached_result_st *result,
+ memcached_return *error)
+{
+ if (result == NULL)
+ result= memcached_result_create(ptr, NULL);