Update vector reference
authorBrian Aker <brian@tangent.org>
Sat, 31 Dec 2011 02:30:11 +0000 (18:30 -0800)
committerBrian Aker <brian@tangent.org>
Sat, 31 Dec 2011 02:30:11 +0000 (18:30 -0800)
libmemcached/do.cc
libmemcached/do.hpp
libmemcached/get.cc
libmemcached/io.cc
libmemcached/io.hpp

index a51472ba66562a50a18353b1c843bd5c3a3afd7c..d289c479fa71b41cb7129d920c7fd77081575cac 100644 (file)
 #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)))
   {
@@ -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;
   }
 
index a42d8678976b523686e15736dab8f3911fbe3960..560c131829f3daef0906d9fc598d4c57395a3a36 100644 (file)
@@ -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);
index 814c5bf7aa6926782f4f43ea5bfc5a90d8e93f9b..b24283869a668eb001fc58f8c101213592ebd538 100644 (file)
@@ -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);
   }
index 2b463ec77b2a5568b8501289d276ff01c3581231..02f1cc0fd0e754c59b6ff2f744e13446f6d6c79c 100644 (file)
@@ -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;
 
index 4a7b3cf01447c3afc5b7339a851d50bd98a182d4..efce22335fc0bfa67baef619f2ae706928b0f101 100644 (file)
 
 #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);