Skip to content

Commit 5474ab2

Browse files
refactor(ffi): Resolve clang-tidy violations in ffi/utils.cpp. (#777)
Co-authored-by: kirkrodrigues <2454684+kirkrodrigues@users.noreply.github.com>
1 parent 4e38b2a commit 5474ab2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

components/core/src/clp/ffi/utils.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ auto validate_and_append_escaped_utf8_string(std::string_view src, std::string&
6161
constexpr uint8_t cLargestControlCharacter{0x1F};
6262
auto const byte{static_cast<uint8_t>(*it)};
6363
if (cLargestControlCharacter >= byte) {
64+
// NOTE: This section can be replaced with the following without losing any
65+
// performance:
66+
// escaped_char = fmt::format("\\u00{:02x}", byte);
67+
// We should update it once `fmtlib` is fully integrated into the FFI library.
68+
69+
// Necessary since implementations (besides `fmtlib`) that don't violate
70+
// `cppcoreguidelines-pro-type-vararg` have much worse performance.
71+
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
6472
std::ignore = snprintf(buf.data(), buf.size(), "\\u00%02x", byte);
6573
escaped_char = {buf.data(), buf.size() - 1};
6674
} else {

lint-tasks.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ tasks:
269269
- "{{.G_CORE_COMPONENT_DIR}}/src/clp/ffi/search/Subquery.hpp"
270270
- "{{.G_CORE_COMPONENT_DIR}}/src/clp/ffi/search/WildcardToken.cpp"
271271
- "{{.G_CORE_COMPONENT_DIR}}/src/clp/ffi/search/WildcardToken.hpp"
272-
- "{{.G_CORE_COMPONENT_DIR}}/src/clp/ffi/utils.cpp"
273272
- "{{.G_CORE_COMPONENT_DIR}}/src/clp/FileDescriptor.cpp"
274273
- "{{.G_CORE_COMPONENT_DIR}}/src/clp/FileDescriptor.hpp"
275274
- "{{.G_CORE_COMPONENT_DIR}}/src/clp/FileDescriptorReader.cpp"

0 commit comments

Comments
 (0)