diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 90bdc1c2..9c5d9917 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -304,7 +304,7 @@ read_quic_secret_file(const StringRef &path) { FILE *open_file_for_write(const char *filename) { std::array errbuf; -#if defined O_CLOEXEC +#ifdef O_CLOEXEC auto fd = open(filename, O_WRONLY | O_CLOEXEC | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); #else diff --git a/src/shrpx_connection.cc b/src/shrpx_connection.cc index 229e693c..af3cc05a 100644 --- a/src/shrpx_connection.cc +++ b/src/shrpx_connection.cc @@ -503,9 +503,9 @@ int Connection::tls_handshake() { // routine. We have to check HTTP/2 requirement if HTTP/2 was // negotiated before sending finished message to the peer. if ((rv != 1 -#if defined(OPENSSL_IS_BORINGSSL) +#ifdef OPENSSL_IS_BORINGSSL || SSL_in_init(tls.ssl) -#endif // defined(OPENSSL_IS_BORINGSSL) +#endif // OPENSSL_IS_BORINGSSL ) && tls.wbuf.rleft()) { // First write indicates that resumption stuff has done. @@ -543,7 +543,7 @@ int Connection::tls_handshake() { return SHRPX_ERR_INPROGRESS; } -#if defined(OPENSSL_IS_BORINGSSL) +#ifdef OPENSSL_IS_BORINGSSL if (!tlsconf.no_postpone_early_data && SSL_in_early_data(tls.ssl) && SSL_in_init(tls.ssl)) { auto nread = SSL_read(tls.ssl, buf.data(), buf.size()); @@ -575,7 +575,7 @@ int Connection::tls_handshake() { return SHRPX_ERR_INPROGRESS; } } -#endif // defined(OPENSSL_IS_BORINGSSL) +#endif // OPENSSL_IS_BORINGSSL // Handshake was done @@ -613,7 +613,7 @@ int Connection::write_tls_pending_handshake() { tls.wbuf.drain(nwrite); } -#if defined(OPENSSL_IS_BORINGSSL) +#ifdef OPENSSL_IS_BORINGSSL if (!SSL_in_init(tls.ssl)) { // This will send a session ticket. auto nwrite = SSL_write(tls.ssl, "", 0); @@ -641,7 +641,7 @@ int Connection::write_tls_pending_handshake() { } } } -#endif // defined(OPENSSL_IS_BORINGSSL) +#endif // OPENSSL_IS_BORINGSSL // We have to start read watcher, since later stage of code expects // this. diff --git a/src/shrpx_log.cc b/src/shrpx_log.cc index 8fd8b11c..3a5af823 100644 --- a/src/shrpx_log.cc +++ b/src/shrpx_log.cc @@ -964,7 +964,7 @@ int open_log_file(const char *path) { strcmp(path, "/proc/self/fd/2") == 0) { return STDERR_COPY; } -#if defined O_CLOEXEC +#ifdef O_CLOEXEC auto fd = open(path, O_WRONLY | O_APPEND | O_CREAT | O_CLOEXEC, S_IRUSR | S_IWUSR | S_IRGRP); diff --git a/src/shrpx_tls.cc b/src/shrpx_tls.cc index 12539ad5..bb0017e6 100644 --- a/src/shrpx_tls.cc +++ b/src/shrpx_tls.cc @@ -2648,7 +2648,7 @@ int time_t_from_asn1_time(time_t &t, const ASN1_TIME *at) { return -1; } -# if defined(OPENSSL_IS_BORINGSSL) +# ifdef OPENSSL_IS_BORINGSSL char *s; # else unsigned char *s; diff --git a/src/ssl_compat.h b/src/ssl_compat.h index e1077eef..87f326a4 100644 --- a/src/ssl_compat.h +++ b/src/ssl_compat.h @@ -26,20 +26,20 @@ # include -# if defined(LIBRESSL_VERSION_NUMBER) +# ifdef LIBRESSL_VERSION_NUMBER # define OPENSSL_1_1_API 0 # define OPENSSL_1_1_1_API 0 # define OPENSSL_3_0_0_API 0 # define LIBRESSL_IN_USE 1 # define LIBRESSL_LEGACY_API (LIBRESSL_VERSION_NUMBER < 0x20700000L) # define LIBRESSL_2_7_API (LIBRESSL_VERSION_NUMBER >= 0x20700000L) -# else // !defined(LIBRESSL_VERSION_NUMBER) +# else // !LIBRESSL_VERSION_NUMBER # define OPENSSL_1_1_API (OPENSSL_VERSION_NUMBER >= 0x1010000fL) # define OPENSSL_1_1_1_API (OPENSSL_VERSION_NUMBER >= 0x10101000L) # define OPENSSL_3_0_0_API (OPENSSL_VERSION_NUMBER >= 0x30000000L) # define LIBRESSL_IN_USE 0 # define LIBRESSL_LEGACY_API 0 # define LIBRESSL_2_7_API 0 -# endif // !defined(LIBRESSL_VERSION_NUMBER) +# endif // !LIBRESSL_VERSION_NUMBER #endif // OPENSSL_COMPAT_H diff --git a/src/util.cc b/src/util.cc index 4db6325d..213989e4 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1649,7 +1649,7 @@ std::mt19937 make_mt19937() { } int daemonize(int nochdir, int noclose) { -#if defined(__APPLE__) +#ifdef __APPLE__ pid_t pid; pid = fork(); if (pid == -1) { @@ -1683,9 +1683,9 @@ int daemonize(int nochdir, int noclose) { } } return 0; -#else // !defined(__APPLE__) +#else // !__APPLE__ return daemon(nochdir, noclose); -#endif // !defined(__APPLE__) +#endif // !__APPLE__ } #ifdef ENABLE_HTTP3