diff --git a/src/string_util.cpp b/src/string_util.cpp index 23804253c..ce7e2bba2 100644 --- a/src/string_util.cpp +++ b/src/string_util.cpp @@ -81,8 +81,7 @@ namespace libtorrent { bool is_space(char c) { - static const char* ws = " \t\n\r\f\v"; - return strchr(ws, c) != nullptr; + return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' || c == '\v'; } char to_lower(char c) diff --git a/test/test_string.cpp b/test/test_string.cpp index 95caddf52..ae8f10704 100644 --- a/test/test_string.cpp +++ b/test/test_string.cpp @@ -91,6 +91,8 @@ TORRENT_TEST(is_space) TEST_CHECK(is_space('\t')); TEST_CHECK(is_space('\n')); TEST_CHECK(is_space('\r')); + TEST_CHECK(is_space('\f')); + TEST_CHECK(is_space('\v')); } TORRENT_TEST(to_lower)