src: Add constexpr to const objects

This commit is contained in:
Tatsuhiro Tsujikawa 2017-01-09 17:11:37 +09:00
parent 41d8a3ac09
commit 6595ae26ea
8 changed files with 9 additions and 9 deletions

View File

@ -146,7 +146,7 @@ int htp_body_cb(http_parser *htp, const char *data, size_t len) {
} // namespace } // namespace
namespace { namespace {
http_parser_settings htp_hooks = { constexpr http_parser_settings htp_hooks = {
htp_msg_begincb, // http_cb on_message_begin; htp_msg_begincb, // http_cb on_message_begin;
nullptr, // http_data_cb on_url; nullptr, // http_data_cb on_url;
htp_statuscb, // http_data_cb on_status; htp_statuscb, // http_data_cb on_status;

View File

@ -371,7 +371,7 @@ int htp_msg_completecb(http_parser *htp) {
} // namespace } // namespace
namespace { namespace {
http_parser_settings htp_hooks = { constexpr http_parser_settings htp_hooks = {
htp_msg_begincb, // http_cb on_message_begin; htp_msg_begincb, // http_cb on_message_begin;
nullptr, // http_data_cb on_url; nullptr, // http_data_cb on_url;
htp_statuscb, // http_data_cb on_status; htp_statuscb, // http_data_cb on_status;

View File

@ -2911,7 +2911,7 @@ int main(int argc, char **argv) {
while (1) { while (1) {
static int flag = 0; static int flag = 0;
static option long_options[] = { static constexpr option long_options[] = {
{SHRPX_OPT_DAEMON.c_str(), no_argument, nullptr, 'D'}, {SHRPX_OPT_DAEMON.c_str(), no_argument, nullptr, 'D'},
{SHRPX_OPT_LOG_LEVEL.c_str(), required_argument, nullptr, 'L'}, {SHRPX_OPT_LOG_LEVEL.c_str(), required_argument, nullptr, 'L'},
{SHRPX_OPT_BACKEND.c_str(), required_argument, nullptr, 'b'}, {SHRPX_OPT_BACKEND.c_str(), required_argument, nullptr, 'b'},

View File

@ -638,7 +638,7 @@ int htp_hdrs_completecb(http_parser *htp) {
} // namespace } // namespace
namespace { namespace {
http_parser_settings htp_hooks = { constexpr http_parser_settings htp_hooks = {
nullptr, // http_cb on_message_begin; nullptr, // http_cb on_message_begin;
nullptr, // http_data_cb on_url; nullptr, // http_data_cb on_url;
nullptr, // http_data_cb on_status; nullptr, // http_data_cb on_status;

View File

@ -1070,7 +1070,7 @@ int htp_msg_completecb(http_parser *htp) {
} // namespace } // namespace
namespace { namespace {
http_parser_settings htp_hooks = { constexpr http_parser_settings htp_hooks = {
htp_msg_begincb, // http_cb on_message_begin; htp_msg_begincb, // http_cb on_message_begin;
nullptr, // http_data_cb on_url; nullptr, // http_data_cb on_url;
nullptr, // http_data_cb on_status; nullptr, // http_data_cb on_status;

View File

@ -505,7 +505,7 @@ int htp_msg_completecb(http_parser *htp) {
} // namespace } // namespace
namespace { namespace {
http_parser_settings htp_hooks = { constexpr http_parser_settings htp_hooks = {
htp_msg_begin, // http_cb on_message_begin; htp_msg_begin, // http_cb on_message_begin;
htp_uricb, // http_data_cb on_url; htp_uricb, // http_data_cb on_url;
nullptr, // http_data_cb on_status; nullptr, // http_data_cb on_status;

View File

@ -472,7 +472,7 @@ int levenshtein(const char *a, int alen, const char *b, int blen, int swapcost,
} }
} // namespace } // namespace
void show_candidates(const char *unkopt, option *options) { void show_candidates(const char *unkopt, const option *options) {
for (; *unkopt == '-'; ++unkopt) for (; *unkopt == '-'; ++unkopt)
; ;
if (*unkopt == '\0') { if (*unkopt == '\0') {

View File

@ -184,7 +184,7 @@ time_t parse_http_date(const StringRef &s);
char upcase(char c); char upcase(char c);
inline char lowcase(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, 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, 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, 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); 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); bool has_uri_field(const http_parser_url &u, http_parser_url_fields field);