From 5ff359be5cd029608814c189c8b6d667bbd58b1c Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Tue, 15 Jan 2013 06:36:57 -0500 Subject: [PATCH] Clean up semantics for calling memcached_create() internally. --- libmemcached/memcached.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libmemcached/memcached.cc b/libmemcached/memcached.cc index 932b8986..a5d1a527 100644 --- a/libmemcached/memcached.cc +++ b/libmemcached/memcached.cc @@ -172,38 +172,38 @@ static void __memcached_free(Memcached *ptr, bool release_st) memcached_st *memcached_create(memcached_st *shell) { - Memcached* ptr= memcached2Memcached(shell); - if (ptr) + if (shell) { - ptr->options.is_allocated= false; + shell->options.is_allocated= false; } else { - ptr= (memcached_st *)libmemcached_xmalloc(NULL, memcached_st); + shell= (memcached_st *)libmemcached_xmalloc(NULL, memcached_st); - if (ptr == NULL) + if (shell == NULL) { return NULL; /* MEMCACHED_MEMORY_ALLOCATION_FAILURE */ } - ptr->options.is_allocated= true; + shell->options.is_allocated= true; } - if (_memcached_init(ptr) == false) + if (_memcached_init(shell) == false) { - memcached_free(ptr); + memcached_free(shell); return NULL; } - if (memcached_result_create(ptr, &ptr->result) == NULL) + Memcached* memc= memcached2Memcached(shell); + if (memcached_result_create(shell, &memc->result) == NULL) { - memcached_free(ptr); + memcached_free(shell); return NULL; } - WATCHPOINT_ASSERT_INITIALIZED(&ptr->result); + WATCHPOINT_ASSERT_INITIALIZED(&memc->result); - return ptr; + return shell; } memcached_st *memcached(const char *string, size_t length) -- 2.30.2