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".
This commit is contained in:
Charlie Vieth 2022-05-06 00:08:30 -04:00 committed by BenBE
parent 4b8b61fe18
commit 0388b30077

View File

@ -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++;