]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Disable clang-format around line-wrap sensitive lines in malloc_test.c
authorBob Beck <beck@openssl.org>
Fri, 28 Nov 2025 18:20:53 +0000 (11:20 -0700)
committerNeil Horman <nhorman@openssl.org>
Thu, 4 Dec 2025 18:14:42 +0000 (13:14 -0500)
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: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29243)

test/mem_alloc_test.c

index 0f305d27440ff7c9b531442c5c50ade453b442fd..53391007755c171fd25a671650cb4201f3c96a87 100644 (file)
@@ -440,26 +440,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 {
@@ -556,14 +572,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) {
@@ -654,9 +678,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)