Skip to content

Commit 122091b

Browse files
committed
replaced raw loop with find_if
1 parent 45f8a51 commit 122091b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/dvisvgm.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,11 @@ static void init_fontmap (const CommandLine &cmdline) {
293293
mapseq = cmdline.fontmapOpt.value();
294294
bool additional = !mapseq.empty() && strchr("+-=", mapseq[0]);
295295
if (mapseq.empty() || additional) {
296-
bool found = false;
297-
for (string mapfile : {"dvisvgm", "ps2pk", "pdftex", "dvipdfm", "psfonts"}) {
298-
if ((found = FontMap::instance().read(mapfile+".map")))
299-
break;
300-
}
301-
if (!found)
296+
string mapfiles[] = {"dvisvgm", "ps2pk", "pdftex", "dvipdfm", "psfonts"};
297+
auto it = algo::find_if(mapfiles, [](const string &mapfile) {
298+
return FontMap::instance().read(mapfile+".map");
299+
});
300+
if (it == std::end(mapfiles))
302301
Message::wstream(true) << "none of the default map files could be found\n";
303302
}
304303
if (!mapseq.empty())

0 commit comments

Comments
 (0)