#include <libmemcached/common.h>
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)))
{
**/
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;
}
#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);
LIBMEMCACHED_MEMCACHED_MGET_END();
if (memcached_failed(rc))
+ {
return rc;
+ }
return memcached_set_error(*ptr, MEMCACHED_NO_SERVERS, MEMCACHED_AT);
}
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;
#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);