summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2014-06-15 20:27:45 +0000
committerXavier Roche <xroche@users.noreply.github.com>2014-06-15 20:27:45 +0000
commit522af8962fcec499cfb557ae55236e5dbbbb64d9 (patch)
treed3ab54f554231c77cad922c3c722166baf5298e8
parent96a727e4fbac121323db0e0e1f56dbc543cb58e0 (diff)
Faster coucal_del_value_
-rw-r--r--src/coucal.c8
1 files changed, 5 insertions, 3 deletions
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) {