From d4f9faac5b2532375157aac90c36ace0261c867e Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Tue, 29 Nov 2011 15:20:06 -0800 Subject: [PATCH] Break out local functions. --- libmemcached-1.0/allocators.h | 15 ----------- libmemcached-1.0/behavior.h | 3 --- libmemcached-1.0/hash.h | 3 --- libmemcached-1.0/quit.h | 6 ----- libmemcached-1.0/sasl.h | 6 ----- libmemcached-1.0/server_list.h | 9 ------- libmemcached-1.0/string.h | 48 ---------------------------------- libmemcached/allocators.hpp | 47 +++++++++++++++++++++++++++++++++ libmemcached/behavior.hpp | 39 +++++++++++++++++++++++++++ libmemcached/common.h | 7 +++++ libmemcached/hash.hpp | 40 ++++++++++++++++++++++++++++ libmemcached/include.am | 10 +++++-- libmemcached/quit.hpp | 41 +++++++++++++++++++++++++++++ libmemcached/sasl.hpp | 42 +++++++++++++++++++++++++++++ libmemcached/server_list.hpp | 44 +++++++++++++++++++++++++++++++ libmemcached/string.hpp | 38 +++++++++++++++++++++++++++ tests/string.cc | 1 + 17 files changed, 307 insertions(+), 92 deletions(-) create mode 100644 libmemcached/allocators.hpp create mode 100644 libmemcached/behavior.hpp create mode 100644 libmemcached/hash.hpp create mode 100644 libmemcached/quit.hpp create mode 100644 libmemcached/sasl.hpp create mode 100644 libmemcached/server_list.hpp diff --git a/libmemcached-1.0/allocators.h b/libmemcached-1.0/allocators.h index 6e4455f0..9df6e87e 100644 --- a/libmemcached-1.0/allocators.h +++ b/libmemcached-1.0/allocators.h @@ -67,21 +67,6 @@ void memcached_get_memory_allocators(const memcached_st *ptr, LIBMEMCACHED_API void *memcached_get_memory_allocators_context(const memcached_st *ptr); -LIBMEMCACHED_LOCAL -void _libmemcached_free(const memcached_st *ptr, void *mem, void *context); - -LIBMEMCACHED_LOCAL -void *_libmemcached_malloc(const memcached_st *ptr, const size_t size, void *context); - -LIBMEMCACHED_LOCAL -void *_libmemcached_realloc(const memcached_st *ptr, void *mem, const size_t size, void *context); - -LIBMEMCACHED_LOCAL -void *_libmemcached_calloc(const memcached_st *ptr, size_t nelem, size_t size, void *context); - -LIBMEMCACHED_LOCAL -struct memcached_allocator_t memcached_allocators_return_default(void); - #ifdef __cplusplus } #endif diff --git a/libmemcached-1.0/behavior.h b/libmemcached-1.0/behavior.h index 426f9889..c6633532 100644 --- a/libmemcached-1.0/behavior.h +++ b/libmemcached-1.0/behavior.h @@ -65,9 +65,6 @@ memcached_return_t memcached_behavior_set_distribution_hash(memcached_st *ptr, m LIBMEMCACHED_API memcached_hash_t memcached_behavior_get_distribution_hash(memcached_st *ptr); -LIBMEMCACHED_LOCAL -bool _is_auto_eject_host(const memcached_st *ptr); - LIBMEMCACHED_API const char *libmemcached_string_behavior(const memcached_behavior_t flag); diff --git a/libmemcached-1.0/hash.h b/libmemcached-1.0/hash.h index 6002a80e..9fdb7d6f 100644 --- a/libmemcached-1.0/hash.h +++ b/libmemcached-1.0/hash.h @@ -54,9 +54,6 @@ memcached_return_t memcached_set_hashkit(memcached_st *ptr, hashkit_st *hashk); LIBMEMCACHED_API uint32_t memcached_generate_hash(const memcached_st *ptr, const char *key, size_t key_length); -LIBMEMCACHED_LOCAL -uint32_t memcached_generate_hash_with_redistribution(memcached_st *ptr, const char *key, size_t key_length); - LIBMEMCACHED_API void memcached_autoeject(memcached_st *ptr); diff --git a/libmemcached-1.0/quit.h b/libmemcached-1.0/quit.h index 0338eaf0..90ff3ff0 100644 --- a/libmemcached-1.0/quit.h +++ b/libmemcached-1.0/quit.h @@ -44,12 +44,6 @@ extern "C" { LIBMEMCACHED_API void memcached_quit(memcached_st *ptr); -LIBMEMCACHED_LOCAL -void memcached_quit_server(memcached_server_st *ptr, bool io_death); - -LIBMEMCACHED_LOCAL -void send_quit(memcached_st *ptr); - #ifdef __cplusplus } #endif diff --git a/libmemcached-1.0/sasl.h b/libmemcached-1.0/sasl.h index 8602246d..7749f98e 100644 --- a/libmemcached-1.0/sasl.h +++ b/libmemcached-1.0/sasl.h @@ -63,12 +63,6 @@ memcached_return_t memcached_destroy_sasl_auth_data(memcached_st *ptr); LIBMEMCACHED_API sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr); -LIBMEMCACHED_LOCAL -memcached_return_t memcached_clone_sasl(memcached_st *clone, const memcached_st *source); - -LIBMEMCACHED_LOCAL -memcached_return_t memcached_sasl_authenticate_connection(memcached_server_st *server); - #ifdef __cplusplus } #endif diff --git a/libmemcached-1.0/server_list.h b/libmemcached-1.0/server_list.h index 8fe6dc7d..04bebab4 100644 --- a/libmemcached-1.0/server_list.h +++ b/libmemcached-1.0/server_list.h @@ -63,15 +63,6 @@ LIBMEMCACHED_API LIBMEMCACHED_API uint32_t memcached_server_list_count(const memcached_server_list_st ptr); -LIBMEMCACHED_LOCAL - uint32_t memcached_servers_set_count(memcached_server_list_st servers, uint32_t count); - -LIBMEMCACHED_LOCAL - memcached_server_st *memcached_server_list(const memcached_st *); - -LIBMEMCACHED_LOCAL - void memcached_server_list_set(memcached_st *self, memcached_server_list_st list); - #ifdef __cplusplus } // extern "C" #endif diff --git a/libmemcached-1.0/string.h b/libmemcached-1.0/string.h index 42d0e40a..88a09f6a 100644 --- a/libmemcached-1.0/string.h +++ b/libmemcached-1.0/string.h @@ -57,51 +57,3 @@ struct memcached_string_st { bool is_initialized:1; } options; }; - -#ifdef __cplusplus -extern "C" { -#endif - -LIBMEMCACHED_LOCAL -memcached_string_st *memcached_string_create(memcached_st *ptr, - memcached_string_st *string, - size_t initial_size); -LIBMEMCACHED_LOCAL -memcached_return_t memcached_string_check(memcached_string_st *string, size_t need); - -LIBMEMCACHED_LOCAL -char *memcached_string_c_copy(memcached_string_st *string); - -LIBMEMCACHED_LOCAL -memcached_return_t memcached_string_append_character(memcached_string_st *string, - char character); -LIBMEMCACHED_LOCAL -memcached_return_t memcached_string_append(memcached_string_st *string, - const char *value, size_t length); -LIBMEMCACHED_LOCAL -memcached_return_t memcached_string_reset(memcached_string_st *string); - -LIBMEMCACHED_LOCAL -void memcached_string_free(memcached_string_st *string); - -LIBMEMCACHED_LOCAL -size_t memcached_string_length(const memcached_string_st *self); - -LIBMEMCACHED_LOCAL -size_t memcached_string_size(const memcached_string_st *self); - -LIBMEMCACHED_LOCAL -const char *memcached_string_value(const memcached_string_st *self); - -LIBMEMCACHED_LOCAL -char *memcached_string_take_value(memcached_string_st *self); - -LIBMEMCACHED_LOCAL -char *memcached_string_value_mutable(const memcached_string_st *self); - -LIBMEMCACHED_LOCAL -void memcached_string_set_length(memcached_string_st *self, size_t length); - -#ifdef __cplusplus -} -#endif diff --git a/libmemcached/allocators.hpp b/libmemcached/allocators.hpp new file mode 100644 index 00000000..8f196247 --- /dev/null +++ b/libmemcached/allocators.hpp @@ -0,0 +1,47 @@ +/* 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 + +void _libmemcached_free(const memcached_st *ptr, void *mem, void *context); + +void *_libmemcached_malloc(const memcached_st *ptr, const size_t size, void *context); + +void *_libmemcached_realloc(const memcached_st *ptr, void *mem, const size_t size, void *context); + +void *_libmemcached_calloc(const memcached_st *ptr, size_t nelem, size_t size, void *context); + +struct memcached_allocator_t memcached_allocators_return_default(void); diff --git a/libmemcached/behavior.hpp b/libmemcached/behavior.hpp new file mode 100644 index 00000000..ee38f97a --- /dev/null +++ b/libmemcached/behavior.hpp @@ -0,0 +1,39 @@ +/* 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 + +bool _is_auto_eject_host(const memcached_st *ptr); diff --git a/libmemcached/common.h b/libmemcached/common.h index 7239ca60..5aaf797b 100644 --- a/libmemcached/common.h +++ b/libmemcached/common.h @@ -108,6 +108,13 @@ memcached_return_t memcached_server_execute(memcached_st *ptr, #include #include #include +#include +#include +#include +#include +#include +#include +#include #endif #include #include diff --git a/libmemcached/hash.hpp b/libmemcached/hash.hpp new file mode 100644 index 00000000..bf450eed --- /dev/null +++ b/libmemcached/hash.hpp @@ -0,0 +1,40 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. + * + * 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 + +uint32_t memcached_generate_hash_with_redistribution(memcached_st *ptr, const char *key, size_t key_length); diff --git a/libmemcached/include.am b/libmemcached/include.am index 69385463..af49d2d5 100644 --- a/libmemcached/include.am +++ b/libmemcached/include.am @@ -53,11 +53,13 @@ libmemcached_libmemcached_la_CXXFLAGS= -DBUILDING_LIBMEMCACHED libmemcached_libmemcached_la_SOURCES+= \ ${libhashkit_libhashkit_la_SOURCES} \ libmemcached/allocators.cc \ + libmemcached/allocators.hpp \ libmemcached/analyze.cc \ libmemcached/array.c \ libmemcached/auto.cc \ libmemcached/backtrace.cc \ libmemcached/behavior.cc \ + libmemcached/behavior.hpp \ libmemcached/byteorder.cc \ libmemcached/callback.cc \ libmemcached/connect.cc \ @@ -70,26 +72,30 @@ libmemcached_libmemcached_la_SOURCES+= \ libmemcached/flush.cc \ libmemcached/flush_buffers.cc \ libmemcached/get.cc \ - libmemcached/touch.cc \ libmemcached/hash.cc \ + libmemcached/hash.hpp \ libmemcached/hosts.cc \ libmemcached/initialize_query.cc \ libmemcached/io.cc \ libmemcached/key.cc \ libmemcached/memcached.cc \ + libmemcached/namespace.cc \ libmemcached/options.cc \ libmemcached/parse.cc \ - libmemcached/namespace.cc \ libmemcached/purge.cc \ libmemcached/quit.cc \ + libmemcached/quit.hpp \ libmemcached/response.cc \ libmemcached/result.cc \ + libmemcached/sasl.hpp \ libmemcached/server.cc \ libmemcached/server_list.cc \ + libmemcached/server_list.hpp \ libmemcached/stats.cc \ libmemcached/storage.cc \ libmemcached/strerror.cc \ libmemcached/string.cc \ + libmemcached/touch.cc \ libmemcached/verbosity.cc \ libmemcached/version.cc \ libmemcached/virtual_bucket.c diff --git a/libmemcached/quit.hpp b/libmemcached/quit.hpp new file mode 100644 index 00000000..171bb655 --- /dev/null +++ b/libmemcached/quit.hpp @@ -0,0 +1,41 @@ +/* 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 + +void memcached_quit_server(memcached_server_st *ptr, bool io_death); + +void send_quit(memcached_st *ptr); diff --git a/libmemcached/sasl.hpp b/libmemcached/sasl.hpp new file mode 100644 index 00000000..26822682 --- /dev/null +++ b/libmemcached/sasl.hpp @@ -0,0 +1,42 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. + * + * 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 memcached_clone_sasl(memcached_st *clone, const memcached_st *source); + +memcached_return_t memcached_sasl_authenticate_connection(memcached_server_st *server); diff --git a/libmemcached/server_list.hpp b/libmemcached/server_list.hpp new file mode 100644 index 00000000..db56721b --- /dev/null +++ b/libmemcached/server_list.hpp @@ -0,0 +1,44 @@ +/* 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 + + +uint32_t memcached_servers_set_count(memcached_server_list_st servers, uint32_t count); + +memcached_server_st *memcached_server_list(const memcached_st *); + +void memcached_server_list_set(memcached_st *self, memcached_server_list_st list); diff --git a/libmemcached/string.hpp b/libmemcached/string.hpp index 5703bb40..cb1b2edf 100644 --- a/libmemcached/string.hpp +++ b/libmemcached/string.hpp @@ -44,4 +44,42 @@ #define memcached_string_make_from_cstr util_string_make_from_cstr #define memcached_array_length util_array_length +/** + Strings are always under our control so we make some assumptions + about them. + 1) is_initialized is always valid. + 2) A string once intialized will always be, until free where we + unset this flag. + 3) A string always has a root. +*/ + +memcached_string_st *memcached_string_create(memcached_st *ptr, + memcached_string_st *string, + size_t initial_size); + +memcached_return_t memcached_string_check(memcached_string_st *string, size_t need); + +char *memcached_string_c_copy(memcached_string_st *string); + +memcached_return_t memcached_string_append_character(memcached_string_st *string, + char character); + +memcached_return_t memcached_string_append(memcached_string_st *string, + const char *value, size_t length); + +memcached_return_t memcached_string_reset(memcached_string_st *string); + +void memcached_string_free(memcached_string_st *string); + +size_t memcached_string_length(const memcached_string_st *self); + +size_t memcached_string_size(const memcached_string_st *self); + +const char *memcached_string_value(const memcached_string_st *self); + +char *memcached_string_take_value(memcached_string_st *self); + +char *memcached_string_value_mutable(const memcached_string_st *self); + +void memcached_string_set_length(memcached_string_st *self, size_t length); diff --git a/tests/string.cc b/tests/string.cc index 041390ee..bb90e94b 100644 --- a/tests/string.cc +++ b/tests/string.cc @@ -41,6 +41,7 @@ #include #include +#include #include #include -- 2.30.2