curlx: move fopen and multibyte to curlx_malloc

Let's see what fallout this makes
This commit is contained in:
Daniel Stenberg 2025-11-28 15:06:30 +01:00
parent c421c3e325
commit 2613bd922a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 18 additions and 28 deletions

View file

@ -27,10 +27,8 @@
#ifdef CURLDEBUG
#include <curl/curl.h>
#include "urldata.h"
#include "curl_threads.h"
#include "curlx/fopen.h" /* for CURLX_FOPEN_LOW(), CURLX_FREOPEN_LOW() */
#ifdef USE_BACKTRACE
#include "backtrace.h"
@ -128,7 +126,8 @@ void curl_dbg_memdebug(const char *logname)
{
if(!curl_dbg_logfile) {
if(logname && *logname)
curl_dbg_logfile = CURLX_FOPEN_LOW(logname, FOPEN_WRITETEXT);
/* !checksrc! disable BANNEDFUNC 1 - accept fopen() */
curl_dbg_logfile = fopen(logname, "wt");
#ifdef MEMDEBUG_LOG_SYNC
/* Flush the log file after every line so the log is not lost in a crash */
if(curl_dbg_logfile)
@ -478,7 +477,8 @@ ALLOC_FUNC
FILE *curl_dbg_fopen(const char *file, const char *mode,
int line, const char *source)
{
FILE *res = CURLX_FOPEN_LOW(file, mode);
/* !checksrc! disable BANNEDFUNC 1 use fopen here */
FILE *res = fopen(file, mode);
if(source)
curl_dbg_log("FILE %s:%d fopen(\"%s\",\"%s\") = %p\n",
source, line, file, mode, (void *)res);
@ -490,7 +490,8 @@ ALLOC_FUNC
FILE *curl_dbg_freopen(const char *file, const char *mode, FILE *fh,
int line, const char *source)
{
FILE *res = CURLX_FREOPEN_LOW(file, mode, fh);
/* !checksrc! disable BANNEDFUNC 1 - accept freopen() */
FILE *res = freopen(file, mode, fh);
if(source)
curl_dbg_log("FILE %s:%d freopen(\"%s\",\"%s\",%p) = %p\n",
source, line, file, mode, (void *)fh, (void *)res);