From b7397f2f2999708457c412edeec202973d1c2e46 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 25 Sep 2025 16:01:53 -0400 Subject: [PATCH] cmInstrumentation: Simplify test for .json file name suffix --- Source/cmInstrumentation.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmInstrumentation.cxx b/Source/cmInstrumentation.cxx index 05674a5e4e..48d8ffb7a0 100644 --- a/Source/cmInstrumentation.cxx +++ b/Source/cmInstrumentation.cxx @@ -159,12 +159,11 @@ cmsys::SystemInformation& cmInstrumentation::GetSystemInformation() bool cmInstrumentation::ReadJSONQueries(std::string const& directory) { cmsys::Directory d; - std::string json = ".json"; bool result = false; if (d.Load(directory)) { for (unsigned int i = 0; i < d.GetNumberOfFiles(); i++) { std::string fpath = d.GetFilePath(i); - if (fpath.rfind(json) == (fpath.size() - json.size())) { + if (cmHasLiteralSuffix(fpath, ".json")) { result = true; this->ReadJSONQuery(fpath); }