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 /* Saving malloc calls :) */
15 memset(ptr
, 0, sizeof(memcached_result_st
));
16 ptr
->is_allocated
= MEMCACHED_NOT_ALLOCATED
;
20 if (memc
->call_malloc
)
21 ptr
= (memcached_result_st
*)memc
->call_malloc(memc
, sizeof(memcached_result_st
));
23 ptr
= (memcached_result_st
*)malloc(sizeof(memcached_result_st
));
27 memset(ptr
, 0, sizeof(memcached_result_st
));
28 ptr
->is_allocated
= MEMCACHED_ALLOCATED
;
32 memcached_string_create(memc
, &ptr
->value
, 0);
33 WATCHPOINT_ASSERT(ptr
->value
.string
== NULL
);
34 WATCHPOINT_ASSERT(ptr
->value
.is_allocated
== MEMCACHED_NOT_ALLOCATED
);
39 void memcached_result_free(memcached_result_st
*ptr
)
44 memcached_string_free(&ptr
->value
);
46 if (ptr
->is_allocated
== MEMCACHED_ALLOCATED
)
49 ptr
->is_allocated
= MEMCACHED_USED
;