Merge of trunk
authorBrian Aker <brian@tangent.org>
Tue, 29 Nov 2011 19:43:02 +0000 (11:43 -0800)
committerBrian Aker <brian@tangent.org>
Tue, 29 Nov 2011 19:43:02 +0000 (11:43 -0800)
libmemcached-1.0/server.h
libmemcached/common.h
libmemcached/connect.cc
libmemcached/connect.hpp [new file with mode: 0644]
libmemcached/get.cc
libmemcached/include.am
libmemcached/initialize_query.cc
libmemcached/server.cc
libmemcached/server.hpp
libtest/run.gdb

index 38ab40a94f915e1497fe6fb1cad7ed873d527a15..40548112d7f468455135e36d246a3a98cf4a0430 100644 (file)
@@ -119,10 +119,6 @@ void memcached_server_error_reset(memcached_server_st *ptr);
 LIBMEMCACHED_API
 void memcached_server_free(memcached_server_st *ptr);
 
-LIBMEMCACHED_LOCAL
-memcached_server_st *memcached_server_clone(memcached_server_st *destination,
-                                            memcached_server_st *source);
-
 LIBMEMCACHED_API
 memcached_server_instance_st memcached_server_get_last_disconnect(const memcached_st *ptr);
 
@@ -138,13 +134,6 @@ LIBMEMCACHED_API
 memcached_return_t memcached_server_add(memcached_st *ptr,
                                         const char *hostname, in_port_t port);
 
-LIBMEMCACHED_LOCAL
-  memcached_return_t memcached_server_add_parsed(memcached_st *ptr,
-                                                 const char *hostname,
-                                                 size_t hostname_length,
-                                                 in_port_t port,
-                                                 uint32_t weight);
-
 LIBMEMCACHED_API
 memcached_return_t memcached_server_add_udp_with_weight(memcached_st *ptr,
                                                         const char *hostname,
@@ -174,10 +163,6 @@ in_port_t memcached_server_port(const memcached_server_instance_st self);
 LIBMEMCACHED_API
 const char *memcached_server_type(const memcached_server_instance_st ptr);
 
-
-LIBMEMCACHED_LOCAL
-void __server_free(memcached_server_st *);
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index ba0b4063a068f9443e0a768faa9f16eeee4ed936..7239ca6076e8e5f044d10cf829876788d23b089e 100644 (file)
@@ -107,6 +107,7 @@ memcached_return_t memcached_server_execute(memcached_st *ptr,
 #include <libmemcached/io.hpp>
 #include <libmemcached/do.hpp>
 #include <libmemcached/close_socket.hpp>
+#include <libmemcached/connect.hpp>
 #endif
 #include <libmemcached/internal.h>
 #include <libmemcached/array.h>
index 6cad60d5ed4f942799d77f1edea8710e5725b1c7..e04098c421db19d6297958d875fd967c0ae715ca 100644 (file)
@@ -129,7 +129,7 @@ static memcached_return_t connect_poll(memcached_server_st *server)
   return memcached_set_errno(*server, get_socket_errno(), MEMCACHED_AT);
 }
 
-static memcached_return_t set_hostinfo(memcached_server_st *server)
+memcached_return_t set_hostinfo(memcached_server_st *server)
 {
   if (server->address_info)
   {
diff --git a/libmemcached/connect.hpp b/libmemcached/connect.hpp
new file mode 100644 (file)
index 0000000..78ed796
--- /dev/null
@@ -0,0 +1,40 @@
+/*  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ * 
+ *  Libmemcached library
+ *
+ *  Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are
+ *  met:
+ *
+ *      * Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ *
+ *      * Redistributions in binary form must reproduce the above
+ *  copyright notice, this list of conditions and the following disclaimer
+ *  in the documentation and/or other materials provided with the
+ *  distribution.
+ *
+ *      * The names of its contributors may not be used to endorse or
+ *  promote products derived from this software without specific prior
+ *  written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
+#pragma once
+
+memcached_return_t set_hostinfo(memcached_server_st *server);
index 6dfb7a79a271409902f88947e9d0cb870da5bc01..4ad49a41d00f8042b1c6ff9d1cde3be0dfb5edb0 100644 (file)
@@ -68,12 +68,16 @@ char *memcached_get_by_key(memcached_st *ptr,
 {
   memcached_return_t unused;
   if (error == NULL)
+  {
     error= &unused;
+  }
 
-  unlikely (ptr->flags.use_udp)
+  if (ptr->flags.use_udp)
   {
     if (value_length) 
+    {
       *value_length= 0;
+    }
 
     *error= memcached_set_error(*ptr, MEMCACHED_NOT_SUPPORTED, MEMCACHED_AT);
     return NULL;
index 0da3de330d7a06db80b005131ba7dbfb457a3465..69385463598c36e7ff988a7b06c23f6ba2712f14 100644 (file)
@@ -20,9 +20,10 @@ noinst_HEADERS+= \
                 libmemcached/assert.hpp \
                 libmemcached/backtrace.hpp \
                 libmemcached/byteorder.h \
+                libmemcached/close_socket.hpp \
                 libmemcached/common.h \
+                libmemcached/connect.hpp \
                 libmemcached/continuum.hpp \
-                libmemcached/close_socket.hpp \
                 libmemcached/do.hpp \
                 libmemcached/error.hpp \
                 libmemcached/initialize_query.h \
index 5950158b053feb22a6205ef825719d08277d04a3..84fc2290e647d8f3913d2e58915f59b735bdd043 100644 (file)
@@ -55,12 +55,14 @@ memcached_return_t initialize_query(memcached_st *self)
     return memcached_set_error(*self, MEMCACHED_NO_SERVERS, MEMCACHED_AT);
   }
 
+  memcached_error_free(*self);
+
   return MEMCACHED_SUCCESS;
 }
 
 memcached_return_t initialize_const_query(const memcached_st *self)
 {
-  if (not self)
+  if (self == NULL)
   {
     return MEMCACHED_INVALID_ARGUMENTS;
   }
index cf63f4ca4c7e34033cdb04c2d767e869c2d74047..e1b91b94ceab24c229ecc6b8a5c4e473b902652d 100644 (file)
@@ -138,6 +138,11 @@ memcached_server_st *__server_create_with(memcached_st *memc,
     memcached_io_init_udp_header(self, 0);
   }
 
+  if (memc)
+  {
+    set_hostinfo(self);
+  }
+
   return self;
 }
 
@@ -197,14 +202,6 @@ memcached_server_st *memcached_server_clone(memcached_server_st *destination,
                                     hostname,
                                     source->port, source->weight,
                                     source->type);
-  if (destination)
-  {
-    if (source->error_messages)
-    {
-      destination->error_messages= memcached_error_copy(*source);
-    }
-  }
-
   return destination;
 
 }
index b5f31f6676191585cd9f8bf8bbc5b89072bf1dd3..5d718949eaf5406d3496495422b834c6c5329f22 100644 (file)
 
 #include <cassert>
 
+memcached_server_st *__server_create_with(memcached_st *memc,
+                                          memcached_server_write_instance_st host,
+                                          const memcached_string_t& hostname,
+                                          const in_port_t port,
+                                          uint32_t weight,
+                                          const memcached_connection_t type);
+
+memcached_server_st *memcached_server_clone(memcached_server_st *destination,
+                                            memcached_server_st *source);
+
+memcached_return_t memcached_server_add_parsed(memcached_st *ptr,
+                                               const char *hostname,
+                                               size_t hostname_length,
+                                               in_port_t port,
+                                               uint32_t weight);
+
+void __server_free(memcached_server_st *);
+
 static inline bool memcached_is_valid_servername(const memcached_string_t& arg)
 {
   return arg.size > 0 or arg.size < NI_MAXHOST;
@@ -99,11 +117,3 @@ static inline void memcached_mark_server_for_timeout(memcached_server_write_inst
     set_last_disconnected_host(server);
   }
 }
-
-LIBMEMCACHED_LOCAL
-  memcached_server_st *__server_create_with(memcached_st *memc,
-                                            memcached_server_write_instance_st host,
-                                            const memcached_string_t& hostname,
-                                            const in_port_t port,
-                                            uint32_t weight,
-                                            const memcached_connection_t type);
index 320407a23012715afb8d63f03c3dcaae9fc67e03..a520ae879361863cebb27bfa214010fa6b3ed26f 100644 (file)
@@ -1,2 +1,3 @@
 set environment LIBTEST_IN_GDB=1
 run
+quit