mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Avoid calling style_Set/Reset before strerror(errno),
since they may call `isatty` which can change `errno` Fixes #1857
This commit is contained in:
@@ -3,17 +3,14 @@
|
||||
#ifndef RGBDS_VERBOSITY_HPP
|
||||
#define RGBDS_VERBOSITY_HPP
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "style.hpp"
|
||||
|
||||
// This macro does not evaluate its arguments unless the condition is true.
|
||||
#define verbosePrint(level, ...) \
|
||||
do { \
|
||||
if (checkVerbosity(level)) { \
|
||||
style_Set(stderr, STYLE_MAGENTA, false); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
style_Reset(stderr); \
|
||||
printVerbosely(__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -30,6 +27,9 @@ enum Verbosity {
|
||||
void incrementVerbosity();
|
||||
bool checkVerbosity(Verbosity level);
|
||||
|
||||
[[gnu::format(printf, 1, 2)]]
|
||||
void printVerbosely(char const *fmt, ...);
|
||||
|
||||
void printVVVVVVerbosity();
|
||||
|
||||
#endif // RGBDS_VERBOSITY_HPP
|
||||
|
||||
Reference in New Issue
Block a user