X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fmemcached_result.c;h=1462b89c3ef42e446162e44842931800bfbfcba7;hb=20b4431225d4ccd4aa22f6d7f67476c92d1c9546;hp=0860e792e528f6ae3de02b725e03a8ce27454fa2;hpb=2b312deb8b7b3f662b492f94a13e673723387724;p=m6w6%2Flibmemcached diff --git a/libmemcached/memcached_result.c b/libmemcached/memcached_result.c index 0860e792..1462b89c 100644 --- a/libmemcached/memcached_result.c +++ b/libmemcached/memcached_result.c @@ -11,27 +11,19 @@ memcached_result_st *memcached_result_create(memcached_st *memc, { /* Saving malloc calls :) */ if (ptr) - { memset(ptr, 0, sizeof(memcached_result_st)); - ptr->is_allocated= MEMCACHED_NOT_ALLOCATED; - } else { - if (memc->call_malloc) - ptr= (memcached_result_st *)memc->call_malloc(memc, sizeof(memcached_result_st)); - else - ptr= (memcached_result_st *)malloc(sizeof(memcached_result_st)); + ptr= memc->call_malloc(memc, sizeof(memcached_result_st)); if (ptr == NULL) return NULL; - memset(ptr, 0, sizeof(memcached_result_st)); - ptr->is_allocated= MEMCACHED_ALLOCATED; + ptr->is_allocated= true; } ptr->root= memc; memcached_string_create(memc, &ptr->value, 0); WATCHPOINT_ASSERT(ptr->value.string == NULL); - WATCHPOINT_ASSERT(ptr->value.is_allocated == MEMCACHED_NOT_ALLOCATED); return ptr; } @@ -60,8 +52,6 @@ void memcached_result_free(memcached_result_st *ptr) memcached_string_free(&ptr->value); - if (ptr->is_allocated == MEMCACHED_ALLOCATED) + if (ptr->is_allocated) free(ptr); - else - ptr->is_allocated= MEMCACHED_USED; }