units: drop redundant pointer check and workaround

All users of the `verify_memory()` macro used a fixed-length buffer for
the test output, which then needed a workaround to silence GCC
`-Waddress` warnings.

```
tests/unit/unit1615.c: In function 'test_unit1615':
tests/libtest/unitcheck.h:51:8: error: the address of 'output_buf' will always evaluate as 'true' [-Werror=address]
   51 |     if((dynamic) && memcmp(dynamic, check, len)) {                          \
      |        ^
tests/unit/unit1615.c:114:3: note: in expansion of macro 'verify_memory'
  114 |   verify_memory(output_buf, precomp_hash1, CURL_SHA512_256_DIGEST_LENGTH);
      |   ^~~~~~~~~~~~~
```

Drop redundant address check and the workarounds with it.

Closes #21833
This commit is contained in:
Viktor Szakats 2026-06-01 01:29:14 +02:00
parent c5000b786b
commit 4e98f6d225
No known key found for this signature in database
7 changed files with 20 additions and 29 deletions

View file

@ -48,7 +48,7 @@
#define verify_memory(dynamic, check, len) \
do { \
if((dynamic) && memcmp(dynamic, check, len)) { \
if(memcmp(dynamic, check, len)) { \
curl_mfprintf(stderr, "%s:%d Memory buffer FAILED match size %d. " \
"'%s' is not\n", __FILE__, __LINE__, len, \
hexdump((const unsigned char *)(check), len)); \