SDL_image: xpm: Remove QUICK_COLORHASH, replace it with inline code that checks for NULL. (79751)

From 79751ddfbd4153c8f3c5dc54d34f98f11f6d7d7d Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Mon, 6 Apr 2026 14:24:56 -0400
Subject: [PATCH] xpm: Remove QUICK_COLORHASH, replace it with inline code that
 checks for NULL.

Closes #721.

(manual backport of commit a57a26472f717ea3ee0055dc44b0a6b374c23d9b)
---
 IMG_xpm.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/IMG_xpm.c b/IMG_xpm.c
index cc87d4c0b..db6171aa6 100644
--- a/IMG_xpm.c
+++ b/IMG_xpm.c
@@ -159,9 +159,6 @@ static int add_colorhash(struct color_hash *hash,
 	return 1;
 }
 
-/* fast lookup that works if cpp == 1 */
-#define QUICK_COLORHASH(hash, key) ((hash)->table[*(Uint8 *)(key)]->color)
-
 static Uint32 get_colorhash(struct color_hash *hash, const char *key, int cpp)
 {
 	struct hash_entry *entry = hash->table[hash_key(key, cpp, hash->size)];
@@ -469,9 +466,11 @@ static SDL_Surface *load_xpm(char **xpm, SDL_RWops *src)
 		if(indexed) {
 			/* optimization for some common cases */
 			if(cpp == 1)
-				for(x = 0; x < w; x++)
-					dst[x] = (Uint8)QUICK_COLORHASH(colors,
-								 line + x);
+				for (x = 0; x < w; x++) {
+					/* fast lookup that works if cpp == 1 */
+					const struct hash_entry *entry = colors->table[*(Uint8 *)(line + x)];
+					dst[x] = entry ? (Uint8) entry->color : 0;
+				}
 			else
 				for(x = 0; x < w; x++)
 					dst[x] = (Uint8)get_colorhash(colors,