Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2
diff options
context:
space:
mode:
authorZXShady2025-09-12 00:52:11 +0300
committerMartin Hořeňovský2025-10-04 22:10:36 +0200
commita9223b2bb363c6e33bf1532b9cba0a472a69a023 (patch)
treeb91343d28a1adcb7a6c1769fdc9cf8238cf6839d /src/catch2
parent363ca5af1816f2a03cf0815f916fe70fed19ba27 (diff)
downloadcatch3-a9223b2bb363c6e33bf1532b9cba0a472a69a023.tar.gz
Outline catch_strnlen's definition into catch_tostring.cpp
Diffstat (limited to 'src/catch2')
-rw-r--r--src/catch2/catch_tostring.cpp6
-rw-r--r--src/catch2/catch_tostring.hpp8
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<char>::find( str, n, '\0' );
+ if ( ret != nullptr ) { return static_cast<std::size_t>( 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<char>::find(str, n, '\0');
- if (ret != nullptr) {
- return static_cast<std::size_t>(ret - str);
- }
- return n;
- }
+ std::size_t catch_strnlen(const char *str, std::size_t n);
constexpr StringRef unprintableString = "{?}"_sr;