From 2825a682f03565a21e5961fdec9b8e74e01245b9 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 29 Sep 2024 04:42:19 -0700
Subject: [PATCH] Fixed build errors
---
src/SDL_hashtable.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/SDL_hashtable.c b/src/SDL_hashtable.c
index da76b03eb60ea..6e852bf21720c 100644
--- a/src/SDL_hashtable.c
+++ b/src/SDL_hashtable.c
@@ -314,23 +314,32 @@ bool SDL_InsertIntoHashTable(SDL_HashTable *restrict table, const void *key, con
return false;
}
- return insert_item(&new_item, table->table, table->hash_mask, &table->max_probe_len);
+ // This never returns NULL
+ insert_item(&new_item, table->table, table->hash_mask, &table->max_probe_len);
+ return true;
}
-bool SDL_FindInHashTable(const SDL_HashTable *table, const void *key, const void **_value)
+bool SDL_FindInHashTable(const SDL_HashTable *table, const void *key, const void **value)
{
Uint32 hash;
SDL_HashItem *i;
if (!table) {
+ if (value) {
+ *value = NULL;
+ }
return false;
}
hash = calc_hash(table, key);
i = find_first_item(table, key, hash);
- *_value = i ? i->value : NULL;
-
- return i;
+ if (i) {
+ if (value) {
+ *value = i->value;
+ }
+ return true;
+ }
+ return false;
}
bool SDL_RemoveFromHashTable(SDL_HashTable *table, const void *key)