From 7034bc6fb336183c620bfc69916db953707ad2b8 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 20 May 2025 20:34:48 +0200 Subject: [PATCH] fix some hashtable warnings --- src/hashtable.c | 20 +++++++++++++------- src/p_mobj.c | 1 + 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/hashtable.c b/src/hashtable.c index 678417299..cb26f8dd3 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -215,14 +215,19 @@ hashtable* hashtable_Create(void) { return table; } -void hashtable_Destroy(hashtable* table) { +void hashtable_Destroy(hashtable* table) +{ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-qual" // First free allocated keys. - for (size_t i = 0; i < table->capacity; i++) { - if (table->entries[i].key != NULL) { + for (size_t i = 0; i < table->capacity; i++) + { + if (table->entries[i].key != NULL) + { free((void*)table->entries[i].key); } } - +#pragma GCC diagnostic pop // Then free entries array and table itself. free(table->entries); free(table); @@ -293,7 +298,7 @@ static const char* ht_set_entry(ht_entry* entries, size_t capacity, } (*plength)++; } - entries[index].key = (char*)key; + entries[index].key = (const char*)key; entries[index].value = value; return key; } @@ -349,12 +354,13 @@ size_t hashtable_Length(hashtable* table) { return table->length; } -hashtable_iterator ht_iterator(hashtable* table) { +/*static hashtable_iterator ht_iterator(hashtable* table) +{ hashtable_iterator it; it._table = table; it._index = 0; return it; -} +}*/ boolean hashtable_Next(hashtable_iterator* it) { // Loop till we've hit end of entries array. diff --git a/src/p_mobj.c b/src/p_mobj.c index 8c63a67c7..4c40b2593 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10267,6 +10267,7 @@ void P_RemoveSavegameMobj(mobj_t *mobj, boolean preserveLevel) // stop any playing sound if (!preserveLevel) S_StopSound(mobj); + R_RemoveMobjInterpolator(mobj); // just set its reference count to 0 to not trigger the assert in P_UnlinkThinker