X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fmemcached.c;h=1144115f6a6e3d9cde4525a7a1742bde33f27b1c;hb=5dc8e84eaf174fe510c2d253271215cd724be718;hp=accf24b717dc073dc530263445c784ea0896b1ba;hpb=c4b0fc53b348067c6a6e5eaf335869393cf347bf;p=m6w6%2Flibmemcached diff --git a/libmemcached/memcached.c b/libmemcached/memcached.c index accf24b7..1144115f 100644 --- a/libmemcached/memcached.c +++ b/libmemcached/memcached.c @@ -15,7 +15,7 @@ memcached_st *memcached_create(memcached_st *ptr) return NULL; /* MEMCACHED_MEMORY_ALLOCATION_FAILURE */ memset(ptr, 0, sizeof(memcached_st)); - ptr->is_allocated= MEMCACHED_ALLOCATED; + ptr->is_allocated= true; } else { @@ -28,8 +28,9 @@ memcached_st *memcached_create(memcached_st *ptr) ptr->retry_timeout= 0; ptr->distribution= MEMCACHED_DISTRIBUTION_MODULA; - ptr->io_msg_watermark = 500; - ptr->io_bytes_watermark = 65 * 1024; + /* TODO, Document why we picked these defaults */ + ptr->io_msg_watermark= 500; + ptr->io_bytes_watermark= 65 * 1024; return ptr; } @@ -52,7 +53,7 @@ void memcached_free(memcached_st *ptr) free(ptr->continuum); } - if (ptr->is_allocated == MEMCACHED_ALLOCATED) + if (ptr->is_allocated) { if (ptr->call_free) ptr->call_free(ptr, ptr); @@ -60,7 +61,7 @@ void memcached_free(memcached_st *ptr) free(ptr); } else - ptr->is_allocated= MEMCACHED_USED; + memset(ptr, 0, sizeof(memcached_st)); } /* @@ -76,7 +77,7 @@ memcached_st *memcached_clone(memcached_st *clone, memcached_st *source) if (source == NULL) return memcached_create(clone); - if (clone && clone->is_allocated == MEMCACHED_USED) + if (clone && clone->is_allocated) { return NULL; }