Skip to content

Commit 484caf1

Browse files
committed
Use more mem* functions instead of str* functions
1 parent 846e0e5 commit 484caf1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/scorepy/cstring.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ class CString
3636
/// Find the first occurrence of the character and return a pointer to it or NULL if not found
3737
const char* find(char c) const
3838
{
39-
return std::strchr(s_, c);
39+
return static_cast<const char*>(std::memchr(s_, c, len_));
4040
}
4141
template <size_t N>
4242
bool starts_with(const char (&prefix)[N]) const
4343
{
44-
return (len_ >= N - 1u) && (std::strncmp(s_, prefix, N - 1u) == 0);
44+
return (len_ >= N - 1u) && (std::memcmp(s_, prefix, N - 1u) == 0);
4545
}
4646

4747
friend bool operator==(const CString& lhs, const CString& rhs)

0 commit comments

Comments
 (0)