send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
"delete %.*s\r\n", (int)key_length, key);
- if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
- {
- rc[replicas]= MEMCACHED_WRITE_FAILURE;
- goto error;
- }
+ unlikely (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
+ return MEMCACHED_WRITE_FAILURE;
do
{
}
else
{
- rc[replicas]= memcached_response(&ptr->hosts[server_key], buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
- if (rc[replicas] == MEMCACHED_DELETED)
- rc[replicas]= MEMCACHED_SUCCESS;
+ char response_buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
+
+ rc[replicas]= memcached_response(&ptr->hosts[server_key], response_buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
}
/* On error we just jump to the next potential server */
{
if (rc[replicas] == MEMCACHED_DELETED)
return MEMCACHED_SUCCESS;
- else if (rc[replicas] == MEMCACHED_DELETED)
- rc[replicas]= MEMCACHED_BUFFERED;
+ else if (rc[replicas] == MEMCACHED_BUFFERED)
+ return MEMCACHED_BUFFERED;
}
return rc[0];
do
{
+ char response_buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
+
if (memcached_server_response_count(&ptr->hosts[server_key]))
{
- char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
-
if (ptr->flags & MEM_NO_BLOCK)
(void)memcached_io_write(&ptr->hosts[server_key], NULL, 0, 1);
while(memcached_server_response_count(&ptr->hosts[server_key]))
- (void)memcached_response(&ptr->hosts[server_key], buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, result_buffer);
+ (void)memcached_response(&ptr->hosts[server_key], response_buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, result_buffer);
}
rc[replicas]= memcached_do(&ptr->hosts[server_key], buffer, send_length, 1);
if (rc[replicas] != MEMCACHED_SUCCESS)
goto error;
- rc[replicas]= memcached_response(&ptr->hosts[server_key], buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, result_buffer);
+ rc[replicas]= memcached_response(&ptr->hosts[server_key], response_buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, result_buffer);
/* On no key found, we check the replica */
if (rc[replicas] == MEMCACHED_END) /* END means that we move on to the next */
if (result_buffer->flags)
*flags= result_buffer->flags;
+ *error= MEMCACHED_SUCCESS;
return memcached_string_c_copy(&result_buffer->value);
}