]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
memdebug: replace macro constant with `sizeof()`
authorViktor Szakats <commit@vsz.me>
Sat, 29 Nov 2025 22:12:47 +0000 (23:12 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 1 Dec 2025 20:32:10 +0000 (21:32 +0100)
Closes #19795

lib/memdebug.c

index b6c2d854c33ee36d41fe179531d929ab142c601c..bbd7407c3c90578a1582304798c73685c6d6cd83 100644 (file)
@@ -63,8 +63,7 @@ static long memsize = 0;  /* set number of mallocs allowed */
 static struct backtrace_state *btstate;
 #endif
 
-#define KEEPSIZE 10000
-static char membuf[KEEPSIZE];
+static char membuf[10000];
 static size_t memwidx = 0; /* write index */
 
 #if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
@@ -549,7 +548,7 @@ void curl_dbg_log(const char *format, ...)
     if(lock_mutex)
       Curl_mutex_acquire(&dbg_mutex);
 #endif
-    if(KEEPSIZE - nchars < memwidx) {
+    if(sizeof(membuf) - nchars < memwidx) {
       /* flush */
       fwrite(membuf, 1, memwidx, curl_dbg_logfile);
       fflush(curl_dbg_logfile);