From dd52ad5dfd53dc9ef17c59fc232204c8309d4553 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Tue, 12 Sep 2023 19:53:25 +0100 Subject: [PATCH] Fix use of inline/static Some instances of both were unnecessary, some statics were turned into inlines. --- src/api/helpers/text.cpp | 6 +++--- src/api/helpers/text.h | 4 ++-- src/tests/api/internals/metadata_list_test.h | 4 ++-- src/tests/common_game_test_fixture.h | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/api/helpers/text.cpp b/src/api/helpers/text.cpp index b42ea107..933b74e3 100644 --- a/src/api/helpers/text.cpp +++ b/src/api/helpers/text.cpp @@ -37,14 +37,14 @@ namespace loot { /* The string below matches timestamps that use forwardslashes for date separators. However, Pseudosem v1.0.1 will only compare the first two digits as it does not recognise forwardslashes as separators. */ -static constexpr const char* dateRegex = +constexpr const char* dateRegex = R"((\d{1,2}/\d{1,2}/\d{1,4} \d{1,2}:\d{1,2}:\d{1,2}))"; /* The string below matches the range of version strings supported by Pseudosem v1.0.1, excluding space separators, as they make version extraction from inside sentences very tricky and have not been seen "in the wild". */ -static constexpr const char* pseudosemVersionRegex = +constexpr const char* pseudosemVersionRegex = R"((\d+(?:\.\d+)+(?:[-._:]?[A-Za-z0-9]+)*))" // The string below prevents version numbers followed by a comma from // matching. @@ -53,7 +53,7 @@ static constexpr const char* pseudosemVersionRegex = /* The string below matches a number containing one or more digits found at the start of the search string or preceded by 'v' or 'version:. */ -static constexpr const char* digitsVersionRegex = R"((?:^|v|version:\s*)(\d+))"; +constexpr const char* digitsVersionRegex = R"((?:^|v|version:\s*)(\d+))"; std::vector ExtractBashTags(const std::string& description) { std::vector tags; diff --git a/src/api/helpers/text.h b/src/api/helpers/text.h index a8ab27a2..bdf93548 100644 --- a/src/api/helpers/text.h +++ b/src/api/helpers/text.h @@ -32,8 +32,8 @@ #include "loot/metadata/tag.h" namespace loot { -static constexpr const char* GHOST_FILE_EXTENSION = ".ghost"; -static constexpr std::size_t GHOST_FILE_EXTENSION_LENGTH = +inline constexpr const char* GHOST_FILE_EXTENSION = ".ghost"; +inline constexpr std::size_t GHOST_FILE_EXTENSION_LENGTH = std::char_traits::length(GHOST_FILE_EXTENSION); std::vector ExtractBashTags(const std::string& description); diff --git a/src/tests/api/internals/metadata_list_test.h b/src/tests/api/internals/metadata_list_test.h index 8eeb5896..966ff24c 100644 --- a/src/tests/api/internals/metadata_list_test.h +++ b/src/tests/api/internals/metadata_list_test.h @@ -37,7 +37,7 @@ protected: savedMetadataPath(metadataFilesPath / "saved.masterlist.yaml"), missingMetadataPath(metadataFilesPath / "missing-metadata.yaml") {} - inline void SetUp() override { + void SetUp() override { CommonGameTestFixture::SetUp(); using std::filesystem::copy; @@ -55,7 +55,7 @@ protected: out << R"(bash_tags: - 'C.Climate' - 'Relev' - + groups: - name: group1 after: diff --git a/src/tests/common_game_test_fixture.h b/src/tests/common_game_test_fixture.h index b8d17031..17379b2e 100644 --- a/src/tests/common_game_test_fixture.h +++ b/src/tests/common_game_test_fixture.h @@ -211,7 +211,7 @@ protected: return actual; } - inline std::vector> getInitialLoadOrder() const { + std::vector> getInitialLoadOrder() const { auto loadOrder = std::vector>({ {masterFile, true}, {blankEsm, true}, @@ -276,7 +276,7 @@ protected: const uint32_t blankEsmCrc; private: - inline std::string getMasterFile() const { + std::string getMasterFile() const { if (GetParam() == GameType::tes3) return "Morrowind.esm"; else if (GetParam() == GameType::tes4) @@ -299,7 +299,7 @@ private: } } - inline uint32_t getBlankEsmCrc() const { + uint32_t getBlankEsmCrc() const { switch (GetParam()) { case GameType::tes3: return 0x790DC6FB; @@ -353,7 +353,7 @@ private: } } - inline static bool isLoadOrderTimestampBased(GameType gameType) { + static bool isLoadOrderTimestampBased(GameType gameType) { return gameType == GameType::tes3 || gameType == GameType::tes4 || gameType == GameType::fo3 || gameType == GameType::fonv; }