diff --git a/tools/tools_common.h b/tools/tools_common.h index c722d2eaf6e851bd3a2767e23b0c8f2b6efe2f58..4c7af5e213652a64c3844ac8f5376809b790be56 100644 --- a/tools/tools_common.h +++ b/tools/tools_common.h @@ -56,19 +56,19 @@ namespace Color { BG_DEFAULT = 49 }; class Modifier { - Code code; + const Code code; public: - Modifier(Code pCode) : code(pCode) {} + constexpr Modifier(Code pCode) : code(pCode) {} friend std::ostream& operator<<(std::ostream& os, const Modifier& mod) { - return os << "\033[" << mod.code << "m"; + return os << "\033[" << mod.code << 'm'; } }; } -const Color::Modifier def(Color::FG_DEFAULT); -const Color::Modifier red(Color::FG_RED); -const Color::Modifier yellow(Color::FG_YELLOW); +constexpr const Color::Modifier def(Color::FG_DEFAULT); +constexpr const Color::Modifier red(Color::FG_RED); +constexpr const Color::Modifier yellow(Color::FG_YELLOW); /** * Print va_list to std::ostream (used for logging). @@ -145,7 +145,7 @@ struct dht_params { std::pair<std::string, std::string> bootstrap {}; }; -static const struct option long_options[] = { +static const constexpr struct option long_options[] = { {"help", no_argument, nullptr, 'h'}, {"port", required_argument, nullptr, 'p'}, {"bootstrap", optional_argument, nullptr, 'b'},