Skip to content

Commit b717414

Browse files
committed
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.
1 parent 3835a99 commit b717414

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎src/tscore/MatcherUtils.cc‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@
2929
*
3030
****************************************************************************/
3131

32-
#include "tscore/ink_platform.h"
3332
#include "tscore/Diags.h"
34-
#include "tscore/ink_memory.h"
35-
#include "tscore/ink_inet.h"
36-
#include "tscore/ink_assert.h"
3733
#include "tscore/MatcherUtils.h"
3834
#include "tscore/Tokenizer.h"
35+
#include "tscore/ink_assert.h"
36+
#include "tscore/ink_memory.h"
3937

4038
// char* readIntoBuffer(const char* file_path, const char* module_name,
4139
// int* read_size_ptr)
@@ -113,7 +111,7 @@ readIntoBuffer(const char *file_path, const char *module_name, int *read_size_pt
113111
// Didn't get the whole file, drop everything. We don't want to return
114112
// something partially read because, ie. with configs, the behaviour
115113
// is undefined.
116-
Error("%s Only able to read %ld bytes out %ld for %s file", module_name, read_size, file_size, file_path);
114+
Error("%s Only able to read %zd bytes out %zd for %s file", module_name, read_size, file_size, file_path);
117115
ats_free(file_buf);
118116
file_buf = nullptr;
119117
}
@@ -144,7 +142,7 @@ unescapifyStr(char *buffer)
144142
if (*read == '%' && *(read + 1) != '\0' && *(read + 2) != '\0') {
145143
subStr[0] = *(++read);
146144
subStr[1] = *(++read);
147-
*write = static_cast<char>(strtol(subStr, (char **)nullptr, 16));
145+
*write = static_cast<char>(strtol(subStr, static_cast<char **>(nullptr), 16));
148146
read++;
149147
write++;
150148
} else if (*read == '+') {

0 commit comments

Comments
 (0)