src: Remove istarts_with(const char*) overload

This commit is contained in:
Tatsuhiro Tsujikawa 2016-03-25 00:14:12 +09:00
parent bfccab9b9f
commit 2d2d6c3cc0
3 changed files with 1 additions and 23 deletions

View File

@ -488,7 +488,7 @@ std::vector<LogFragment> parse_log_format(const StringRef &optarg) {
auto type = log_var_lookup_token(var_name, var_namelen);
if (type == SHRPX_LOGF_NONE) {
if (util::istarts_with(var_name, var_namelen, "http_")) {
if (util::istarts_with_l(StringRef{var_name, var_namelen}, "http_")) {
if (util::streq_l("host", StringRef{var_name + str_size("http_"),
var_namelen - str_size("http_")})) {
// Special handling of host header field. We will use

View File

@ -348,21 +348,6 @@ time_t parse_http_date(const StringRef &s) {
return nghttp2_timegm_without_yday(&tm);
}
namespace {
void streq_advance(const char **ap, const char **bp) {
for (; **ap && **bp && lowcase(**ap) == lowcase(**bp); ++*ap, ++*bp)
;
}
} // namespace
bool istarts_with(const char *a, const char *b) {
if (!a || !b) {
return false;
}
streq_advance(&a, &b);
return !*b;
}
int strcompare(const char *a, const uint8_t *b, size_t bn) {
assert(a && b);
const uint8_t *blast = b + bn;

View File

@ -220,13 +220,6 @@ inline bool istarts_with(const StringRef &a, const StringRef &b) {
return istarts_with(std::begin(a), std::end(a), std::begin(b), std::end(b));
}
template <typename InputIt>
bool istarts_with(InputIt a, size_t an, const char *b) {
return istarts_with(a, a + an, b, b + strlen(b));
}
bool istarts_with(const char *a, const char *b);
template <typename CharT, size_t N>
bool istarts_with_l(const std::string &a, const CharT(&b)[N]) {
return istarts_with(std::begin(a), std::end(a), b, b + N - 1);