2 memcached_result_st are used to internally represent the return values from
3 memcached. We use a structure so that long term as identifiers are added
4 to memcached we will be able to absorb new attributes without having
5 to addjust the entire API.
9 memcached_result_st
*memcached_result_create(memcached_st
*memc
,
10 memcached_result_st
*ptr
)
12 WATCHPOINT_ASSERT(memc
&& memc
->options
.is_initialized
);
14 /* Saving malloc calls :) */
17 memset(ptr
, 0, sizeof(memcached_result_st
));
21 ptr
= memc
->call_malloc(memc
, sizeof(memcached_result_st
));
25 ptr
->options
.is_allocated
= true;
28 ptr
->options
.is_initialized
= true;
31 memcached_string_create(memc
, &ptr
->value
, 0);
32 WATCHPOINT_ASSERT_INITIALIZED(&ptr
->value
);
33 WATCHPOINT_ASSERT(ptr
->value
.string
== NULL
);
38 void memcached_result_reset(memcached_result_st
*ptr
)
41 memcached_string_reset(&ptr
->value
);
50 memcached_return
memcached_result_set_value(memcached_result_st
*ptr
, const char *value
, size_t length
)
52 return memcached_string_append(&ptr
->value
, value
, length
);
55 void memcached_result_free(memcached_result_st
*ptr
)
60 memcached_string_free(&ptr
->value
);
62 if (memcached_is_allocated(ptr
))
68 ptr
->options
.is_initialized
= false;