#include "libmemcached/memcached.h"
#include "libmemcached/watchpoint.h"
#include "libmemcached/is.h"
+#include "libmemcached/prefix_key.h"
typedef struct memcached_server_st * memcached_server_write_instance_st;
# These symbols will not be exposed in the shipped .so
noinst_LTLIBRARIES+= libmemcached/libmemcachedinternal.la
libmemcached_libmemcachedinternal_la_SOURCES= \
+ libmemcached/error.c \
libmemcached/string.c
lib_LTLIBRARIES+= libmemcached/libmemcached.la
libmemcached/delete.c \
libmemcached/do.c \
libmemcached/dump.c \
- libmemcached/error.c \
libmemcached/fetch.c \
libmemcached/flush.c \
libmemcached/flush_buffers.c \
#include "libmemcached/memcached.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#define MAX_UDP_DATAGRAM_LENGTH 1400
#define UDP_DATAGRAM_HEADER_LENGTH 8
#define UDP_REQUEST_ID_MSG_SIG_DIGITS 10
const void *buffer;
};
+#ifdef __cplusplus
+extern "C" {
+#endif
+
LIBMEMCACHED_LOCAL
memcached_return_t memcached_io_wait_for_write(memcached_server_write_instance_st ptr);
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * LibMemcached
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * 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.
+ *
+ */
+
+#include <libmemcached/common.h>
+#include <libmemcached/options/context.h>
+#include <libmemcached/options/build.h>
+
+namespace parser {
+
+void abort_func(Context *context, const char *error)
+{
+ if (context->rc == MEMCACHED_SUCCESS)
+ context->rc= MEMCACHED_PARSE_ERROR;
+
+ memcached_string_st *error_string= memcached_string_create(context->memc, NULL, 1024);
+ memcached_string_append(error_string, memcached_string_with_size("Error occured while parsing: "));
+ memcached_string_append(error_string, memcached_string_make_from_cstr(context->begin));
+ memcached_string_append(error_string, memcached_string_with_size(" ("));
+
+ if (context->rc == MEMCACHED_PARSE_ERROR and error)
+ {
+ memcached_string_append(error_string, memcached_string_make_from_cstr(error));
+ }
+ else
+ {
+ memcached_string_append(error_string, memcached_string_make_from_cstr(memcached_strerror(NULL, context->rc)));
+ }
+ memcached_string_append(error_string, memcached_string_with_size(")"));
+
+ memcached_set_error_string(context->memc, context->rc, memcached_string_value(error_string), memcached_string_length(error_string));
+
+ memcached_string_free(error_string);
+}
+
+} // namespace parser
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * LibMemcached
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * 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
+
+class Conext;
+
+namespace parser {
+
+void abort_func(Context *context, const char *error);
+
+}
libmemcached/options/parser.yy
noinst_HEADERS+= \
+ libmemcached/options/build.h \
libmemcached/options/context.h \
libmemcached/options/parser.h \
libmemcached/options/scanner.h \
libmemcached/options/symbol.h
libmemcached_libmemcached_la_SOURCES+= \
+ libmemcached/options/build.cc \
libmemcached/options/parser.cc \
libmemcached/options/scanner.cc
#include <stdint.h>
#include <libmemcached/options/context.h>
+#include <libmemcached/options/build.h>
#include <libmemcached/options/string.h>
#include <libmemcached/options/symbol.h>
+#include <libmemcached/visibility.h>
+#include <libmemcached/prefix_key.h>
#pragma GCC diagnostic ignored "-Wold-style-cast"
#include <libmemcached/options/scanner.h>
int libmemcached_lex(YYSTYPE* lvalp, void* scanner);
-#define parser_abort(A, B) do { parser_abort_func((A), (B)); YYABORT; } while (0)
-
-inline void parser_abort_func(Context *context, const char *error)
-{
- (void)error;
- if (context->rc == MEMCACHED_SUCCESS)
- context->rc= MEMCACHED_PARSE_ERROR;
-
- std::string error_message;
- error_message+= "Error occured while parsing: ";
- error_message+= context->begin;
- error_message+= " (";
- if (context->rc == MEMCACHED_PARSE_ERROR and error)
- {
- error_message+= error;
- }
- else
- {
- error_message+= memcached_strerror(NULL, context->rc);
- }
- error_message+= ")";
-
- memcached_set_error_string(context->memc, context->rc, error_message.c_str(), error_message.size());
-}
+#define parser_abort(A, B) do { parser::abort_func((A), (B)); YYABORT; } while (0)
inline void libmemcached_error(Context *context, yyscan_t *scanner, const char *error)
{
if (not context->end())
- parser_abort_func(context, error);
+ parser::abort_func(context, error);
}
int libmemcached_parse(Context*, yyscan_t *);
behaviors:
PREFIX_KEY '=' string
{
- if ((context->rc= memcached_callback_set(context->memc, MEMCACHED_CALLBACK_PREFIX_KEY, std::string($3.c_str, $3.length).c_str())) != MEMCACHED_SUCCESS)
+ if ((context->rc= memcached_set_prefix_key(context->memc, $3.c_str, $3.length)) != MEMCACHED_SUCCESS)
{
parser_abort(context, NULL);;
}
{
self->end= self->string + length;
}
-
-memcached_string_t memcached_string_make(const char *str, size_t length)
-{
- memcached_string_t tmp;
- tmp.c_str= str;
- tmp.size= length;
-
- return tmp;
-}
LIBMEMCACHED_LOCAL
void memcached_string_set_length(memcached_string_st *self, size_t length);
-LIBMEMCACHED_LOCAL
-memcached_string_t memcached_string_make(const char *str, size_t length);
-
#ifdef __cplusplus
}
#endif
+#ifdef BUILDING_LIBMEMCACHED
#ifdef __cplusplus
#define memcached_string_with_size(X) (X), (static_cast<size_t>((sizeof(X) - 1)))
+#define memcached_string_make(X) (static_cast<size_t>((sizeof(X) - 1))), (X)
#else
#define memcached_string_with_size(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)
+
#endif
#endif /* __LIBMEMCACHED_STRING_H__ */
#include <config.h>
+#define BUILDING_LIBMEMCACHED
+
#include <libmemcached/memcached.h>
#include <libmemcached/is.h>
#include <libtest/test.h>
tests/libmemcached_world.h \
tests/parser.h \
tests/print.h \
- tests/replication.h
+ tests/replication.h \
+ tests/string.h
+
noinst_PROGRAMS+= \
tests/atomsmasher \
tests/mem_functions.c \
tests/parser.cc \
tests/print.cc \
- tests/replication.cc
+ tests/replication.cc \
+ tests/string.cc
tests_testapp_DEPENDENCIES= \
$(BUILT_SOURCES) \
HASH_COMMAND= tests/testhashkit $(COLLECTION) $(SUITE)
-test-mem: tests/testapp
+test-mem: tests/testapp support/example.cnf
$(MEM_COMMAND)
test-udp: tests/testudp
#include <libtest/test.h>
#include "tests/parser.h"
+#include "tests/string.h"
#include "tests/replication.h"
#include "tests/basic.h"
#include "tests/error_conditions.h"
return TEST_SUCCESS;
}
-static test_return_t string_static_null(memcached_st *memc)
-{
- memcached_string_st string;
- memcached_string_st *string_ptr;
-
- string_ptr= memcached_string_create(memc, &string, 0);
- test_true(string.options.is_initialized == true);
- test_true(string_ptr);
-
- /* The following two better be the same! */
- test_true(memcached_is_allocated(string_ptr) == false);
- test_true(memcached_is_allocated(&string) == false);
- test_true(&string == string_ptr);
-
- test_true(string.options.is_initialized == true);
- test_true(memcached_is_initialized(&string) == true);
- memcached_string_free(&string);
- test_true(memcached_is_initialized(&string) == false);
-
- return TEST_SUCCESS;
-}
-
-static test_return_t string_alloc_null(memcached_st *memc)
-{
- memcached_string_st *string;
-
- string= memcached_string_create(memc, NULL, 0);
- test_true(string);
- test_true(memcached_is_allocated(string) == true);
- test_true(memcached_is_initialized(string) == true);
- memcached_string_free(string);
-
- return TEST_SUCCESS;
-}
-
-static test_return_t string_alloc_with_size(memcached_st *memc)
-{
- memcached_string_st *string;
-
- string= memcached_string_create(memc, NULL, 1024);
- test_true(string);
- test_true(memcached_is_allocated(string) == true);
- test_true(memcached_is_initialized(string) == true);
- memcached_string_free(string);
-
- return TEST_SUCCESS;
-}
-
-static test_return_t string_alloc_with_size_toobig(memcached_st *memc)
-{
- memcached_string_st *string;
-
- string= memcached_string_create(memc, NULL, SIZE_MAX);
- test_true(string == NULL);
-
- return TEST_SUCCESS;
-}
-
-static test_return_t string_alloc_append(memcached_st *memc)
-{
- unsigned int x;
- char buffer[SMALL_STRING_LEN];
- memcached_string_st *string;
-
- /* Ring the bell! */
- memset(buffer, 6, SMALL_STRING_LEN);
-
- string= memcached_string_create(memc, NULL, 100);
- test_true(string);
- test_true(memcached_is_allocated(string) == true);
- test_true(memcached_is_initialized(string) == true);
-
- for (x= 0; x < 1024; x++)
- {
- memcached_return_t rc;
- rc= memcached_string_append(string, buffer, SMALL_STRING_LEN);
- test_true(rc == MEMCACHED_SUCCESS);
- }
- test_true(memcached_is_allocated(string) == true);
- memcached_string_free(string);
-
- return TEST_SUCCESS;
-}
-
-static test_return_t string_alloc_append_toobig(memcached_st *memc)
-{
- memcached_return_t rc;
- unsigned int x;
- char buffer[SMALL_STRING_LEN];
- memcached_string_st *string;
-
- /* Ring the bell! */
- memset(buffer, 6, SMALL_STRING_LEN);
-
- string= memcached_string_create(memc, NULL, 100);
- test_true(string);
- test_true(memcached_is_allocated(string) == true);
- test_true(memcached_is_initialized(string) == true);
-
- for (x= 0; x < 1024; x++)
- {
- rc= memcached_string_append(string, buffer, SMALL_STRING_LEN);
- test_true(rc == MEMCACHED_SUCCESS);
- }
- rc= memcached_string_append(string, buffer, SIZE_MAX);
- test_true(rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE);
- test_true(memcached_is_allocated(string) == true);
- memcached_string_free(string);
-
- return TEST_SUCCESS;
-}
-
static test_return_t cleanup_pairs(memcached_st *memc)
{
(void)memc;
{"string alloc with malloc failure", 0, (test_callback_fn)string_alloc_with_size_toobig },
{"string append", 0, (test_callback_fn)string_alloc_append },
{"string append failure (too big)", 0, (test_callback_fn)string_alloc_append_toobig },
+ {"string_alloc_append_multiple", 0, (test_callback_fn)string_alloc_append_multiple },
{0, 0, (test_callback_fn)0}
};
#include <iostream>
#include <string>
+#define BUILDING_LIBMEMCACHED
#include <libmemcached/memcached.h>
#include "tests/parser.h"
return _test_option(distribution_strings);
}
+#define SUPPORT_EXAMPLE_CNF "support/example.cnf"
+
test_return_t memcached_parse_configure_file_test(memcached_st *junk)
{
(void)junk;
+
+ if (access(SUPPORT_EXAMPLE_CNF, R_OK))
+ return TEST_SKIPPED;
+
memcached_st memc;
memcached_st *memc_ptr= memcached_create(&memc);
test_true(memc_ptr);
- memcached_return_t rc= memcached_parse_configure_file(memc_ptr, memcached_string_with_size("support/example.cnf"));
+ memcached_return_t rc= memcached_parse_configure_file(memc_ptr, memcached_string_with_size(SUPPORT_EXAMPLE_CNF));
test_true_got(rc == MEMCACHED_SUCCESS, memcached_last_error_message(memc_ptr) ? memcached_last_error_message(memc_ptr) : memcached_strerror(NULL, rc));
memcached_free(memc_ptr);
test_return_t memcached_create_with_options_with_filename(memcached_st *junk)
{
(void)junk;
+ if (access(SUPPORT_EXAMPLE_CNF, R_OK))
+ return TEST_SKIPPED;
memcached_st *memc_ptr;
memc_ptr= memcached_create_with_options(STRING_WITH_LEN("--CONFIGURE-FILE=\"support/example.cnf\""));
test_return_t libmemcached_check_configuration_with_filename_test(memcached_st *junk)
{
(void)junk;
+
+ if (access(SUPPORT_EXAMPLE_CNF, R_OK))
+ return TEST_SKIPPED;
+
memcached_return_t rc;
char buffer[BUFSIZ];
test_return_t test_include_keyword(memcached_st *junk)
{
+ if (access(SUPPORT_EXAMPLE_CNF, R_OK))
+ return TEST_SKIPPED;
+
(void)junk;
char buffer[BUFSIZ];
memcached_return_t rc;
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Gearmand client and server library.
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * 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.
+ *
+ */
+
+#include "libmemcached/common.h"
+#include "libmemcached/error.h"
+#include "tests/string.h"
+
+test_return_t string_static_null(memcached_st *memc)
+{
+ memcached_string_st string;
+ memcached_string_st *string_ptr;
+
+ string_ptr= memcached_string_create(memc, &string, 0);
+ test_true(string.options.is_initialized == true);
+ test_true(string_ptr);
+
+ /* The following two better be the same! */
+ test_true(memcached_is_allocated(string_ptr) == false);
+ test_true(memcached_is_allocated(&string) == false);
+ test_true(&string == string_ptr);
+
+ test_true(string.options.is_initialized == true);
+ test_true(memcached_is_initialized(&string) == true);
+ memcached_string_free(&string);
+ test_true(memcached_is_initialized(&string) == false);
+
+ return TEST_SUCCESS;
+}
+
+test_return_t string_alloc_null(memcached_st *memc)
+{
+ memcached_string_st *string;
+
+ string= memcached_string_create(memc, NULL, 0);
+ test_true(string);
+ test_true(memcached_is_allocated(string) == true);
+ test_true(memcached_is_initialized(string) == true);
+ memcached_string_free(string);
+
+ return TEST_SUCCESS;
+}
+
+test_return_t string_alloc_with_size(memcached_st *memc)
+{
+ memcached_string_st *string;
+
+ string= memcached_string_create(memc, NULL, 1024);
+ test_true(string);
+ test_true(memcached_is_allocated(string) == true);
+ test_true(memcached_is_initialized(string) == true);
+ memcached_string_free(string);
+
+ return TEST_SUCCESS;
+}
+
+test_return_t string_alloc_with_size_toobig(memcached_st *memc)
+{
+ memcached_string_st *string;
+
+ string= memcached_string_create(memc, NULL, SIZE_MAX);
+ test_true(string == NULL);
+
+ return TEST_SUCCESS;
+}
+
+test_return_t string_alloc_append(memcached_st *memc)
+{
+ unsigned int x;
+ char buffer[SMALL_STRING_LEN];
+ memcached_string_st *string;
+
+ /* Ring the bell! */
+ memset(buffer, 6, SMALL_STRING_LEN);
+
+ string= memcached_string_create(memc, NULL, 100);
+ test_true(string);
+ test_true(memcached_is_allocated(string) == true);
+ test_true(memcached_is_initialized(string) == true);
+
+ for (x= 0; x < 1024; x++)
+ {
+ memcached_return_t rc;
+ rc= memcached_string_append(string, buffer, SMALL_STRING_LEN);
+ test_true(rc == MEMCACHED_SUCCESS);
+ }
+ test_true(memcached_is_allocated(string) == true);
+ memcached_string_free(string);
+
+ return TEST_SUCCESS;
+}
+
+test_return_t string_alloc_append_toobig(memcached_st *memc)
+{
+ memcached_return_t rc;
+ char buffer[SMALL_STRING_LEN];
+ memcached_string_st *string;
+
+ /* Ring the bell! */
+ memset(buffer, 6, sizeof(buffer));
+
+ string= memcached_string_create(memc, NULL, 100);
+ test_true(string);
+ test_true(memcached_is_allocated(string) == true);
+ test_true(memcached_is_initialized(string) == true);
+
+ for (unsigned int x= 0; x < 1024; x++)
+ {
+ rc= memcached_string_append(string, buffer, SMALL_STRING_LEN);
+ test_true(rc == MEMCACHED_SUCCESS);
+ }
+ rc= memcached_string_append(string, buffer, SIZE_MAX);
+ test_true(rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE);
+ test_true(memcached_is_allocated(string) == true);
+ memcached_string_free(string);
+
+ return TEST_SUCCESS;
+}
+
+test_return_t string_alloc_append_multiple(memcached_st *memc)
+{
+ memcached_string_st *error_string= memcached_string_create(memc, NULL, 1024);
+ memcached_string_append(error_string, memcached_string_with_size("Error occured while parsing: "));
+ memcached_string_append(error_string, memcached_string_make_from_cstr("jog the strlen() method"));
+ memcached_string_append(error_string, memcached_string_with_size(" ("));
+
+ memcached_string_append(error_string, memcached_string_make_from_cstr(memcached_strerror(NULL, MEMCACHED_SUCCESS)));
+ memcached_string_append(error_string, memcached_string_with_size(")"));
+
+ memcached_set_error_string(memc, MEMCACHED_FAILURE, memcached_string_value(error_string), memcached_string_length(error_string));
+
+ memcached_string_free(error_string);
+
+ return TEST_SUCCESS;
+}
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Gearmand client and server library.
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * 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
+
+#include <libtest/test.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+LIBTEST_INTERNAL_API
+test_return_t string_static_null(memcached_st *memc);
+
+LIBTEST_INTERNAL_API
+test_return_t string_alloc_null(memcached_st *memc);
+
+LIBTEST_INTERNAL_API
+test_return_t string_alloc_with_size(memcached_st *memc);
+
+LIBTEST_INTERNAL_API
+test_return_t string_alloc_with_size_toobig(memcached_st *memc);
+
+LIBTEST_INTERNAL_API
+test_return_t string_alloc_append(memcached_st *memc);
+
+LIBTEST_INTERNAL_API
+test_return_t string_alloc_append_toobig(memcached_st *memc);
+
+LIBTEST_INTERNAL_API
+test_return_t string_alloc_append_multiple(memcached_st *memc);
+
+#ifdef __cplusplus
+}
+#endif