From: Brian Aker Date: Fri, 20 May 2011 05:07:42 +0000 (-0700) Subject: Update basic string. X-Git-Tag: 0.51~10^2~10 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=160dac4581fcdf788e9ffb675a51dbb4de8496a1;p=awesomized%2Flibmemcached Update basic string. --- diff --git a/libmemcached/basic_string.h b/libmemcached/basic_string.h index 50dbce63..b47724bb 100644 --- a/libmemcached/basic_string.h +++ b/libmemcached/basic_string.h @@ -37,8 +37,8 @@ #pragma once struct memcached_string_t { - size_t size; const char *c_str; + size_t size; }; #define memcached_size(X) (X).size; diff --git a/libmemcached/connect.cc b/libmemcached/connect.cc index 5de143be..26e2f18a 100644 --- a/libmemcached/connect.cc +++ b/libmemcached/connect.cc @@ -173,7 +173,7 @@ static memcached_return_t set_hostinfo(memcached_server_st *server) case EAI_SYSTEM: { - static memcached_string_t mesg= { memcached_string_make("getaddrinfo") }; + static memcached_string_t mesg= { memcached_literal_param("getaddrinfo") }; return memcached_set_errno(*server, errno, &mesg); } case EAI_BADFLAGS: diff --git a/libmemcached/error.cc b/libmemcached/error.cc index 5f991d7b..9611ec02 100644 --- a/libmemcached/error.cc +++ b/libmemcached/error.cc @@ -138,7 +138,7 @@ memcached_return_t memcached_set_error_message(memcached_server_st& self, memcac self.hostname, int(self.port)); } - memcached_string_t error_host= { size, hostname_port_message }; + memcached_string_t error_host= { hostname_port_message, size }; _set((memcached_st*)self.root, &error_host, rc); @@ -153,7 +153,7 @@ memcached_return_t memcached_set_error(memcached_server_st& self, memcached_retu char hostname_port[NI_MAXHOST +NI_MAXSERV + sizeof("host : ")]; int size= snprintf(hostname_port, sizeof(hostname_port), "host: %s:%d", self.hostname, int(self.port)); - memcached_string_t error_host= { size, hostname_port }; + memcached_string_t error_host= { hostname_port, size}; _set((memcached_st*)self.root, &error_host, rc); @@ -204,7 +204,7 @@ memcached_return_t memcached_set_errno(memcached_server_st& self, int local_errn self.hostname, int(self.port)); } - memcached_string_t error_host= { size, hostname_port_message }; + memcached_string_t error_host= { hostname_port_message, size }; self.cached_errno= local_errno; // Store in the actual server memcached_return_t rc= MEMCACHED_ERRNO; diff --git a/libmemcached/string.h b/libmemcached/string.h index 29116ca5..cfc98c74 100644 --- a/libmemcached/string.h +++ b/libmemcached/string.h @@ -109,10 +109,8 @@ void memcached_string_set_length(memcached_string_st *self, size_t length); #ifdef __cplusplus #define memcached_literal_param(X) (X), (static_cast((sizeof(X) - 1))) -#define memcached_string_make(X) (static_cast((sizeof(X) - 1))), (X) #else #define memcached_literal_param(X) (X), ((size_t)((sizeof(X) - 1))) -#define memcached_string_make(X) (((size_t)((sizeof(X) - 1))), (X) #endif #define memcached_string_make_from_cstr(X) (X), ((X) ? strlen(X) : 0)