From: Brian Aker Date: Sat, 31 Dec 2011 02:30:11 +0000 (-0800) Subject: Update vector reference X-Git-Tag: 1.0.3~3^2~1^2~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=97574c49666f4da4357c9e32f3130f27d6d45e21;p=awesomized%2Flibmemcached Update vector reference --- diff --git a/libmemcached/do.cc b/libmemcached/do.cc index a51472ba..d289c479 100644 --- a/libmemcached/do.cc +++ b/libmemcached/do.cc @@ -12,14 +12,13 @@ #include memcached_return_t memcached_vdo(memcached_server_write_instance_st instance, - libmemcached_io_vector_st *vector, + libmemcached_io_vector_st vector[], const size_t count, const bool with_flush) { memcached_return_t rc; - WATCHPOINT_ASSERT(count); - WATCHPOINT_ASSERT(vector); + assert_msg(vector, "Invalid vector passed"); if (memcached_failed(rc= memcached_connect(instance))) { @@ -35,19 +34,12 @@ memcached_return_t memcached_vdo(memcached_server_write_instance_st instance, **/ if (memcached_is_udp(instance->root)) { - if (vector->buffer or vector->length) + if (vector[0].buffer or vector[0].length) { return memcached_set_error(*instance->root, MEMCACHED_NOT_SUPPORTED, MEMCACHED_AT, memcached_literal_param("UDP messages was attempted, but vector was not setup for it")); } - size_t write_length= io_vector_total_size(vector, 11) +UDP_DATAGRAM_HEADER_LENGTH; - - if (write_length > MAX_UDP_DATAGRAM_LENGTH - UDP_DATAGRAM_HEADER_LENGTH) - { - return MEMCACHED_WRITE_FAILURE; - } - return MEMCACHED_NOT_SUPPORTED; } diff --git a/libmemcached/do.hpp b/libmemcached/do.hpp index a42d8678..560c1318 100644 --- a/libmemcached/do.hpp +++ b/libmemcached/do.hpp @@ -38,6 +38,6 @@ #pragma once memcached_return_t memcached_vdo(memcached_server_write_instance_st ptr, - libmemcached_io_vector_st *vector, + libmemcached_io_vector_st vector[], const size_t count, const bool with_flush); diff --git a/libmemcached/get.cc b/libmemcached/get.cc index 814c5bf7..b2428386 100644 --- a/libmemcached/get.cc +++ b/libmemcached/get.cc @@ -348,7 +348,9 @@ static memcached_return_t memcached_mget_by_key_real(memcached_st *ptr, LIBMEMCACHED_MEMCACHED_MGET_END(); if (memcached_failed(rc)) + { return rc; + } return memcached_set_error(*ptr, MEMCACHED_NO_SERVERS, MEMCACHED_AT); } diff --git a/libmemcached/io.cc b/libmemcached/io.cc index 2b463ec7..02f1cc0f 100644 --- a/libmemcached/io.cc +++ b/libmemcached/io.cc @@ -661,21 +661,9 @@ ssize_t memcached_io_write(memcached_server_write_instance_st ptr, return _io_write(ptr, buffer, length, with_flush); } -size_t io_vector_total_size(libmemcached_io_vector_st* vector, const size_t number_of) -{ - ssize_t total= 0; - - for (size_t x= 0; x < number_of; x++) - { - total+= vector->length; - } - - return total; -} - ssize_t memcached_io_writev(memcached_server_write_instance_st ptr, - libmemcached_io_vector_st *vector, - size_t number_of, bool with_flush) + libmemcached_io_vector_st vector[], + const size_t number_of, const bool with_flush) { ssize_t total= 0; diff --git a/libmemcached/io.hpp b/libmemcached/io.hpp index 4a7b3cf0..efce2233 100644 --- a/libmemcached/io.hpp +++ b/libmemcached/io.hpp @@ -38,16 +38,14 @@ #pragma once -size_t io_vector_total_size(libmemcached_io_vector_st* vector, const size_t number_of); - bool memcached_io_write(memcached_server_write_instance_st ptr); ssize_t memcached_io_write(memcached_server_write_instance_st ptr, const void *buffer, size_t length, bool with_flush); ssize_t memcached_io_writev(memcached_server_write_instance_st ptr, - libmemcached_io_vector_st *vector, - size_t number_of, bool with_flush); + libmemcached_io_vector_st vector[], + const size_t number_of, const bool with_flush); memcached_return_t memcached_io_wait_for_write(memcached_server_write_instance_st ptr);