]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: assume `snprintf()` in `mprintf`, drop feature check
authorViktor Szakats <commit@vsz.me>
Fri, 27 Feb 2026 15:10:59 +0000 (16:10 +0100)
committerViktor Szakats <commit@vsz.me>
Sat, 21 Mar 2026 12:30:37 +0000 (13:30 +0100)
- it was already required for `curl_*printf()` float/double support.
- some curl tests always fail without it.
- it was already assumed to be present to build test servers.
  Source code did not check for `HAVE_SNPRINTF` detection variable.
- it was already required to build examples.

Windows builds stopped using this detection and the function via earlier
commits.

Follow-up to 64f28b8f8859fc80816f7db3b5c4b6f2fd84bd27 #20765
Follow-up to 935b1bd4544a23a91d68ffb9f86983e92747e9a5 #9570 #9569

Closes #20763

CMake/unix-cache.cmake
CMakeLists.txt
configure.ac
lib/curl_config-cmake.h.in
lib/mprintf.c

index 5e26d12096d9906832ce8ea8035adc6f1ab6f12d..51bfa17d2918686c41cb5e907f411d7e84503a61 100644 (file)
@@ -228,7 +228,6 @@ set(HAVE_SIGACTION 1)
 set(HAVE_SIGINTERRUPT 1)
 set(HAVE_SIGNAL 1)
 set(HAVE_SIGSETJMP 1)
-set(HAVE_SNPRINTF 1)
 set(HAVE_SOCKADDR_IN6_SIN6_ADDR 1)
 set(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1)
 set(HAVE_SOCKET 1)
index 8831937b8add0f1eb6df61cedf287ee8b6020869..1b1f8231d66d5a9ad8e7684aa93de03262588bf8 100644 (file)
@@ -1636,7 +1636,6 @@ if(NOT WIN32)
   check_function_exists("if_nametoindex"  HAVE_IF_NAMETOINDEX)  # net/if.h
   check_function_exists("realpath"        HAVE_REALPATH)
   check_function_exists("sched_yield"     HAVE_SCHED_YIELD)
-  check_function_exists("snprintf"        HAVE_SNPRINTF)  # to match detection method in ./configure
   check_symbol_exists("strcasecmp"        "string.h" HAVE_STRCASECMP)
   check_symbol_exists("stricmp"           "string.h" HAVE_STRICMP)
   check_symbol_exists("strcmpi"           "string.h" HAVE_STRCMPI)
index b5ec678c76b56e076b1b66dbd01339d2e5a14d6f..46df82ed65acafe3858e7f4aec971837ff255f81 100644 (file)
@@ -4198,7 +4198,6 @@ if test "$curl_cv_native_windows" != "yes"; then
     if_nametoindex \
     realpath \
     sched_yield \
-    snprintf \
   ])
   CURL_CHECK_FUNC_INET_NTOP
   CURL_CHECK_FUNC_INET_PTON
index 1dcab9d8976fee32c53ed3cf95dec21ed56ef6cd..fec13419b79d424126dbac685c7c6210cad528c4 100644 (file)
 /* Define to 1 if you have the sigsetjmp function or macro. */
 #cmakedefine HAVE_SIGSETJMP 1
 
-/* Define to 1 if you have the `snprintf' function. */
-#cmakedefine HAVE_SNPRINTF 1
-
 /* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */
 #cmakedefine HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
 
index df9c0f4752e4379f7291af18508bb8b3e63947db..8a6a26c0e9fa30f82002398c3a89a8f1b96c2f26 100644 (file)
@@ -678,14 +678,11 @@ static bool out_double(void *userp,
 #endif
 #ifdef _WIN32
   curlx_win32_snprintf(work, BUFFSIZE, fmt, dnum);
-#elif defined(HAVE_SNPRINTF)
+#else
   /* !checksrc! disable BANNEDFUNC 1 */
   /* !checksrc! disable LONGLINE */
   /* NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling) */
   snprintf(work, BUFFSIZE, fmt, dnum);
-#else
-  /* float and double outputs do not work without snprintf support */
-  work[0] = 0;
 #endif
 #ifdef CURL_HAVE_DIAG
 #pragma GCC diagnostic pop