From: Brian Aker Date: Mon, 3 Oct 2011 15:00:58 +0000 (-0400) Subject: Flip structure declation. X-Git-Tag: 1.0.2~9^2~2^2~3 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=098b147ae544499cda8b3c7333173bb5f6e01b82;p=m6w6%2Flibmemcached Flip structure declation. --- diff --git a/libmemcached/auto.cc b/libmemcached/auto.cc index a73685ac..b2e4f534 100644 --- a/libmemcached/auto.cc +++ b/libmemcached/auto.cc @@ -145,9 +145,9 @@ static memcached_return_t binary_incr_decr(memcached_st *ptr, uint8_t cmd, struct libmemcached_io_vector_st vector[]= { - { sizeof(request.bytes), request.bytes }, - { memcached_array_size(ptr->_namespace), memcached_array_string(ptr->_namespace) }, - { key_length, key } + { request.bytes, sizeof(request.bytes) }, + { memcached_array_string(ptr->_namespace), memcached_array_size(ptr->_namespace) }, + { key, key_length } }; memcached_return_t rc; @@ -158,7 +158,9 @@ static memcached_return_t binary_incr_decr(memcached_st *ptr, uint8_t cmd, } if (no_reply) + { return MEMCACHED_SUCCESS; + } return memcached_response(instance, (char*)value, sizeof(*value), NULL); } diff --git a/libmemcached/delete.cc b/libmemcached/delete.cc index 6be7e224..91799bbd 100644 --- a/libmemcached/delete.cc +++ b/libmemcached/delete.cc @@ -178,9 +178,9 @@ static inline memcached_return_t binary_delete(memcached_st *ptr, struct libmemcached_io_vector_st vector[]= { - { sizeof(request.bytes), request.bytes}, - { memcached_array_size(ptr->_namespace), memcached_array_string(ptr->_namespace) }, - { key_length, key }, + { request.bytes, sizeof(request.bytes) }, + { memcached_array_string(ptr->_namespace), memcached_array_size(ptr->_namespace) }, + { key, key_length } }; memcached_return_t rc= MEMCACHED_SUCCESS; diff --git a/libmemcached/exist.cc b/libmemcached/exist.cc index b8d4b0d8..b68ba466 100644 --- a/libmemcached/exist.cc +++ b/libmemcached/exist.cc @@ -40,14 +40,14 @@ static memcached_return_t ascii_exist(memcached_st *memc, memcached_server_write { struct libmemcached_io_vector_st vector[]= { - { sizeof("add ") -1, "add " }, - { memcached_array_size(memc->_namespace), memcached_array_string(memc->_namespace) }, - { key_length, key }, - { sizeof(" 0") -1, " 0" }, - { sizeof(" 2678400") -1, " 2678400" }, - { sizeof(" 0") -1, " 0" }, - { 2, "\r\n" }, - { 2, "\r\n" } + { memcached_literal_param("add ") }, + { memcached_array_string(memc->_namespace), memcached_array_size(memc->_namespace) }, + { key, key_length }, + { memcached_literal_param(" 0") }, + { memcached_literal_param(" 2678400") }, + { memcached_literal_param(" 0") }, + { memcached_literal_param("\r\n") }, + { memcached_literal_param("\r\n") } }; /* Send command header */ @@ -89,9 +89,9 @@ static memcached_return_t binary_exist(memcached_st *memc, memcached_server_writ struct libmemcached_io_vector_st vector[]= { - { send_length, request.bytes }, - { memcached_array_size(memc->_namespace), memcached_array_string(memc->_namespace) }, - { key_length, key } + { request.bytes, send_length }, + { memcached_array_string(memc->_namespace), memcached_array_size(memc->_namespace) }, + { key, key_length } }; /* write the header */ diff --git a/libmemcached/get.cc b/libmemcached/get.cc index 3c91b495..a78d73ef 100644 --- a/libmemcached/get.cc +++ b/libmemcached/get.cc @@ -298,10 +298,10 @@ static memcached_return_t memcached_mget_by_key_real(memcached_st *ptr, struct libmemcached_io_vector_st vector[]= { - { get_command_length, get_command }, - { memcached_array_size(ptr->_namespace), memcached_array_string(ptr->_namespace) }, - { key_length[x], keys[x] }, - { 1, " " } + { get_command, get_command_length }, + { memcached_array_string(ptr->_namespace), memcached_array_size(ptr->_namespace) }, + { keys[x], key_length[x] }, + { memcached_literal_param(" ") } }; @@ -500,9 +500,9 @@ static memcached_return_t simple_binary_mget(memcached_st *ptr, struct libmemcached_io_vector_st vector[]= { - { sizeof(request.bytes), request.bytes }, - { memcached_array_size(ptr->_namespace), memcached_array_string(ptr->_namespace) }, - { key_length[x], keys[x] } + { request.bytes, sizeof(request.bytes) }, + { memcached_array_string(ptr->_namespace), memcached_array_size(ptr->_namespace) }, + { keys[x], key_length[x] } }; if (memcached_io_writev(instance, vector, 3, flush) == -1) @@ -634,9 +634,9 @@ static memcached_return_t replication_binary_mget(memcached_st *ptr, */ struct libmemcached_io_vector_st vector[]= { - { sizeof(request.bytes), request.bytes }, - { memcached_array_size(ptr->_namespace), memcached_array_string(ptr->_namespace) }, - { key_length[x], keys[x] } + { request.bytes, sizeof(request.bytes) }, + { memcached_array_string(ptr->_namespace), memcached_array_size(ptr->_namespace) }, + { keys[x], key_length[x] } }; if (memcached_io_writev(instance, vector, 3, true) == -1) @@ -652,7 +652,9 @@ static memcached_return_t replication_binary_mget(memcached_st *ptr, } if (success) + { break; + } } return rc; diff --git a/libmemcached/io.cc b/libmemcached/io.cc index e97a6c88..c6d647be 100644 --- a/libmemcached/io.cc +++ b/libmemcached/io.cc @@ -610,13 +610,10 @@ memcached_return_t memcached_io_slurp(memcached_server_write_instance_st ptr) static ssize_t _io_write(memcached_server_write_instance_st ptr, const void *buffer, size_t length, bool with_flush) { - size_t original_length; - const char* buffer_ptr; - WATCHPOINT_ASSERT(ptr->fd != INVALID_SOCKET); - original_length= length; - buffer_ptr= static_cast(buffer); + size_t original_length= length; + const char *buffer_ptr= static_cast(buffer); while (length) { diff --git a/libmemcached/io.h b/libmemcached/io.h index 3591de92..6d3e2fa2 100644 --- a/libmemcached/io.h +++ b/libmemcached/io.h @@ -60,8 +60,8 @@ struct udp_datagram_header_st struct libmemcached_io_vector_st { - size_t length; const void *buffer; + size_t length; }; #ifdef __cplusplus diff --git a/libmemcached/sasl.cc b/libmemcached/sasl.cc index 3aefb701..32906cc8 100644 --- a/libmemcached/sasl.cc +++ b/libmemcached/sasl.cc @@ -231,9 +231,9 @@ memcached_return_t memcached_sasl_authenticate_connection(memcached_server_st *s struct libmemcached_io_vector_st vector[]= { - { sizeof(request.bytes), request.bytes }, - { keylen, chosenmech }, - { len, data } + { request.bytes, sizeof(request.bytes) }, + { chosenmech, keylen }, + { data, len } }; if (memcached_io_writev(server, vector, 3, true) == -1) diff --git a/libmemcached/stats.cc b/libmemcached/stats.cc index 88e2d101..3b664802 100644 --- a/libmemcached/stats.cc +++ b/libmemcached/stats.cc @@ -333,8 +333,8 @@ static memcached_return_t binary_stats_fetch(memcached_stat_st *memc_stat, struct libmemcached_io_vector_st vector[]= { - { sizeof(request.bytes), request.bytes }, - { len, args } + { request.bytes, sizeof(request.bytes) }, + { args, len } }; if (memcached_vdo(instance, vector, 2, true) != MEMCACHED_SUCCESS) diff --git a/libmemcached/storage.cc b/libmemcached/storage.cc index 703b0e30..12c29275 100644 --- a/libmemcached/storage.cc +++ b/libmemcached/storage.cc @@ -162,10 +162,10 @@ static memcached_return_t memcached_send_binary(memcached_st *ptr, struct libmemcached_io_vector_st vector[]= { - { send_length, request.bytes }, - { memcached_array_size(ptr->_namespace), memcached_array_string(ptr->_namespace) }, - { key_length, key }, - { value_length, value } + { request.bytes, send_length }, + { memcached_array_string(ptr->_namespace), memcached_array_size(ptr->_namespace) }, + { key, key_length }, + { value, value_length } }; /* write the header */ @@ -307,9 +307,9 @@ static memcached_return_t memcached_send_ascii(memcached_st *ptr, { struct libmemcached_io_vector_st vector[]= { - { write_length, buffer }, - { value_length, value }, - { 2, "\r\n" } + { buffer, write_length }, + { value, value_length }, + { memcached_literal_param("\r\n") } }; if (ptr->flags.buffer_requests && verb == SET_OP)