#include <libmemcached/common.h>
+#include <cassert>
inline static memcached_return_t _string_check(memcached_string_st *string, size_t need)
{
return self;
}
+static memcached_return_t memcached_string_append_null(memcached_string_st *string)
+{
+ if (memcached_failed(_string_check(string, 1)))
+ {
+ return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
+ }
+
+ *string->end= 0;
+
+ return MEMCACHED_SUCCESS;
+}
+
memcached_return_t memcached_string_append_character(memcached_string_st *string,
char character)
{
return self->string;
}
+char *memcached_string_take_value(memcached_string_st *self)
+{
+ assert(self);
+ // If we fail at adding the null, we copy and move on
+ if (memcached_success(memcached_string_append_null(self)))
+ {
+ return memcached_string_c_copy(self);
+ }
+
+ char *value= self->string;
+
+ _init_string(self);
+
+ return value;
+}
+
char *memcached_string_value_mutable(const memcached_string_st *self)
{
return self->string;