fix findRawMode()

and change findMode() to match
This commit is contained in:
Yay295 2024-04-22 15:25:40 -05:00
parent b594a756da
commit 5afeb11f9a

View File

@ -68,10 +68,9 @@ const Mode * const MODES[] = {
}; };
const Mode * findMode(const char * const name) { const Mode * findMode(const char * const name) {
int i = 0;
const Mode * mode; const Mode * mode;
while ((mode = MODES[i++]) != NULL) { for (int i = 0; (mode = MODES[i]); i++) {
if (!strcmp(mode->name, name)) { if (strcmp(mode->name, name) == 0) {
return mode; return mode;
} }
} }
@ -434,11 +433,9 @@ const RawMode * const RAWMODES[] = {
}; };
const RawMode * findRawMode(const char * const name) { const RawMode * findRawMode(const char * const name) {
int i = 0;
const RawMode * rawmode; const RawMode * rawmode;
while ((rawmode = RAWMODES[i++]) != NULL) { for (int i = 0; (rawmode = RAWMODES[i]); i++) {
const RawMode * const rawmode = RAWMODES[i]; if (strcmp(rawmode->name, name) == 0) {
if (!strcmp(rawmode->name, name)) {
return rawmode; return rawmode;
} }
} }