From 05263820e526edd81bc681cc499981aadfc8934e Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 5 Jul 2025 11:23:09 +0200 Subject: [PATCH] memdebug.h: eliminate global macro `CURL_MT_LOGFNAME_BUFSIZE` It had a single use in `src/tool_main.c`. Replace with a literal and `sizeof()`s. Follow-up to aaab5fa299e13c0c3abba929cb187a8ec3b006f9 Cherry-picked from #17827 Closes #17833 --- lib/memdebug.h | 2 -- src/tool_main.c | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/memdebug.h b/lib/memdebug.h index 0493bf61bc..2038dc34d3 100644 --- a/lib/memdebug.h +++ b/lib/memdebug.h @@ -56,8 +56,6 @@ # define ALLOC_SIZE2(n, s) #endif -#define CURL_MT_LOGFNAME_BUFSIZE 512 - /* Avoid redundant redeclaration warnings with modern compilers, when including this header multiple times. */ #ifndef HEADER_CURL_MEMDEBUG_H_EXTERNS diff --git a/src/tool_main.c b/src/tool_main.c index b1135f8628..4fb92d473b 100644 --- a/src/tool_main.c +++ b/src/tool_main.c @@ -116,9 +116,9 @@ static void memory_tracking_init(void) env = curl_getenv("CURL_MEMDEBUG"); if(env) { /* use the value as filename */ - char fname[CURL_MT_LOGFNAME_BUFSIZE]; - if(strlen(env) >= CURL_MT_LOGFNAME_BUFSIZE) - env[CURL_MT_LOGFNAME_BUFSIZE-1] = '\0'; + char fname[512]; + if(strlen(env) >= sizeof(fname)) + env[sizeof(fname)-1] = '\0'; strcpy(fname, env); curl_free(env); curl_dbg_memdebug(fname); -- 2.47.2