From f218400d3b75ee1cf537e2ca9db23bc417475c10 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 28 Dec 2018 20:45:45 -0800 Subject: GLK: Simplify arrays of valid extensions in detection code Suggested by Sev as a way to avoid having both arrays and array sizes --- engines/glk/glulxe/detection.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/glk/glulxe') diff --git a/engines/glk/glulxe/detection.cpp b/engines/glk/glulxe/detection.cpp index fb701131ef..09b6e97d0b 100644 --- a/engines/glk/glulxe/detection.cpp +++ b/engines/glk/glulxe/detection.cpp @@ -46,7 +46,7 @@ GlulxeDescriptor GlulxeMetaEngine::findGame(const char *gameId) { } bool GlulxeMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) { - const char *const EXTENSIONS[3] = { ".ulx", ".blb", ".gblorb" }; + const char *const EXTENSIONS[] = { ".ulx", ".blb", ".gblorb", nullptr }; // Loop through the files of the folder for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { @@ -55,8 +55,8 @@ bool GlulxeMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames & continue; Common::String filename = file->getName(); bool hasExt = false; - for (int idx = 0; idx < 3 && !hasExt; ++idx) - hasExt = filename.hasSuffixIgnoreCase(EXTENSIONS[idx]); + for (const char *const *ext = &EXTENSIONS[0]; *ext && !hasExt; ++ext) + hasExt = filename.hasSuffixIgnoreCase(*ext); if (!hasExt) continue; -- cgit v1.2.3