Skip to content

Commit

Permalink
Use more mem* functions instead of str* functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Jul 8, 2020
1 parent 846e0e5 commit 484caf1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scorepy/cstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ class CString
/// Find the first occurrence of the character and return a pointer to it or NULL if not found
const char* find(char c) const
{
return std::strchr(s_, c);
return static_cast<const char*>(std::memchr(s_, c, len_));
}
template <size_t N>
bool starts_with(const char (&prefix)[N]) const
{
return (len_ >= N - 1u) && (std::strncmp(s_, prefix, N - 1u) == 0);
return (len_ >= N - 1u) && (std::memcmp(s_, prefix, N - 1u) == 0);
}

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

0 comments on commit 484caf1

Please sign in to comment.