summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharlie Vieth <charlie.vieth@gmail.com>2022-05-06 00:08:30 -0400
committerBenBE <BenBE@geshi.org>2022-05-06 06:34:17 +0200
commit0388b30077b55fb02ac4b49ee3acc9b4d4aad577 (patch)
tree31617aa05ff5ed96e10bf0aeeb9776c2475e3040
parent4b8b61fe183cd6d8b5e6e01127742b0c24884ac4 (diff)
Hashtable: fix handling of NULL pointer in Hashtable_dump
This fixes an issus in Hashtable_dump where `"(nil"` is passed as an argument to `%p` in fprintf. This prints the static address of `"(nil)"` not "(nil)". This commit changes the code to just pass the NULL pointer to fprintf, which will consistently print "0x0".
-rw-r--r--Hashtable.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Hashtable.c b/Hashtable.c
index a0cfc9e0..2756b232 100644
--- a/Hashtable.c
+++ b/Hashtable.c
@@ -52,7 +52,7 @@ static void Hashtable_dump(const Hashtable* this) {
i,
this->buckets[i].key,
this->buckets[i].probe,
- this->buckets[i].value ? (const void*)this->buckets[i].value : "(nil)");
+ this->buckets[i].value);
if (this->buckets[i].value)
items++;

© 2014-2022 Faster IT GmbH | imprint | privacy policy