Skip to content

Commit

Permalink
hashtable: fixed unused-parameter warnings
Browse files Browse the repository at this point in the history
These show up with -Wextra when dropped into other projects.
  • Loading branch information
slouken committed Sep 30, 2024
1 parent 1787d6c commit 0b64520
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/SDL_hashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}

0 comments on commit 0b64520

Please sign in to comment.