From: Brian Aker Date: Tue, 2 Oct 2007 01:44:18 +0000 (-0700) Subject: Switching to pointer for read (mainly getting ready to do optimization) X-Git-Tag: 0.4~7 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=852e3f2d609c4aac766405c27cd8c6774fb20a23;p=m6w6%2Flibmemcached Switching to pointer for read (mainly getting ready to do optimization) --- diff --git a/lib/memcached_io.c b/lib/memcached_io.c index a6e563d3..77df4319 100644 --- a/lib/memcached_io.c +++ b/lib/memcached_io.c @@ -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--; }