src: Remove verbose const

This commit is contained in:
Tatsuhiro Tsujikawa 2016-02-07 18:12:57 +09:00
parent 4e7271a88f
commit ede0f6aa32
3 changed files with 13 additions and 14 deletions

View File

@ -975,7 +975,7 @@ int ClientHandler::proxy_protocol_read() {
--end; --end;
constexpr const char HEADER[] = "PROXY "; constexpr char HEADER[] = "PROXY ";
if (static_cast<size_t>(end - rb_.pos) < str_size(HEADER)) { if (static_cast<size_t>(end - rb_.pos) < str_size(HEADER)) {
if (LOG_ENABLED(INFO)) { if (LOG_ENABLED(INFO)) {

View File

@ -66,14 +66,14 @@ namespace util {
const char UPPER_XDIGITS[] = "0123456789ABCDEF"; const char UPPER_XDIGITS[] = "0123456789ABCDEF";
bool in_rfc3986_unreserved_chars(const char c) { bool in_rfc3986_unreserved_chars(const char c) {
static constexpr const char unreserved[] = {'-', '.', '_', '~'}; static constexpr char unreserved[] = {'-', '.', '_', '~'};
return is_alpha(c) || is_digit(c) || return is_alpha(c) || is_digit(c) ||
std::find(std::begin(unreserved), std::end(unreserved), c) != std::find(std::begin(unreserved), std::end(unreserved), c) !=
std::end(unreserved); std::end(unreserved);
} }
bool in_rfc3986_sub_delims(const char c) { bool in_rfc3986_sub_delims(const char c) {
static constexpr const char sub_delims[] = {'!', '$', '&', '\'', '(', ')', static constexpr char sub_delims[] = {'!', '$', '&', '\'', '(', ')',
'*', '+', ',', ';', '='}; '*', '+', ',', ';', '='};
return std::find(std::begin(sub_delims), std::end(sub_delims), c) != return std::find(std::begin(sub_delims), std::end(sub_delims), c) !=
std::end(sub_delims); std::end(sub_delims);
@ -117,15 +117,14 @@ std::string percent_encode_path(const std::string &s) {
} }
bool in_token(char c) { bool in_token(char c) {
static constexpr const char extra[] = {'!', '#', '$', '%', '&', static constexpr char extra[] = {'!', '#', '$', '%', '&', '\'', '*', '+',
'\'', '*', '+', '-', '.', '-', '.', '^', '_', '`', '|', '~'};
'^', '_', '`', '|', '~'};
return is_alpha(c) || is_digit(c) || return is_alpha(c) || is_digit(c) ||
std::find(std::begin(extra), std::end(extra), c) != std::end(extra); std::find(std::begin(extra), std::end(extra), c) != std::end(extra);
} }
bool in_attr_char(char c) { bool in_attr_char(char c) {
static constexpr const char bad[] = {'*', '\'', '%'}; static constexpr char bad[] = {'*', '\'', '%'};
return util::in_token(c) && return util::in_token(c) &&
std::find(std::begin(bad), std::end(bad), c) == std::end(bad); std::find(std::begin(bad), std::end(bad), c) == std::end(bad);
} }

View File

@ -54,14 +54,14 @@ namespace nghttp2 {
// The additional HTTP/2 protocol ALPN protocol identifier we also // The additional HTTP/2 protocol ALPN protocol identifier we also
// supports for our applications to make smooth migration into final // supports for our applications to make smooth migration into final
// h2 ALPN ID. // h2 ALPN ID.
constexpr const char NGHTTP2_H2_16_ALPN[] = "\x5h2-16"; constexpr char NGHTTP2_H2_16_ALPN[] = "\x5h2-16";
constexpr const char NGHTTP2_H2_16[] = "h2-16"; constexpr char NGHTTP2_H2_16[] = "h2-16";
constexpr const char NGHTTP2_H2_14_ALPN[] = "\x5h2-14"; constexpr char NGHTTP2_H2_14_ALPN[] = "\x5h2-14";
constexpr const char NGHTTP2_H2_14[] = "h2-14"; constexpr char NGHTTP2_H2_14[] = "h2-14";
constexpr const char NGHTTP2_H1_1_ALPN[] = "\x8http/1.1"; constexpr char NGHTTP2_H1_1_ALPN[] = "\x8http/1.1";
constexpr const char NGHTTP2_H1_1[] = "http/1.1"; constexpr char NGHTTP2_H1_1[] = "http/1.1";
namespace util { namespace util {