From 5afeb11f9a0189f1bf3d95ac0059448098c93857 Mon Sep 17 00:00:00 2001 From: Yay295 Date: Mon, 22 Apr 2024 15:25:40 -0500 Subject: [PATCH] fix findRawMode() and change findMode() to match --- src/libImaging/Mode.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/libImaging/Mode.c b/src/libImaging/Mode.c index 8d651b06d..04e843d32 100644 --- a/src/libImaging/Mode.c +++ b/src/libImaging/Mode.c @@ -68,10 +68,9 @@ const Mode * const MODES[] = { }; const Mode * findMode(const char * const name) { - int i = 0; const Mode * mode; - while ((mode = MODES[i++]) != NULL) { - if (!strcmp(mode->name, name)) { + for (int i = 0; (mode = MODES[i]); i++) { + if (strcmp(mode->name, name) == 0) { return mode; } } @@ -434,11 +433,9 @@ const RawMode * const RAWMODES[] = { }; const RawMode * findRawMode(const char * const name) { - int i = 0; const RawMode * rawmode; - while ((rawmode = RAWMODES[i++]) != NULL) { - const RawMode * const rawmode = RAWMODES[i]; - if (!strcmp(rawmode->name, name)) { + for (int i = 0; (rawmode = RAWMODES[i]); i++) { + if (strcmp(rawmode->name, name) == 0) { return rawmode; } }