diff --git a/src/h2load_http1_session.cc b/src/h2load_http1_session.cc index b1fddccb..6080e1fb 100644 --- a/src/h2load_http1_session.cc +++ b/src/h2load_http1_session.cc @@ -146,7 +146,7 @@ int htp_body_cb(http_parser *htp, const char *data, size_t len) { } // namespace namespace { -http_parser_settings htp_hooks = { +constexpr http_parser_settings htp_hooks = { htp_msg_begincb, // http_cb on_message_begin; nullptr, // http_data_cb on_url; htp_statuscb, // http_data_cb on_status; diff --git a/src/nghttp.cc b/src/nghttp.cc index 12f7d362..badbc9ca 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -371,7 +371,7 @@ int htp_msg_completecb(http_parser *htp) { } // namespace namespace { -http_parser_settings htp_hooks = { +constexpr http_parser_settings htp_hooks = { htp_msg_begincb, // http_cb on_message_begin; nullptr, // http_data_cb on_url; htp_statuscb, // http_data_cb on_status; diff --git a/src/shrpx.cc b/src/shrpx.cc index a77efd0b..eaa9afc6 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -2911,7 +2911,7 @@ int main(int argc, char **argv) { while (1) { static int flag = 0; - static option long_options[] = { + static constexpr option long_options[] = { {SHRPX_OPT_DAEMON.c_str(), no_argument, nullptr, 'D'}, {SHRPX_OPT_LOG_LEVEL.c_str(), required_argument, nullptr, 'L'}, {SHRPX_OPT_BACKEND.c_str(), required_argument, nullptr, 'b'}, diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index 1c7c6f37..65f16aaa 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -638,7 +638,7 @@ int htp_hdrs_completecb(http_parser *htp) { } // namespace namespace { -http_parser_settings htp_hooks = { +constexpr http_parser_settings htp_hooks = { nullptr, // http_cb on_message_begin; nullptr, // http_data_cb on_url; nullptr, // http_data_cb on_status; diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc index 3a073bd1..85a72b76 100644 --- a/src/shrpx_http_downstream_connection.cc +++ b/src/shrpx_http_downstream_connection.cc @@ -1070,7 +1070,7 @@ int htp_msg_completecb(http_parser *htp) { } // namespace namespace { -http_parser_settings htp_hooks = { +constexpr http_parser_settings htp_hooks = { htp_msg_begincb, // http_cb on_message_begin; nullptr, // http_data_cb on_url; nullptr, // http_data_cb on_status; diff --git a/src/shrpx_https_upstream.cc b/src/shrpx_https_upstream.cc index b9a5df00..0c2b28b3 100644 --- a/src/shrpx_https_upstream.cc +++ b/src/shrpx_https_upstream.cc @@ -505,7 +505,7 @@ int htp_msg_completecb(http_parser *htp) { } // namespace namespace { -http_parser_settings htp_hooks = { +constexpr http_parser_settings htp_hooks = { htp_msg_begin, // http_cb on_message_begin; htp_uricb, // http_data_cb on_url; nullptr, // http_data_cb on_status; diff --git a/src/util.cc b/src/util.cc index cd0f5cc8..410c2704 100644 --- a/src/util.cc +++ b/src/util.cc @@ -472,7 +472,7 @@ int levenshtein(const char *a, int alen, const char *b, int blen, int swapcost, } } // namespace -void show_candidates(const char *unkopt, option *options) { +void show_candidates(const char *unkopt, const option *options) { for (; *unkopt == '-'; ++unkopt) ; if (*unkopt == '\0') { diff --git a/src/util.h b/src/util.h index d2f4d9f1..cda97a05 100644 --- a/src/util.h +++ b/src/util.h @@ -184,7 +184,7 @@ time_t parse_http_date(const StringRef &s); char upcase(char c); inline char lowcase(char c) { - static unsigned char tbl[] = { + constexpr static unsigned char tbl[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, @@ -451,7 +451,7 @@ void to_token68(std::string &base64str); StringRef to_base64(BlockAllocator &balloc, const StringRef &token68str); -void show_candidates(const char *unkopt, option *options); +void show_candidates(const char *unkopt, const option *options); bool has_uri_field(const http_parser_url &u, http_parser_url_fields field);