mirror of
https://github.com/curl/curl.git
synced 2025-09-10 06:02:42 +03:00
parent
554e4c14be
commit
7991b5a85e
|
@ -433,33 +433,25 @@ int curl_dbg_fclose(FILE *file, int line, const char *source)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LOGLINE_BUFSIZE 1024
|
|
||||||
|
|
||||||
/* this does the writing to the memory tracking log file */
|
/* this does the writing to the memory tracking log file */
|
||||||
void curl_dbg_log(const char *format, ...)
|
void curl_dbg_log(const char *format, ...)
|
||||||
{
|
{
|
||||||
char *buf;
|
char buf[1024];
|
||||||
int nchars;
|
int nchars;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if(!curl_dbg_logfile)
|
if(!curl_dbg_logfile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
buf = (Curl_cmalloc)(LOGLINE_BUFSIZE);
|
|
||||||
if(!buf)
|
|
||||||
return;
|
|
||||||
|
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
nchars = mvsnprintf(buf, LOGLINE_BUFSIZE, format, ap);
|
nchars = mvsnprintf(buf, sizeof(buf), format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if(nchars > LOGLINE_BUFSIZE - 1)
|
if(nchars > (int)sizeof(buf) - 1)
|
||||||
nchars = LOGLINE_BUFSIZE - 1;
|
nchars = (int)sizeof(buf) - 1;
|
||||||
|
|
||||||
if(nchars > 0)
|
if(nchars > 0)
|
||||||
fwrite(buf, 1, (size_t)nchars, curl_dbg_logfile);
|
fwrite(buf, 1, (size_t)nchars, curl_dbg_logfile);
|
||||||
|
|
||||||
(Curl_cfree)(buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CURLDEBUG */
|
#endif /* CURLDEBUG */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user