From: Viktor Szakats Date: Sat, 5 Jul 2025 09:23:09 +0000 (+0200) Subject: memdebug.h: eliminate global macro `CURL_MT_LOGFNAME_BUFSIZE` X-Git-Tag: curl-8_15_0~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05263820e526edd81bc681cc499981aadfc8934e;p=thirdparty%2Fcurl.git 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 --- 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);