From 2c9c96d6d91c2074267ef931b814f56409db038b Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Mon, 21 Jan 2008 13:08:48 -0800 Subject: [PATCH] Clean up pointer issue. --- docs/Makefile.am | 6 +++--- lib/memcached_result.c | 2 +- tests/function.c | 12 ++++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index e4cb08bf..037606ab 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -79,7 +79,7 @@ man_MANS = libmemcached.3\ memcached_strerror.3\ memcached_quit.3\ memcached_verbosity.3\ -# memcached_lib_version.3\ + memcached_lib_version.3\ memcached_version.3 libmemcached.3: libmemcached.pod @@ -259,8 +259,8 @@ memcached_result_cas.3: memcached_result_st.pod memcached_version.3: memcached_version.pod pod2man -c "libmemcached" -r "" -s 3 memcached_version.pod > memcached_version.3 -#memcached_lib_version.3: memcached_version.pod -# pod2man -c "libmemcached" -r "" -s 3 memcached_version.pod > memcached_lib_version.3 +memcached_lib_version.3: memcached_version.pod + pod2man -c "libmemcached" -r "" -s 3 memcached_version.pod > memcached_lib_version.3 memcp.1: memcp.pod pod2man -c "libmemcached" -r "" -s 1 memcp.pod > memcp.1 diff --git a/lib/memcached_result.c b/lib/memcached_result.c index 45bd3975..cf3894be 100644 --- a/lib/memcached_result.c +++ b/lib/memcached_result.c @@ -18,7 +18,7 @@ memcached_result_st *memcached_result_create(memcached_st *memc, else { if (memc->call_malloc) - ptr= (memcached_result_st *)memc->call_malloc(ptr->root, sizeof(memcached_result_st)); + ptr= (memcached_result_st *)memc->call_malloc(memc, sizeof(memcached_result_st)); else ptr= (memcached_result_st *)malloc(sizeof(memcached_result_st)); diff --git a/tests/function.c b/tests/function.c index 77a39781..320eb1da 100644 --- a/tests/function.c +++ b/tests/function.c @@ -2037,6 +2037,7 @@ memcached_return pre_hash_ketama(memcached_st *memc) return MEMCACHED_SUCCESS; } + void my_free(memcached_st *ptr, void *mem) { free(mem); @@ -2060,8 +2061,9 @@ memcached_return set_memory_alloc(memcached_st *memc) rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_MALLOC_FUNCTION, &my_malloc); assert(rc == MEMCACHED_SUCCESS); - test_ptr= (memcached_malloc_function)memcached_callback_get(memc, MEMCACHED_CALLBACK_USER_DATA, &rc); - assert(test_ptr == (memcached_malloc_function)my_malloc); + test_ptr= (memcached_malloc_function)memcached_callback_get(memc, MEMCACHED_CALLBACK_MALLOC_FUNCTION, &rc); + assert(rc == MEMCACHED_SUCCESS); + assert(test_ptr == my_malloc); } { @@ -2070,7 +2072,8 @@ memcached_return set_memory_alloc(memcached_st *memc) rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_REALLOC_FUNCTION, &my_realloc); assert(rc == MEMCACHED_SUCCESS); - test_ptr= (memcached_realloc_function)memcached_callback_get(memc, MEMCACHED_CALLBACK_USER_DATA, &rc); + test_ptr= (memcached_realloc_function)memcached_callback_get(memc, MEMCACHED_CALLBACK_REALLOC_FUNCTION, &rc); + assert(rc == MEMCACHED_SUCCESS); assert(test_ptr == my_realloc); } @@ -2080,7 +2083,8 @@ memcached_return set_memory_alloc(memcached_st *memc) rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_FREE_FUNCTION, my_free); assert(rc == MEMCACHED_SUCCESS); - test_ptr= (memcached_free_function)memcached_callback_get(memc, MEMCACHED_CALLBACK_USER_DATA, &rc); + test_ptr= (memcached_free_function)memcached_callback_get(memc, MEMCACHED_CALLBACK_FREE_FUNCTION, &rc); + assert(rc == MEMCACHED_SUCCESS); assert(test_ptr == my_free); } -- 2.30.2