From 0b64520997ec89506895b091da4fbe84434923b0 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 29 Sep 2024 23:55:54 -0700
Subject: [PATCH] hashtable: fixed unused-parameter warnings
These show up with -Wextra when dropped into other projects.
---
src/SDL_hashtable.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/SDL_hashtable.c b/src/SDL_hashtable.c
index 63f738a9f8aaf..f2b80c4cbb182 100644
--- a/src/SDL_hashtable.c
+++ b/src/SDL_hashtable.c
@@ -495,25 +495,29 @@ static SDL_INLINE Uint32 hash_string_djbxor(const char *str, size_t len)
Uint32 SDL_HashPointer(const void *key, void *unused)
{
+ (void)unused;
return SDL_murmur3_32(&key, sizeof(key), 0);
}
bool SDL_KeyMatchPointer(const void *a, const void *b, void *unused)
{
+ (void)unused;
return (a == b);
}
-Uint32 SDL_HashString(const void *key, void *data)
+Uint32 SDL_HashString(const void *key, void *unused)
{
+ (void)unused;
const char *str = (const char *)key;
return hash_string_djbxor(str, SDL_strlen(str));
}
-bool SDL_KeyMatchString(const void *a, const void *b, void *data)
+bool SDL_KeyMatchString(const void *a, const void *b, void *unused)
{
const char *a_string = (const char *)a;
const char *b_string = (const char *)b;
+ (void)unused;
if (a == b) {
return true; // same pointer, must match.
} else if (!a || !b) {
@@ -529,20 +533,26 @@ SDL_COMPILE_TIME_ASSERT(SDL_HashID_KeySize, sizeof(Uint32) <= sizeof(const void
Uint32 SDL_HashID(const void *key, void *unused)
{
+ (void)unused;
return (Uint32)(uintptr_t)key;
}
bool SDL_KeyMatchID(const void *a, const void *b, void *unused)
{
+ (void)unused;
return (a == b);
}
void SDL_NukeFreeKey(const void *key, const void *value, void *unused)
{
+ (void)value;
+ (void)unused;
SDL_free((void *)key);
}
void SDL_NukeFreeValue(const void *key, const void *value, void *unused)
{
+ (void)key;
+ (void)unused;
SDL_free((void *)value);
}