From 3835a99fcb46edb2727e1c1f86912d70e91b432e Mon Sep 17 00:00:00 2001 From: Graham Sedman Date: Fri, 22 May 2026 19:40:53 +0100 Subject: [PATCH 1/2] chore: update tscore includes in MatcherUtils.h Revised includes headers to remove the unused tscore/Result.h header and add the tscore/ink_platform.h header. --- include/tscore/MatcherUtils.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/tscore/MatcherUtils.h b/include/tscore/MatcherUtils.h index ecbaa505ba9..a7fbb81d586 100644 --- a/include/tscore/MatcherUtils.h +++ b/include/tscore/MatcherUtils.h @@ -32,8 +32,9 @@ #pragma once #include "tscore/ParseRules.h" -#include "tscore/Result.h" #include "tscore/ink_inet.h" +#include "tscore/ink_inet.h" +#include "tscore/ink_platform.h" // Look in MatcherUtils.cc for comments on function usage char *readIntoBuffer(const char *file_path, const char *module_name, int *read_size_ptr); From b717414dcfd39d9596e96f8b32a3e844f597c360 Mon Sep 17 00:00:00 2001 From: Graham Sedman Date: Fri, 22 May 2026 20:31:21 +0100 Subject: [PATCH 2/2] refactor: remove redundant includes and apply modern code style Remove direct inclusions of ink_platform.h and ink_inet.h as they are pulled in transitively via MatcherUtils.h. Reorder the remaining include statements for better organisation. Update format specifiers in readIntoBuffer to use %zd for ssize_t variables to ensure correct formatting across different platforms. Replace C-style cast with static_cast in unescapifyStr when passing nullptr to strtol to adhere to C++ coding standards. --- src/tscore/MatcherUtils.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/tscore/MatcherUtils.cc b/src/tscore/MatcherUtils.cc index 813e11a937d..1bc2d4ef2e9 100644 --- a/src/tscore/MatcherUtils.cc +++ b/src/tscore/MatcherUtils.cc @@ -29,13 +29,11 @@ * ****************************************************************************/ -#include "tscore/ink_platform.h" #include "tscore/Diags.h" -#include "tscore/ink_memory.h" -#include "tscore/ink_inet.h" -#include "tscore/ink_assert.h" #include "tscore/MatcherUtils.h" #include "tscore/Tokenizer.h" +#include "tscore/ink_assert.h" +#include "tscore/ink_memory.h" // char* readIntoBuffer(const char* file_path, const char* module_name, // int* read_size_ptr) @@ -113,7 +111,7 @@ readIntoBuffer(const char *file_path, const char *module_name, int *read_size_pt // Didn't get the whole file, drop everything. We don't want to return // something partially read because, ie. with configs, the behaviour // is undefined. - Error("%s Only able to read %ld bytes out %ld for %s file", module_name, read_size, file_size, file_path); + Error("%s Only able to read %zd bytes out %zd for %s file", module_name, read_size, file_size, file_path); ats_free(file_buf); file_buf = nullptr; } @@ -144,7 +142,7 @@ unescapifyStr(char *buffer) if (*read == '%' && *(read + 1) != '\0' && *(read + 2) != '\0') { subStr[0] = *(++read); subStr[1] = *(++read); - *write = static_cast(strtol(subStr, (char **)nullptr, 16)); + *write = static_cast(strtol(subStr, static_cast(nullptr), 16)); read++; write++; } else if (*read == '+') {