src: Rename endsWith as ends_with

This commit is contained in:
Tatsuhiro Tsujikawa 2015-11-28 00:36:43 +09:00
parent de247f7d33
commit d867fe64e3
4 changed files with 21 additions and 21 deletions

View File

@ -808,7 +808,7 @@ bool tls_hostname_match(const char *pattern, const char *hostname) {
return false;
}
return util::istarts_with(hostname, hnLeftLabelEnd, pattern, ptWildcard) &&
util::iendsWith(hostname, hnLeftLabelEnd, ptWildcard + 1,
util::iends_with(hostname, hnLeftLabelEnd, ptWildcard + 1,
ptLeftLabelEnd);
}
} // namespace

View File

@ -521,7 +521,7 @@ void show_candidates(const char *unkopt, option *options) {
}
// Use cost 0 for suffix match, but match at least 3 characters
if (unkoptlen >= 3 &&
iendsWith(options[i].name, options[i].name + optnamelen, unkopt,
iends_with(options[i].name, options[i].name + optnamelen, unkopt,
unkopt + unkoptlen)) {
cands.emplace_back(0, options[i].name);
continue;
@ -754,7 +754,7 @@ bool check_path(const std::string &path) {
path.find('\\') == std::string::npos &&
path.find("/../") == std::string::npos &&
path.find("/./") == std::string::npos &&
!util::endsWith(path, "/..") && !util::endsWith(path, "/.");
!util::ends_with(path, "/..") && !util::ends_with(path, "/.");
}
int64_t to_time64(const timeval &tv) {

View File

@ -212,7 +212,7 @@ bool istarts_with(InputIt a, size_t an, const char *b) {
bool istarts_with(const char *a, const char *b);
template <typename InputIterator1, typename InputIterator2>
bool endsWith(InputIterator1 first1, InputIterator1 last1,
bool ends_with(InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2) {
if (last1 - first1 < last2 - first2) {
return false;
@ -220,12 +220,12 @@ bool endsWith(InputIterator1 first1, InputIterator1 last1,
return std::equal(first2, last2, last1 - (last2 - first2));
}
inline bool endsWith(const std::string &a, const std::string &b) {
return endsWith(std::begin(a), std::end(a), std::begin(b), std::end(b));
inline bool ends_with(const std::string &a, const std::string &b) {
return ends_with(std::begin(a), std::end(a), std::begin(b), std::end(b));
}
template <typename InputIterator1, typename InputIterator2>
bool iendsWith(InputIterator1 first1, InputIterator1 last1,
bool iends_with(InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2) {
if (last1 - first1 < last2 - first2) {
return false;
@ -233,8 +233,8 @@ bool iendsWith(InputIterator1 first1, InputIterator1 last1,
return std::equal(first2, last2, last1 - (last2 - first2), CaseCmp());
}
inline bool iendsWith(const std::string &a, const std::string &b) {
return iendsWith(std::begin(a), std::end(a), std::begin(b), std::end(b));
inline bool iends_with(const std::string &a, const std::string &b) {
return iends_with(std::begin(a), std::end(a), std::begin(b), std::end(b));
}
int strcompare(const char *a, const uint8_t *b, size_t n);

View File

@ -356,15 +356,15 @@ void test_util_starts_with(void) {
}
void test_util_ends_with(void) {
CU_ASSERT(util::endsWith("foo", "foo"));
CU_ASSERT(util::endsWith("foo", ""));
CU_ASSERT(util::endsWith("ofoo", "foo"));
CU_ASSERT(!util::endsWith("ofoo", "fo"));
CU_ASSERT(util::ends_with("foo", "foo"));
CU_ASSERT(util::ends_with("foo", ""));
CU_ASSERT(util::ends_with("ofoo", "foo"));
CU_ASSERT(!util::ends_with("ofoo", "fo"));
CU_ASSERT(util::iendsWith("fOo", "Foo"));
CU_ASSERT(util::iendsWith("foo", ""));
CU_ASSERT(util::iendsWith("oFoo", "fOO"));
CU_ASSERT(!util::iendsWith("ofoo", "fo"));
CU_ASSERT(util::iends_with("fOo", "Foo"));
CU_ASSERT(util::iends_with("foo", ""));
CU_ASSERT(util::iends_with("oFoo", "fOO"));
CU_ASSERT(!util::iends_with("ofoo", "fo"));
}
void test_util_parse_http_date(void) {