From 522af8962fcec499cfb557ae55236e5dbbbb64d9 Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Sun, 15 Jun 2014 20:27:45 +0000 Subject: Faster coucal_del_value_ --- src/coucal.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/coucal.c b/src/coucal.c index e84c512..82dfeff 100644 --- a/src/coucal.c +++ b/src/coucal.c @@ -765,9 +765,11 @@ static void coucal_default_free_handler(coucal_opaque arg, } static INTHASH_INLINE void coucal_del_value_(coucal hashtable, coucal_value *pvalue) { - if (hashtable->custom.value.free != NULL) - hashtable->custom.value.free(hashtable->custom.value.arg, *pvalue); - pvalue->ptr = NULL; + if (pvalue->ptr != NULL) { + if (hashtable->custom.value.free != NULL) + hashtable->custom.value.free(hashtable->custom.value.arg, *pvalue); + pvalue->ptr = NULL; + } } static INTHASH_INLINE void coucal_del_value(coucal hashtable, size_t pos) { -- cgit v1.2.3