-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
windows: fixup fopen()
in CURLDEBUG
builds
#16747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 task
This comment was marked as outdated.
This comment was marked as outdated.
vszakats
added a commit
that referenced
this pull request
Jun 16, 2025
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
fopen
, sclose
, fake_sclose
macrosfopen
, fake_sclose
macros
fopen
, fake_sclose
macrosfopen()
in Unicode CURLDEBUG
builds
fopen()
in Unicode CURLDEBUG
buildsfopen()
in CURLDEBUG
builds
fopen()
in CURLDEBUG
buildsfopen()
in CURLDEBUG
builds
denandz
pushed a commit
to denandz/curl
that referenced
this pull request
Jun 21, 2025
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: curl#16747 Closes curl#16746 Closes curl#16738 Closes curl#17631
denandz
pushed a commit
to denandz/curl
that referenced
this pull request
Jun 21, 2025
Introduce an immutable `CURL_FOPEN()` macro to store the `fopen()` mapping on Windows. Then use that instead `(fopen)` from `memdebug.c`. It makes CURLDEBUG builds use the correct `fopen` wrapper on Windows. This macro is only defined on Windows, as of this patch. This is necessary after cde81e4, which no longer applies the default `fopen()` override to `memdebug.c`. Also: - curl_setup.h: de-dupe, simplify Windows file I/O function overrides. - curl_memory.h: fix to reset `fopen` to `curlx_win32_fopen()` on Windows. Before this patch it reset it to stock `fopen()`. Follow-up to cde81e4 curl#17631 Closes curl#16747
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce an immutable
CURL_FOPEN()
macro to store thefopen()
mapping on Windows. Then use that instead
(fopen)
frommemdebug.c
.It makes CURLDEBUG builds use the correct
fopen
wrapper on Windows.This macro is only defined on Windows, as of this patch.
This is necessary after cde81e4,
which no longer applies the default
fopen()
override tomemdebug.c
.Also:
fopen
tocurlx_win32_fopen()
onWindows. Before this patch it reset it to stock
fopen()
.Follow-up to cde81e4 #17631
w/o ws https://github.com/curl/curl/pull/16747/files?w=1
fake_sclose
tidy-up in another PR.