From db7bd7a90044e737fbfbf0bda5930dbec3756fe8 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Thu, 29 Jan 2026 21:46:58 +0200 Subject: [PATCH] mu-utils: replace #define with constexpr for MU_COLOR_ --- lib/utils/mu-utils.cc | 2 -- lib/utils/mu-utils.hh | 15 +++++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/utils/mu-utils.cc b/lib/utils/mu-utils.cc index f08e6ea0..bb7ae270 100644 --- a/lib/utils/mu-utils.cc +++ b/lib/utils/mu-utils.cc @@ -675,8 +675,6 @@ Mu::summarize(const std::string& str, size_t max_lines) } - - static bool locale_is_utf8 (void) { diff --git a/lib/utils/mu-utils.hh b/lib/utils/mu-utils.hh index 3b6f45ab..3e8d3dcc 100644 --- a/lib/utils/mu-utils.hh +++ b/lib/utils/mu-utils.hh @@ -665,14 +665,13 @@ private: const bool color_; }; -#define MU_COLOR_RED "\x1b[31m" -#define MU_COLOR_GREEN "\x1b[32m" -#define MU_COLOR_YELLOW "\x1b[33m" -#define MU_COLOR_BLUE "\x1b[34m" -#define MU_COLOR_MAGENTA "\x1b[35m" -#define MU_COLOR_CYAN "\x1b[36m" -#define MU_COLOR_DEFAULT "\x1b[0m" - +constexpr auto MU_COLOR_RED = "\x1b[31m"; +constexpr auto MU_COLOR_GREEN = "\x1b[32m"; +constexpr auto MU_COLOR_YELLOW = "\x1b[33m"; +constexpr auto MU_COLOR_BLUE = "\x1b[34m"; +constexpr auto MU_COLOR_MAGENTA = "\x1b[35m"; +constexpr auto MU_COLOR_CYAN = "\x1b[36m"; +constexpr auto MU_COLOR_DEFAULT = "\x1b[0m"; template // like C++23 std::to_underlying constexpr std::underlying_type_t to_ut( Enum e ) noexcept {