From f6e83e64abbf76bbfddc90f885f7c3be379ecf2c Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Sun, 14 Jul 2019 18:41:07 +0100 Subject: Various improvements around HASH nodes The example previously would lead to corrupt memory when running for items that needed to re-hash the hash array. This has been fixed. Secondly, all HASH node memory leaks are now fixed, that resulted from badly tracking objects through the resize process. A new function `hash_free_shallow` was added to help with this. The function `array_free_shallow` is unused but might become useful in the future and so was not removed. The hash strategy is still garbage but this can be fixed later :) --- utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils.c') diff --git a/utils.c b/utils.c index f08c670..0979d07 100644 --- a/utils.c +++ b/utils.c @@ -49,7 +49,7 @@ err_t _array_remove(void **ptr, size_t idx, size_t len, void **out) err_t _hash(char *str, size_t len, size_t *out) { CHECK(str, INVALID_PARAMS) - CHECK((len < 0), INVALID_PARAMS) + CHECK((len > 0), INVALID_PARAMS) // Implements the "murmur" non-cryptographic hash -- cgit v1.2.3