mirror of
https://github.com/curl/curl.git
synced 2026-07-30 20:58:06 +03:00
windows: fixup fopen() in CURLDEBUG builds
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 aftercde81e4398, 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 tocde81e4398#17631 Closes #16747
This commit is contained in:
parent
cde81e4398
commit
6828009695
3 changed files with 44 additions and 48 deletions
|
|
@ -78,7 +78,11 @@ void curl_dbg_memdebug(const char *logname)
|
|||
{
|
||||
if(!curl_dbg_logfile) {
|
||||
if(logname && *logname)
|
||||
#ifdef CURL_FOPEN
|
||||
curl_dbg_logfile = CURL_FOPEN(logname, FOPEN_WRITETEXT);
|
||||
#else
|
||||
curl_dbg_logfile = (fopen)(logname, FOPEN_WRITETEXT);
|
||||
#endif
|
||||
else
|
||||
curl_dbg_logfile = stderr;
|
||||
#ifdef MEMDEBUG_LOG_SYNC
|
||||
|
|
@ -414,7 +418,12 @@ ALLOC_FUNC
|
|||
FILE *curl_dbg_fopen(const char *file, const char *mode,
|
||||
int line, const char *source)
|
||||
{
|
||||
FILE *res = (fopen)(file, mode);
|
||||
FILE *res;
|
||||
#ifdef CURL_FOPEN
|
||||
res = CURL_FOPEN(file, mode);
|
||||
#else
|
||||
res = (fopen)(file, mode);
|
||||
#endif
|
||||
|
||||
if(source)
|
||||
curl_dbg_log("FILE %s:%d fopen(\"%s\",\"%s\") = %p\n",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue