From: Arnaud Giersch Date: Fri, 16 Oct 2020 20:02:10 +0000 (+0200) Subject: Use std::array and reduce scope for constant. X-Git-Tag: v3.26~289 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b55b6bd29170178567ebf96349a977b717bc5f4c Use std::array and reduce scope for constant. --- diff --git a/src/mc/mc_request.cpp b/src/mc/mc_request.cpp index 53428fdc89..94d0d91950 100644 --- a/src/mc/mc_request.cpp +++ b/src/mc/mc_request.cpp @@ -10,6 +10,7 @@ #include "src/mc/ModelChecker.hpp" #include "src/mc/checker/SimcallInspector.hpp" #include "src/mc/mc_smx.hpp" +#include using simgrid::mc::remote; @@ -386,14 +387,12 @@ bool request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx) return comm->src_actor_.get() && comm->dst_actor_.get(); } -static const char* colors[] = { - "blue", "red", "green3", "goldenrod", "brown", "purple", "magenta", - "turquoise4", "gray25", "forestgreen", "hotpink", "lightblue", "tan", -}; - static inline const char* get_color(int id) { - return colors[id % (sizeof(colors) / sizeof(colors[0])) ]; + static constexpr std::array colors{{"blue", "red", "green3", "goldenrod", "brown", "purple", + "magenta", "turquoise4", "gray25", "forestgreen", "hotpink", + "lightblue", "tan"}}; + return colors[id % colors.size()]; } std::string request_get_dot_output(smx_simcall_t req, int value)