return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
}
- value_ptr= memcached_string_value(&result->value);
+ value_ptr= memcached_string_value_mutable(&result->value);
/*
We read the \r\n into the string since not doing so is more
cycles then the waster of memory to do so.
/* This next bit blows the API, but this is internal....*/
{
char *char_ptr;
- char_ptr= memcached_string_value(&result->value);;
+ char_ptr= memcached_string_value_mutable(&result->value);;
char_ptr[value_length]= 0;
char_ptr[value_length + 1]= 0;
memcached_string_set_length(&result->value, value_length);
bodylen) != MEMCACHED_SUCCESS)
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
- char *vptr= memcached_string_value(&result->value);
+ char *vptr= memcached_string_value_mutable(&result->value);
if (memcached_safe_read(ptr, vptr, bodylen) != MEMCACHED_SUCCESS)
return MEMCACHED_UNKNOWN_READ_FAILURE;
} options;
};
-#define memcached_string_length(A) (size_t)((A)->end - (A)->string)
+static inline size_t memcached_string_length(const memcached_string_st *self)
+{
+ return (size_t)(self->end - self->string);
+}
+
+static inline size_t memcached_string_size(const memcached_string_st *self)
+{
+ return self->current_size;
+}
+
+static inline const char *memcached_string_value(const memcached_string_st *self)
+{
+ return self->string;
+}
+
+static inline char *memcached_string_value_mutable(const memcached_string_st *self)
+{
+ return self->string;
+}
+
#define memcached_string_set_length(A, B) (A)->end= (A)->string + B
-#define memcached_string_size(A) (A)->current_size
-#define memcached_string_value(A) (A)->string
LIBMEMCACHED_LOCAL
memcached_string_st *memcached_string_create(const memcached_st *ptr,