Switching to pointer for read (mainly getting ready to do optimization)
authorBrian Aker <brian@tangent.org>
Tue, 2 Oct 2007 01:44:18 +0000 (18:44 -0700)
committerBrian Aker <brian@tangent.org>
Tue, 2 Oct 2007 01:44:18 +0000 (18:44 -0700)
lib/memcached_io.c

index a6e563d3d2d516d4dd26e7a42778771d0588a9bb..77df4319076b8286203cc7d6adfdbb4ea3660c00 100644 (file)
@@ -8,8 +8,12 @@ ssize_t memcached_io_read(memcached_st *ptr, unsigned  int server_key,
                           char *buffer, size_t length)
 {
   size_t x;
+  char *buffer_ptr;
 
-  for (x= 0; x < length; x++)
+  buffer_ptr= buffer;
+
+  for (x= 0, buffer_ptr= buffer; 
+       x < length; x++)
   {
     if (!ptr->read_buffer_length)
     {
@@ -23,7 +27,8 @@ ssize_t memcached_io_read(memcached_st *ptr, unsigned  int server_key,
       if (ptr->read_buffer_length == 0)
         return x;
     }
-    buffer[x]= *ptr->read_ptr;
+    *buffer_ptr= *ptr->read_ptr;
+    buffer_ptr++;
     ptr->read_ptr++;
     ptr->read_buffer_length--;
   }