X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fmemcached_delete.c;h=16ab0cd56e103abcc2489e7c26d603e48145078d;hb=8ce1a267a6593221cdd887643517364694ea985f;hp=dea5c92ff367c2df7631cab331e9037f54a814d9;hpb=3d4ad9999de3113cce3335d4643c7be9a11075c7;p=m6w6%2Flibmemcached diff --git a/lib/memcached_delete.c b/lib/memcached_delete.c index dea5c92f..16ab0cd5 100644 --- a/lib/memcached_delete.c +++ b/lib/memcached_delete.c @@ -35,11 +35,8 @@ memcached_return memcached_delete_by_key(memcached_st *ptr, 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 { @@ -53,9 +50,9 @@ memcached_return memcached_delete_by_key(memcached_st *ptr, } 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 */ @@ -74,8 +71,8 @@ error: { 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];