mirror of
https://github.com/nlohmann/json.git
synced 2026-10-01 20:20:32 +00:00
Mark string_ref's strlen as a Flawfinder false positive
string_ref(const char*) requires a null-terminated string, like std::string_view's constructor. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -40,6 +40,8 @@ class string_ref
|
||||
using const_iterator = const char*;
|
||||
|
||||
string_ref() noexcept = default;
|
||||
// s must be null-terminated, as for std::string_view(const char*)
|
||||
// flawfinder: ignore
|
||||
string_ref(const char* s) : m_data(s), m_size(std::strlen(s)) {} // NOLINT(google-explicit-constructor,hicpp-explicit-conversions)
|
||||
string_ref(const char* s, std::size_t n) noexcept : m_data(s), m_size(n) {}
|
||||
template<typename Traits, typename Alloc>
|
||||
|
||||
Reference in New Issue
Block a user