From: Bob Beck Date: Fri, 28 Nov 2025 18:20:53 +0000 (-0700) Subject: Disable clang-format around line-wrap sensitive lines in malloc_test.c X-Git-Tag: 4.0-PRE-CLANG-FORMAT-WEBKIT~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a815c1481ec43149b7a417d4b5b2aaf372d44e5;p=thirdparty%2Fopenssl.git Disable clang-format around line-wrap sensitive lines in malloc_test.c If OPENSSL_LINE ends up on a different line than the following call here, this test breaks. We should perhaps reconsider if testing the reporting of OPENSSL_LINE is what we want in a malloc test, but that's for another time than now. Reviewed-by: Saša Nedvědický Reviewed-by: Nikola Pajkovsky Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/29241) --- diff --git a/test/mem_alloc_test.c b/test/mem_alloc_test.c index 98283121a64..cf0a802ae1f 100644 --- a/test/mem_alloc_test.c +++ b/test/mem_alloc_test.c @@ -433,26 +433,42 @@ static int test_xalloc(const bool secure, const bool array, const bool zero, if (secure) { if (array) { if (zero) + /* clang-format off */ ln = OPENSSL_LINE, ret = OPENSSL_secure_calloc(td->nmemb, td->size); + /* clang-format on */ else + /* clang-format off */ ln = OPENSSL_LINE, ret = OPENSSL_secure_malloc_array(td->nmemb, td->size); + /* clang-format on */ } else { if (zero) + /* clang-format off */ ln = OPENSSL_LINE, ret = OPENSSL_secure_zalloc(sz); + /* clang-format on */ else + /* clang-format off */ ln = OPENSSL_LINE, ret = OPENSSL_secure_malloc(sz); + /* clang-format on */ } } else { if (array) { if (zero) + /* clang-format off */ ln = OPENSSL_LINE, ret = OPENSSL_calloc(td->nmemb, td->size); + /* clang-format on */ else + /* clang-format off */ ln = OPENSSL_LINE, ret = OPENSSL_malloc_array(td->nmemb, td->size); + /* clang-format on */ } else { if (zero) + /* clang-format off*/ ln = OPENSSL_LINE, ret = OPENSSL_zalloc(sz); + /* clang-format on */ else + /* clang-format off*/ ln = OPENSSL_LINE, ret = OPENSSL_malloc(sz); + /* clang-format on */ } } } else { @@ -549,14 +565,22 @@ static int test_xrealloc(const bool clear, const bool array, const bool macro, if (macro) { if (array) { if (clear) + /* clang-format off */ ln = OPENSSL_LINE, ret = OPENSSL_clear_realloc_array(ret, old_nmemb, nmemb, td->size); + /* clang-format on */ else + /* clang-format off */ ln = OPENSSL_LINE, ret = OPENSSL_realloc_array(ret, nmemb, td->size); + /* clang-format on*/ } else { if (clear) + /* clang-format off */ ln = OPENSSL_LINE, ret = OPENSSL_clear_realloc(ret, old_sz, sz); + /* clang-format on */ else + /* clang-format off */ ln = OPENSSL_LINE, ret = OPENSSL_realloc(ret, sz); + /* clang-format on */ } } else { if (array) { @@ -647,9 +671,14 @@ static int test_xaligned_alloc(const bool array, const bool macro, if (macro) { if (array) { + /* clang-format off */ ln = OPENSSL_LINE, ret = OPENSSL_aligned_alloc_array(td->nmemb, td->size, td->align, &freeptr); + /* clang-format on */ + } else { + /* clang-format off */ ln = OPENSSL_LINE, ret = OPENSSL_aligned_alloc(sz, td->align, &freeptr); + /* clang-format on */ } } else { if (array)