review: if/else cleanup (2)

This commit is contained in:
staviq 2023-08-29 22:36:47 +02:00
parent 6fa208e157
commit f60f7d3640

View file

@ -352,8 +352,8 @@ inline FILE *_log_handler1(bool change = false, LogTriState disable = LogTriStat
// with fallback in case something went wrong // with fallback in case something went wrong
return logfile ? logfile : stderr; return logfile ? logfile : stderr;
} }
else
{ // do the (re)initialization
if (target != nullptr) if (target != nullptr)
{ {
if (logfile != nullptr && logfile != stdout && logfile != stderr) if (logfile != nullptr && logfile != stdout && logfile != stderr)
@ -386,12 +386,12 @@ inline FILE *_log_handler1(bool change = false, LogTriState disable = LogTriStat
fprintf(stderr, "Failed to open logfile '%s' with error '%s'\n", filename.c_str(), std::strerror(errno)); fprintf(stderr, "Failed to open logfile '%s' with error '%s'\n", filename.c_str(), std::strerror(errno));
fflush(stderr); fflush(stderr);
// At this point we let the init flag be to true below, and let the target fallback to stderr
// otherwise we would repeatedly fopen() which was already unsuccessful
} }
// At this point we set init flag to true, and let the target fallback to stderr
// otherwise we would repeatedly fopen() which was already unsuccessful
_initialized = true; _initialized = true;
}
return logfile ? logfile : stderr; return logfile ? logfile : stderr;
} }