mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Re-enable strcasestr on Windows, fix linking error
This commit is contained in:
parent
bfd5b06943
commit
51cdbbd59d
1 changed files with 15 additions and 14 deletions
29
src/util.cc
29
src/util.cc
|
@ -1343,20 +1343,7 @@ const char* strpbrk_n(size_t len, const char* s, const char* charset)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ! defined(HAVE_STRCASESTR) && ! defined(_MSC_VER)
|
#if ! defined(HAVE_STRCASESTR)
|
||||||
|
|
||||||
TEST_CASE("util strcasestr")
|
|
||||||
{
|
|
||||||
const char* s = "this is a string";
|
|
||||||
const char* out = strcasestr(s, "is");
|
|
||||||
CHECK(strcmp(out, "is a string") == 0);
|
|
||||||
|
|
||||||
const char* out2 = strcasestr(s, "IS");
|
|
||||||
CHECK(strcmp(out2, "is a string") == 0);
|
|
||||||
|
|
||||||
const char* out3 = strcasestr(s, "not there");
|
|
||||||
CHECK(strcmp(out2, s) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This code is derived from software contributed to BSD by Chris Torek.
|
// This code is derived from software contributed to BSD by Chris Torek.
|
||||||
char* strcasestr(const char* s, const char* find)
|
char* strcasestr(const char* s, const char* find)
|
||||||
|
@ -1384,6 +1371,20 @@ char* strcasestr(const char* s, const char* find)
|
||||||
|
|
||||||
return (char*)s;
|
return (char*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("util strcasestr")
|
||||||
|
{
|
||||||
|
const char* s = "this is a string";
|
||||||
|
const char* out = strcasestr(s, "is");
|
||||||
|
CHECK(strcmp(out, "is a string") == 0);
|
||||||
|
|
||||||
|
const char* out2 = strcasestr(s, "IS");
|
||||||
|
CHECK(strcmp(out2, "is a string") == 0);
|
||||||
|
|
||||||
|
const char* out3 = strcasestr(s, "not there");
|
||||||
|
CHECK(strcmp(out2, s) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TEST_CASE("util atoi_n")
|
TEST_CASE("util atoi_n")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue