From ed3d7e83a8f9445b8fb4eb49b1bd088744abc645 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Fri, 7 Oct 2011 12:00:39 -0700 Subject: [PATCH] Fix build warning on OSX. --- .bzrignore | 6 +----- libmemcached/virtual_bucket.c | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.bzrignore b/.bzrignore index dedeb4cb..b226418b 100644 --- a/.bzrignore +++ b/.bzrignore @@ -86,11 +86,7 @@ libtest/unittest libtest/version.h libtest/wait libtool -libtool.m4 -ltoptions.m4 -ltsugar.m4 -ltversion.m4 -lt~obsolete.m4 +m4/libtool.m4 m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 diff --git a/libmemcached/virtual_bucket.c b/libmemcached/virtual_bucket.c index f91bf454..8af3a72f 100644 --- a/libmemcached/virtual_bucket.c +++ b/libmemcached/virtual_bucket.c @@ -35,7 +35,6 @@ * */ -#include #include struct bucket_t { @@ -65,8 +64,11 @@ memcached_return_t memcached_virtual_bucket_create(memcached_st *self, struct memcached_virtual_bucket_t *virtual_bucket= (struct memcached_virtual_bucket_t *)malloc(sizeof(struct memcached_virtual_bucket_t) + sizeof(struct bucket_t) *buckets); - if (! virtual_bucket) + if (virtual_bucket == NULL) + { return MEMCACHED_MEMORY_ALLOCATION_FAILURE; + } + virtual_bucket->size= buckets; virtual_bucket->replicas= replicas; @@ -85,18 +87,21 @@ memcached_return_t memcached_virtual_bucket_create(memcached_st *self, virtual_bucket->buckets[x].forward= 0; } } - return MEMCACHED_SUCCESS; } void memcached_virtual_bucket_free(memcached_st *self) { - if (! self) + if (self == NULL) + { return; + } - if (! self->virtual_bucket) + if (self->virtual_bucket == NULL) + { return; + } free(self->virtual_bucket); self->virtual_bucket= NULL; @@ -104,11 +109,15 @@ void memcached_virtual_bucket_free(memcached_st *self) uint32_t memcached_virtual_bucket_get(const memcached_st *self, uint32_t digest) { - if (! self) + if (self == NULL) + { return 0; + } - if (! self->virtual_bucket) + if (self->virtual_bucket == NULL) + { return 0; + } if (self->virtual_bucket) { -- 2.30.2