From 0388b30077b55fb02ac4b49ee3acc9b4d4aad577 Mon Sep 17 00:00:00 2001 From: Charlie Vieth Date: Fri, 6 May 2022 00:08:30 -0400 Subject: 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". --- Hashtable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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++; -- cgit v1.2.3