mirror of
https://github.com/catchorg/Catch2.git
synced 2025-10-09 12:15:39 +02:00
Outline catch_strnlen's definition into catch_tostring.cpp
This commit is contained in:

committed by
Martin Hořeňovský

parent
363ca5af18
commit
a9223b2bb3
@@ -57,6 +57,12 @@ namespace Detail {
|
|||||||
}
|
}
|
||||||
} // end unnamed namespace
|
} // 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 convertIntoString(StringRef string, bool escapeInvisibles) {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
// This is enough for the "don't escape invisibles" case, and a good
|
// This is enough for the "don't escape invisibles" case, and a good
|
||||||
|
@@ -40,13 +40,7 @@ namespace Catch {
|
|||||||
|
|
||||||
namespace Detail {
|
namespace Detail {
|
||||||
|
|
||||||
inline std::size_t catch_strnlen(const char *str, std::size_t n) {
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr StringRef unprintableString = "{?}"_sr;
|
constexpr StringRef unprintableString = "{?}"_sr;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user