From: Brian Aker Date: Tue, 15 Jan 2013 11:36:57 +0000 (-0500) Subject: Clean up semantics for calling memcached_create() internally. X-Git-Tag: 1.0.16~6^2^2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=5ff359be5cd029608814c189c8b6d667bbd58b1c;p=m6w6%2Flibmemcached Clean up semantics for calling memcached_create() internally. --- 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)