X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fresult.c;h=6e58eebd998f2f2f2362f1a018b8db2cb1fb72ec;hb=18ace40ddb7271f3f5e71965f74fe11d7754bd8f;hp=dae53bf7ec8875675e6e33bdf21c5ac6287f32a3;hpb=26c65ac524f21cd73a79f3caf45cdb76c9a41bc0;p=awesomized%2Flibmemcached diff --git a/libmemcached/result.c b/libmemcached/result.c index dae53bf7..6e58eebd 100644 --- a/libmemcached/result.c +++ b/libmemcached/result.c @@ -18,7 +18,7 @@ #include "common.h" static inline void _result_init(memcached_result_st *self, - const memcached_st *memc) + memcached_st *memc) { self->item_flags= 0; self->item_expiration= 0; @@ -50,9 +50,8 @@ memcached_result_st *memcached_result_create(const memcached_st *memc, ptr->options.is_initialized= true; - _result_init(ptr, memc); + _result_init(ptr, (memcached_st *)memc); - ptr->root= memc; WATCHPOINT_SET(ptr->value.options.is_initialized= false); memcached_string_create(memc, &ptr->value, 0); WATCHPOINT_ASSERT_INITIALIZED(&ptr->value); @@ -92,7 +91,14 @@ memcached_return_t memcached_result_set_value(memcached_result_st *ptr, const char *value, size_t length) { - return memcached_string_append(&ptr->value, value, length); + memcached_return_t rc= memcached_string_append(&ptr->value, value, length); + + if (rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE) + { + memcached_set_errno(ptr->root, errno, NULL); + } + + return rc; } const char *memcached_result_key_value(const memcached_result_st *self)