From a9223b2bb363c6e33bf1532b9cba0a472a69a023 Mon Sep 17 00:00:00 2001 From: ZXShady <153229951+ZXShady@users.noreply.github.com> Date: Fri, 12 Sep 2025 00:52:11 +0300 Subject: [PATCH] Outline catch_strnlen's definition into catch_tostring.cpp --- src/catch2/catch_tostring.cpp | 6 ++++++ src/catch2/catch_tostring.hpp | 8 +------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/catch2/catch_tostring.cpp b/src/catch2/catch_tostring.cpp index cc686567..20b0a629 100644 --- a/src/catch2/catch_tostring.cpp +++ b/src/catch2/catch_tostring.cpp @@ -57,6 +57,12 @@ namespace Detail { } } // end unnamed namespace + std::size_t catch_strnlen( const char* str, std::size_t n ) { + auto ret = std::char_traits::find( str, n, '\0' ); + if ( ret != nullptr ) { return static_cast( ret - str ); } + return n; + } + std::string convertIntoString(StringRef string, bool escapeInvisibles) { std::string ret; // This is enough for the "don't escape invisibles" case, and a good diff --git a/src/catch2/catch_tostring.hpp b/src/catch2/catch_tostring.hpp index 41f89413..aca1f7e0 100644 --- a/src/catch2/catch_tostring.hpp +++ b/src/catch2/catch_tostring.hpp @@ -40,13 +40,7 @@ namespace Catch { namespace Detail { - inline std::size_t catch_strnlen(const char *str, std::size_t n) { - auto ret = std::char_traits::find(str, n, '\0'); - if (ret != nullptr) { - return static_cast(ret - str); - } - return n; - } + std::size_t catch_strnlen(const char *str, std::size_t n); constexpr StringRef unprintableString = "{?}"_sr;