Skip to content

Commit

Permalink
src: Add static to constexpr char[]
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuhiro-t committed Sep 20, 2017
1 parent c23fc86 commit cc6f759
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/shrpx_exec.cc
Expand Up @@ -84,7 +84,7 @@ int exec_read_command(Process &proc, char *const argv[]) {

rv = shrpx_signal_unblock_all();
if (rv != 0) {
constexpr char msg[] = "Unblocking all signals failed\n";
static constexpr char msg[] = "Unblocking all signals failed\n";
while (write(STDERR_FILENO, msg, str_size(msg)) == -1 && errno == EINTR)
;
nghttp2_Exit(EXIT_FAILURE);
Expand All @@ -95,7 +95,7 @@ int exec_read_command(Process &proc, char *const argv[]) {

rv = execv(argv[0], argv);
if (rv == -1) {
constexpr char msg[] = "Could not execute command\n";
static constexpr char msg[] = "Could not execute command\n";
while (write(STDERR_FILENO, msg, str_size(msg)) == -1 && errno == EINTR)
;
nghttp2_Exit(EXIT_FAILURE);
Expand Down
8 changes: 5 additions & 3 deletions src/shrpx_tls_test.cc
Expand Up @@ -70,7 +70,7 @@ void test_shrpx_tls_create_lookup_tree(void) {
CU_ASSERT(-1 == tree->lookup(StringRef{}));
CU_ASSERT(5 == tree->lookup(hostnames[5]));
CU_ASSERT(6 == tree->lookup(hostnames[6]));
constexpr char h6[] = "pdylay.sourceforge.net";
static constexpr char h6[] = "pdylay.sourceforge.net";
for (int i = 0; i < 7; ++i) {
CU_ASSERT(-1 == tree->lookup(StringRef{h6 + i, str_size(h6) - i}));
}
Expand Down Expand Up @@ -119,7 +119,8 @@ void test_shrpx_tls_create_lookup_tree(void) {
void test_shrpx_tls_cert_lookup_tree_add_ssl_ctx(void) {
int rv;

constexpr char nghttp2_certfile[] = NGHTTP2_SRC_DIR "/test.nghttp2.org.pem";
static constexpr char nghttp2_certfile[] =
NGHTTP2_SRC_DIR "/test.nghttp2.org.pem";
auto nghttp2_ssl_ctx = SSL_CTX_new(SSLv23_server_method());
auto nghttp2_ssl_ctx_del = defer(SSL_CTX_free, nghttp2_ssl_ctx);
auto nghttp2_tls_ctx_data = make_unique<tls::TLSContextData>();
Expand All @@ -129,7 +130,8 @@ void test_shrpx_tls_cert_lookup_tree_add_ssl_ctx(void) {

CU_ASSERT(1 == rv);

constexpr char examples_certfile[] = NGHTTP2_SRC_DIR "/test.example.com.pem";
static constexpr char examples_certfile[] =
NGHTTP2_SRC_DIR "/test.example.com.pem";
auto examples_ssl_ctx = SSL_CTX_new(SSLv23_server_method());
auto examples_ssl_ctx_del = defer(SSL_CTX_free, examples_ssl_ctx);
auto examples_tls_ctx_data = make_unique<tls::TLSContextData>();
Expand Down
2 changes: 1 addition & 1 deletion src/util.h
Expand Up @@ -716,7 +716,7 @@ template <typename OutputIt, typename Generator>
OutputIt random_alpha_digit(OutputIt first, OutputIt last, Generator &gen) {
// If we use uint8_t instead char, gcc 6.2.0 complains by shouting
// char-array initialized from wide string.
constexpr char s[] =
static constexpr char s[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
std::uniform_int_distribution<> dis(0, 26 * 2 + 10 - 1);
for (; first != last; ++first) {
Expand Down

0 comments on commit cc6f759

Please sign in to comment.