]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
memdebug.h: eliminate global macro `CURL_MT_LOGFNAME_BUFSIZE`
authorViktor Szakats <commit@vsz.me>
Sat, 5 Jul 2025 09:23:09 +0000 (11:23 +0200)
committerViktor Szakats <commit@vsz.me>
Sun, 6 Jul 2025 18:08:58 +0000 (20:08 +0200)
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
src/tool_main.c

index 0493bf61bc85a77f2e1d0a2078378e9b06930cbf..2038dc34d396f26b5bf8c056c96d514e18e116ea 100644 (file)
@@ -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
index b1135f86283a27c79389cd33a7b296575db16db2..4fb92d473bdfcc8510418e1dde0d114bb409ffbc 100644 (file)
@@ -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);