Also fix nullptr in internal header files This was done partially by hand because clang-tidy --fix did not want to work on our header files. I think this is because the CMake compile_commands.json perhaps didn't tell it how to build headers standalone, because clang-tidy complained about missing #includes. It seems --fix refuses to apply fixes when it couldn't build the file at all. Change-Id: Ia4c73e7b8757bc66ea72806d090eccb425e0b4c7 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/83068 Commit-Queue: Lily Chen <chlily@google.com> Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Lily Chen <chlily@google.com> Auto-Submit: David Benjamin <davidben@google.com>
diff --git a/crypto/cpu_arm_linux.h b/crypto/cpu_arm_linux.h index 196f3dd..e67ee52 100644 --- a/crypto/cpu_arm_linux.h +++ b/crypto/cpu_arm_linux.h
@@ -56,7 +56,7 @@ static int STRING_PIECE_split(STRING_PIECE *out_left, STRING_PIECE *out_right, const STRING_PIECE *in, char sep) { const char *p = (const char *)OPENSSL_memchr(in->data, sep, in->len); - if (p == NULL) { + if (p == nullptr) { return 0; } // |out_left| or |out_right| may alias |in|, so make a copy.
diff --git a/crypto/internal.h b/crypto/internal.h index 30ec7df..633e4fa 100644 --- a/crypto/internal.h +++ b/crypto/internal.h
@@ -748,9 +748,9 @@ uint8_t num_reserved; } CRYPTO_EX_DATA_CLASS; -#define CRYPTO_EX_DATA_CLASS_INIT {CRYPTO_MUTEX_INIT, NULL, NULL, {}, 0} +#define CRYPTO_EX_DATA_CLASS_INIT {CRYPTO_MUTEX_INIT, nullptr, nullptr, {}, 0} #define CRYPTO_EX_DATA_CLASS_INIT_WITH_APP_DATA \ - {CRYPTO_MUTEX_INIT, NULL, NULL, {}, 1} + {CRYPTO_MUTEX_INIT, nullptr, nullptr, {}, 1} // CRYPTO_get_ex_new_index_ex allocates a new index for |ex_data_class|. Each // class of object should provide a wrapper function that uses the correct @@ -831,7 +831,7 @@ static inline const void *OPENSSL_memchr(const void *s, int c, size_t n) { if (n == 0) { - return NULL; + return nullptr; } return memchr(s, c, n); @@ -839,7 +839,7 @@ static inline void *OPENSSL_memchr(void *s, int c, size_t n) { if (n == 0) { - return NULL; + return nullptr; } return memchr(s, c, n); @@ -850,7 +850,7 @@ static inline void *OPENSSL_memchr(const void *s, int c, size_t n) { if (n == 0) { - return NULL; + return nullptr; } return memchr(s, c, n); @@ -1094,7 +1094,7 @@ #if defined(BORINGSSL_FIPS_BREAK_TESTS) inline int boringssl_fips_break_test(const char *test) { const char *const value = getenv("BORINGSSL_FIPS_BREAK_TEST"); - return value != NULL && strcmp(value, test) == 0; + return value != nullptr && strcmp(value, test) == 0; } #else inline int boringssl_fips_break_test(const char *test) { return 0; }
diff --git a/ssl/test/fuzzer.h b/ssl/test/fuzzer.h index 32521a5..474c8ff 100644 --- a/ssl/test/fuzzer.h +++ b/ssl/test/fuzzer.h
@@ -416,7 +416,8 @@ } const uint8_t *bufp = kCertificateDER; - bssl::UniquePtr<X509> cert(d2i_X509(NULL, &bufp, sizeof(kCertificateDER))); + bssl::UniquePtr<X509> cert( + d2i_X509(nullptr, &bufp, sizeof(kCertificateDER))); if (!cert || !SSL_CTX_use_certificate(ctx_.get(), cert.get()) || !SSL_CTX_set_ocsp_response(ctx_.get(), kOCSPResponse,