]> git.ipfire.org Git - thirdparty/curl.git/commit
memdebug: include in unity batch
authorViktor Szakats <commit@vsz.me>
Mon, 16 Jun 2025 00:07:31 +0000 (02:07 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 16 Jun 2025 07:35:01 +0000 (09:35 +0200)
commitcde81e4398f2944e60c73f38823dafa305a5a2f4
tree3eb13e7f92f1b7e809ac2198d7a08db0008a2534
parent2ac18d7ae46e9a8ba2355353a94072ca13a91ba9
memdebug: include in unity batch

Before this patch `memdebug.c` was compiled as a separate source in
unity builds. This was necessary because `memdebug.c` failed to compile
if `memdebug.h` was included before it, in `CURLDEBUG` mode. This patch
fixes this issue and allows to compile `memdebug.c` as part of the unity
source batch. This removes an exception and makes builds perform a notch
better.

- introduce `CURL_SCLOSE()` macro as an immutable synonym of `sclose()`.
- memdebug: replace `sclose()` reference with `CURL_SCLOSE()` to compile
  as expected when `sclose()` is overridden by `memdebug.h`.
- memdebug: make it not break when including `memdebug.h` before it in
  `CURLDEBUG` mode. Do this by calling low-level functions as
  `(function)`.
- autotools, cmake: drop memdebug exception, include it like any other
  source file. This is now possible because `memdebug.c` doesn't break
  if `memdebug.h` was included before it, in `CURLDEBUG` builds.
- mk-unity: drop `--exclude` option. No longer used after this patch.
- drop `MEMDEBUG_NODEFINES` macro hack. No longer necessary.

Ref: #16747
Closes #16746
Closes #16738
Closes #17631
lib/CMakeLists.txt
lib/Makefile.am
lib/curl_memory.h
lib/curl_setup_once.h
lib/memdebug.c
lib/memdebug.h
scripts/mk-unity.pl