Skip to content

Commit 12a311e

Browse files
committed
use constexpr in Core where possible
1 parent f1ebe14 commit 12a311e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

library/Core.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ uint32_t PerfCounters::getUnpausedFps() {
201201

202202
struct CommandDepthCounter
203203
{
204-
static const int MAX_DEPTH = 20;
204+
static constexpr int MAX_DEPTH = 20;
205205
static thread_local int depth;
206206
CommandDepthCounter() { depth++; }
207207
~CommandDepthCounter() { depth--; }
@@ -902,8 +902,8 @@ command_result Core::runCommand(color_ostream &con, const std::string &first_, s
902902
}
903903
else if (first == "plug")
904904
{
905-
const char *header_format = "%30s %10s %4s %8s\n";
906-
const char *row_format = "%30s %10s %4i %8s\n";
905+
constexpr auto header_format = "%30s %10s %4s %8s\n";
906+
constexpr auto row_format = "%30s %10s %4i %8s\n";
907907
con.print(header_format, "Name", "State", "Cmds", "Enabled");
908908

909909
plug_mgr->refresh();
@@ -1601,7 +1601,7 @@ bool Core::InitMainThread() {
16011601
{
16021602
if (!Version::git_xml_match())
16031603
{
1604-
const char *msg = (
1604+
constexpr auto msg = (
16051605
"*******************************************************\n"
16061606
"* BIG, UGLY ERROR MESSAGE *\n"
16071607
"*******************************************************\n"
@@ -2166,7 +2166,7 @@ static void getFilesWithPrefixAndSuffix(const std::filesystem::path& folder, con
21662166
}
21672167

21682168
size_t loadScriptFiles(Core* core, color_ostream& out, const std::span<const std::string> prefix, const std::filesystem::path& folder) {
2169-
static const std::string suffix = ".init";
2169+
static constexpr std::string suffix = ".init";
21702170
std::vector<std::filesystem::path> scriptFiles;
21712171
for ( const auto& p : prefix ) {
21722172
getFilesWithPrefixAndSuffix(folder, p, ".init", scriptFiles);

0 commit comments

Comments
 (0)