]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: stop overriding system printf symbols
authorViktor Szakats <commit@vsz.me>
Sat, 4 Oct 2025 10:58:49 +0000 (12:58 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 6 Oct 2025 18:57:59 +0000 (20:57 +0200)
After this patch, the codebase no longer overrides system printf
functions. Instead it explicitly calls either the curl printf functions
`curl_m*printf()` or the system ones using their original names.

Also:
- drop unused `curl_printf.h` includes.
- checksrc: ban system printf functions, allow where necessary.

Follow-up to db98daab05aec251bcb6615d2d38dfebec291736 #18844
Follow-up to 4deea9396bc7dd25c6362fa746a57bf309c74ada #18814

Closes #18866

147 files changed:
REUSE.toml
docs/examples/.checksrc
lib/.checksrc [deleted file]
lib/Makefile.am
lib/altsvc.c
lib/asyn-ares.c
lib/asyn-thrdd.c
lib/bufq.c
lib/cf-h1-proxy.c
lib/cf-h2-proxy.c
lib/cf-haproxy.c
lib/cf-https-connect.c
lib/cf-ip-happy.c
lib/cf-socket.c
lib/cfilters.c
lib/conncache.c
lib/connect.c
lib/content_encoding.c
lib/cookie.c
lib/cshutdn.c
lib/curl_addrinfo.c
lib/curl_fopen.c
lib/curl_gssapi.c
lib/curl_ntlm_core.c
lib/curl_printf.h
lib/curl_rtmp.c
lib/curl_sasl.c
lib/curl_setup.h
lib/curl_trc.c
lib/curlx/.checksrc [deleted file]
lib/cw-out.c
lib/cw-pause.c
lib/dict.c
lib/dllmain.c
lib/doh.c
lib/dynhds.c
lib/easy.c
lib/escape.c
lib/fake_addrinfo.c
lib/file.c
lib/formdata.c
lib/ftp.c
lib/ftplistparser.c
lib/gopher.c
lib/hash.c
lib/headers.c
lib/hostip.c
lib/hostip4.c
lib/hostip6.c
lib/hsts.c
lib/http.c
lib/http1.c
lib/http2.c
lib/http_aws_sigv4.c
lib/http_chunks.c
lib/http_digest.c
lib/http_negotiate.c
lib/http_ntlm.c
lib/http_proxy.c
lib/httpsrr.c
lib/idn.c
lib/if2ip.c
lib/imap.c
lib/ldap.c
lib/md4.c
lib/md5.c
lib/memdebug.c
lib/mime.c
lib/mqtt.c
lib/multi.c
lib/multi_ev.c
lib/netrc.c
lib/noproxy.c
lib/openldap.c
lib/pingpong.c
lib/pop3.c
lib/progress.c
lib/psl.c
lib/rand.c
lib/rename.c
lib/request.c
lib/rtsp.c
lib/select.c
lib/sendf.c
lib/setopt.c
lib/sha256.c
lib/share.c
lib/smb.c
lib/smtp.c
lib/socketpair.c
lib/socks.c
lib/socks_gssapi.c
lib/socks_sspi.c
lib/telnet.c
lib/tftp.c
lib/transfer.c
lib/uint-bset.c
lib/uint-spbset.c
lib/uint-table.c
lib/url.c
lib/urlapi.c
lib/vauth/.checksrc [deleted file]
lib/vauth/cleartext.c
lib/vauth/cram.c
lib/vauth/digest.c
lib/vauth/gsasl.c
lib/vauth/krb5_gssapi.c
lib/vauth/ntlm.c
lib/vauth/oauth2.c
lib/vauth/vauth.c
lib/version.c
lib/vquic/.checksrc [deleted file]
lib/vquic/curl_ngtcp2.c
lib/vquic/curl_osslq.c
lib/vquic/curl_quiche.c
lib/vquic/vquic-tls.c
lib/vquic/vquic.c
lib/vssh/.checksrc [deleted file]
lib/vssh/libssh.c
lib/vssh/libssh2.c
lib/vtls/.checksrc [deleted file]
lib/vtls/cipher_suite.c
lib/vtls/gtls.c
lib/vtls/mbedtls.c
lib/vtls/mbedtls_threadlock.c
lib/vtls/openssl.c
lib/vtls/rustls.c
lib/vtls/schannel.c
lib/vtls/schannel_verify.c
lib/vtls/vtls.c
lib/vtls/vtls_scache.c
lib/vtls/wolfssl.c
lib/vtls/x509asn1.c
lib/ws.c
packages/OS400/curlcl.c
scripts/.checksrc [new file with mode: 0644]
scripts/Makefile.am
scripts/checksrc.pl
src/.checksrc
tests/cmake/test.c
tests/libtest/.checksrc [deleted file]
tests/libtest/Makefile.am
tests/server/.checksrc
tests/tunit/.checksrc [deleted file]
tests/tunit/Makefile.am
tests/unit/.checksrc [deleted file]
tests/unit/Makefile.am

index 0d07c8b3e1522841a3db4fde7a8633e76521562c..d3b98edb4879c9cada4addf0043fedbc6285617a 100644 (file)
@@ -41,17 +41,9 @@ path = [
   "tests/valgrind.supp",
   # checksrc control files
   "docs/examples/.checksrc",
-  "lib/.checksrc",
-  "lib/curlx/.checksrc",
-  "lib/vauth/.checksrc",
-  "lib/vquic/.checksrc",
-  "lib/vssh/.checksrc",
-  "lib/vtls/.checksrc",
+  "scripts/.checksrc",
   "src/.checksrc",
-  "tests/libtest/.checksrc",
   "tests/server/.checksrc",
-  "tests/tunit/.checksrc",
-  "tests/unit/.checksrc",
 ]
 SPDX-FileCopyrightText = "Daniel Stenberg, <daniel@haxx.se>, et al."
 SPDX-License-Identifier = "curl"
index 336e1928d2062c56212e13251cdce835955520a2..59899762bfde52a7f1b29573625230ea0e38ade7 100644 (file)
@@ -1,9 +1,11 @@
 allowfunc fclose
 allowfunc fdopen
 allowfunc fopen
+allowfunc fprintf
 allowfunc gmtime
 allowfunc localtime
 allowfunc open
+allowfunc printf
 allowfunc snprintf
 allowfunc socket
 allowfunc sscanf
diff --git a/lib/.checksrc b/lib/.checksrc
deleted file mode 100644 (file)
index e69de29..0000000
index 973876f501089322a0730c42845aac2f8ca58866..784b7f35d61e84fc971f4eb75b1502c8757c3f6e 100644 (file)
@@ -28,12 +28,9 @@ include Makefile.inc
 
 CMAKE_DIST = CMakeLists.txt curl_config.h.cmake
 
-CHECKSRC_DIST = .checksrc \
-  curlx/.checksrc vauth/.checksrc vquic/.checksrc vssh/.checksrc vtls/.checksrc
-
 EXTRA_DIST = config-mac.h config-os400.h config-plan9.h config-riscos.h \
   config-win32.h curl_config.h.in $(LIB_RCFILES) libcurl.def            \
-  $(CMAKE_DIST) Makefile.soname optiontable.pl $(CHECKSRC_DIST)
+  $(CMAKE_DIST) Makefile.soname optiontable.pl
 
 lib_LTLIBRARIES = libcurl.la
 
index 7e4c4b5c25a73d57d57da07e6886c3902c8d346a..449bea8528dc595b75ed619367ae81a5d1a2087c 100644 (file)
@@ -42,8 +42,7 @@
 #include "curlx/strparse.h"
 #include "connect.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -270,23 +269,23 @@ static CURLcode altsvc_out(struct altsvc *as, FILE *fp)
     }
   }
 #endif
-  fprintf(fp,
-          "%s %s%s%s %u "
-          "%s %s%s%s %u "
-          "\"%d%02d%02d "
-          "%02d:%02d:%02d\" "
-          "%u %u\n",
-          Curl_alpnid2str(as->src.alpnid),
-          src6_pre, as->src.host, src6_post,
-          as->src.port,
-
-          Curl_alpnid2str(as->dst.alpnid),
-          dst6_pre, as->dst.host, dst6_post,
-          as->dst.port,
-
-          stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
-          stamp.tm_hour, stamp.tm_min, stamp.tm_sec,
-          as->persist, as->prio);
+  curl_mfprintf(fp,
+                "%s %s%s%s %u "
+                "%s %s%s%s %u "
+                "\"%d%02d%02d "
+                "%02d:%02d:%02d\" "
+                "%u %u\n",
+                Curl_alpnid2str(as->src.alpnid),
+                src6_pre, as->src.host, src6_post,
+                as->src.port,
+
+                Curl_alpnid2str(as->dst.alpnid),
+                dst6_pre, as->dst.host, dst6_post,
+                as->dst.port,
+
+                stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
+                stamp.tm_hour, stamp.tm_min, stamp.tm_sec,
+                as->persist, as->prio);
   return CURLE_OK;
 }
 
index a9988806ac20e0d0b227fb982a1680f77da29b28..236697695eda9e25e7a29b22336a9a339dd73750 100644 (file)
 #define HTTPSRR_WORKS
 #endif
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -782,7 +781,7 @@ struct Curl_addrinfo *Curl_async_getaddrinfo(struct Curl_easy *data,
      * accordingly to save a call to getservbyname in inside C-Ares
      */
     hints.ai_flags = ARES_AI_NUMERICSERV;
-    msnprintf(service, sizeof(service), "%d", port);
+    curl_msnprintf(service, sizeof(service), "%d", port);
     ares->num_pending = 1;
     ares_getaddrinfo(ares->channel, data->state.async.hostname,
                      service, &hints, async_ares_addrinfo_cb, data);
index 2aa16de7287cdb50a938008ad52de9fa4aa1350b..dc13143e245daa253614628025a56fc10761e223 100644 (file)
@@ -73,8 +73,7 @@
 #endif
 #endif
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -220,7 +219,7 @@ static CURL_THREAD_RETURN_T CURL_STDCALL getaddrinfo_thread(void *arg)
     char service[12];
     int rc;
 
-    msnprintf(service, sizeof(service), "%d", addr_ctx->port);
+    curl_msnprintf(service, sizeof(service), "%d", addr_ctx->port);
 
     rc = Curl_getaddrinfo_ex(addr_ctx->hostname, service,
                              &addr_ctx->hints, &addr_ctx->res);
index 5cfd7520f2e65dd6dde726241c28818b4d74f7f3..e429ccf8e37598f38532ec82e0cda5a2916ec0c5 100644 (file)
@@ -25,8 +25,7 @@
 #include "curl_setup.h"
 #include "bufq.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 798d6e9f6681e22d2f039f6f30a36915b03a9990..e65aa74ddb87cebb689483c1c0f306eca46249c4 100644 (file)
@@ -46,8 +46,7 @@
 #include "multiif.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 17a15c1d2ada81ac899060bdf2a5b945b8e9134c..8baa227aac22d1259b86e9d6f4df5ad072f62f8b 100644 (file)
@@ -44,8 +44,7 @@
 #include "select.h"
 #include "cf-h2-proxy.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -101,8 +100,8 @@ static CURLcode tunnel_stream_init(struct Curl_cfilter *cf,
     return result;
 
   ts->authority = /* host:port with IPv6 support */
-    aprintf("%s%s%s:%d", ipv6_ip ? "[":"", hostname,
-            ipv6_ip ? "]" : "", port);
+    curl_maprintf("%s%s%s:%d", ipv6_ip ? "[":"", hostname,
+                  ipv6_ip ? "]" : "", port);
   if(!ts->authority)
     return CURLE_OUT_OF_MEMORY;
 
@@ -556,47 +555,47 @@ static int proxy_h2_fr_print(const nghttp2_frame *frame,
 {
   switch(frame->hd.type) {
     case NGHTTP2_DATA: {
-      return msnprintf(buffer, blen,
-                       "FRAME[DATA, len=%d, eos=%d, padlen=%d]",
-                       (int)frame->hd.length,
-                       !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM),
-                       (int)frame->data.padlen);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[DATA, len=%d, eos=%d, padlen=%d]",
+                            (int)frame->hd.length,
+                            !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM),
+                            (int)frame->data.padlen);
     }
     case NGHTTP2_HEADERS: {
-      return msnprintf(buffer, blen,
-                       "FRAME[HEADERS, len=%d, hend=%d, eos=%d]",
-                       (int)frame->hd.length,
-                       !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS),
-                       !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM));
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[HEADERS, len=%d, hend=%d, eos=%d]",
+                            (int)frame->hd.length,
+                            !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS),
+                            !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM));
     }
     case NGHTTP2_PRIORITY: {
-      return msnprintf(buffer, blen,
-                       "FRAME[PRIORITY, len=%d, flags=%d]",
-                       (int)frame->hd.length, frame->hd.flags);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[PRIORITY, len=%d, flags=%d]",
+                            (int)frame->hd.length, frame->hd.flags);
     }
     case NGHTTP2_RST_STREAM: {
-      return msnprintf(buffer, blen,
-                       "FRAME[RST_STREAM, len=%d, flags=%d, error=%u]",
-                       (int)frame->hd.length, frame->hd.flags,
-                       frame->rst_stream.error_code);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[RST_STREAM, len=%d, flags=%d, error=%u]",
+                            (int)frame->hd.length, frame->hd.flags,
+                            frame->rst_stream.error_code);
     }
     case NGHTTP2_SETTINGS: {
       if(frame->hd.flags & NGHTTP2_FLAG_ACK) {
-        return msnprintf(buffer, blen, "FRAME[SETTINGS, ack=1]");
+        return curl_msnprintf(buffer, blen, "FRAME[SETTINGS, ack=1]");
       }
-      return msnprintf(buffer, blen,
-                       "FRAME[SETTINGS, len=%d]", (int)frame->hd.length);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[SETTINGS, len=%d]", (int)frame->hd.length);
     }
     case NGHTTP2_PUSH_PROMISE:
-      return msnprintf(buffer, blen,
-                       "FRAME[PUSH_PROMISE, len=%d, hend=%d]",
-                       (int)frame->hd.length,
-                       !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS));
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[PUSH_PROMISE, len=%d, hend=%d]",
+                            (int)frame->hd.length,
+                            !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS));
     case NGHTTP2_PING:
-      return msnprintf(buffer, blen,
-                       "FRAME[PING, len=%d, ack=%d]",
-                       (int)frame->hd.length,
-                       frame->hd.flags & NGHTTP2_FLAG_ACK);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[PING, len=%d, ack=%d]",
+                            (int)frame->hd.length,
+                            frame->hd.flags & NGHTTP2_FLAG_ACK);
     case NGHTTP2_GOAWAY: {
       char scratch[128];
       size_t s_len = CURL_ARRAYSIZE(scratch);
@@ -605,19 +604,20 @@ static int proxy_h2_fr_print(const nghttp2_frame *frame,
       if(len)
         memcpy(scratch, frame->goaway.opaque_data, len);
       scratch[len] = '\0';
-      return msnprintf(buffer, blen, "FRAME[GOAWAY, error=%d, reason='%s', "
-                       "last_stream=%d]", frame->goaway.error_code,
-                       scratch, frame->goaway.last_stream_id);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[GOAWAY, error=%d, reason='%s', "
+                            "last_stream=%d]", frame->goaway.error_code,
+                            scratch, frame->goaway.last_stream_id);
     }
     case NGHTTP2_WINDOW_UPDATE: {
-      return msnprintf(buffer, blen,
-                       "FRAME[WINDOW_UPDATE, incr=%d]",
-                       frame->window_update.window_size_increment);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[WINDOW_UPDATE, incr=%d]",
+                            frame->window_update.window_size_increment);
     }
     default:
-      return msnprintf(buffer, blen, "FRAME[%d, len=%d, flags=%d]",
-                       frame->hd.type, (int)frame->hd.length,
-                       frame->hd.flags);
+      return curl_msnprintf(buffer, blen, "FRAME[%d, len=%d, flags=%d]",
+                            frame->hd.type, (int)frame->hd.length,
+                            frame->hd.flags);
   }
 }
 
index 2d66efea90400ff0ad7db90e945141f544376f58..3231791097eddb1150e69e7e53533eea4b91d2b8 100644 (file)
@@ -34,8 +34,7 @@
 #include "multiif.h"
 #include "select.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index b4a46052950225bd03e13d096baf34c700364aba..5d6724dbc5e2861ef6b85d85bfe9509e3b5cadc4 100644 (file)
@@ -38,8 +38,7 @@
 #include "select.h"
 #include "vquic/vquic.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index c0150dd087473e4428bc8084285366f61a3387ef..f6675e275db6c27c8108cca6009ef2d571422639 100644 (file)
@@ -60,8 +60,7 @@
 #include "select.h"
 #include "vquic/vquic.h" /* for quic cfilters */
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -662,7 +661,8 @@ static CURLcode is_connected(struct Curl_cfilter *cf,
 
 #ifdef USE_UNIX_SOCKETS
     if(conn->unix_domain_socket)
-      msnprintf(viamsg, sizeof(viamsg), "over %s", conn->unix_domain_socket);
+      curl_msnprintf(viamsg, sizeof(viamsg), "over %s",
+                     conn->unix_domain_socket);
     else
 #endif
     {
@@ -673,7 +673,7 @@ static CURLcode is_connected(struct Curl_cfilter *cf,
         port = conn->conn_to_port;
       else
         port = conn->remote_port;
-      msnprintf(viamsg, sizeof(viamsg), "port %u", port);
+      curl_msnprintf(viamsg, sizeof(viamsg), "port %u", port);
     }
 
     failf(data, "Failed to connect to %s %s %s%s%safter "
index aa79ac45a4f93fa700a9b847868d40727e3c9120..0182de67e80a36cb972dac95314931d79767bd85 100644 (file)
@@ -82,8 +82,7 @@
 #include "curlx/strerr.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 07f3c5f7b4622a8d3001c5e89ae6bdb8c383aee4..d0466f5fadb1a28cc04b44c139c2bd6a9791746b 100644 (file)
@@ -37,8 +37,7 @@
 #include "curlx/warnless.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index a8fc51c213528115ffd57f4857e009f440ebf54e..67e2a63d8a57671b05a7d494326adf1994f5e864 100644 (file)
@@ -45,8 +45,7 @@
 #include "curlx/strparse.h"
 #include "uint-table.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -895,7 +894,7 @@ void Curl_cpool_print(struct cpool *cpool)
   if(!cpool)
     return;
 
-  fprintf(stderr, "=Bundle cache=\n");
+  curl_mfprintf(stderr, "=Bundle cache=\n");
 
   Curl_hash_start_iterate(cpool->dest2bundle, &iter);
 
@@ -906,15 +905,15 @@ void Curl_cpool_print(struct cpool *cpool)
 
     bundle = he->ptr;
 
-    fprintf(stderr, "%s -", he->key);
+    curl_mfprintf(stderr, "%s -", he->key);
     curr = Curl_llist_head(bundle->conns);
     while(curr) {
       conn = Curl_node_elem(curr);
 
-      fprintf(stderr, " [%p %d]", (void *)conn, conn->refcount);
+      curl_mfprintf(stderr, " [%p %d]", (void *)conn, conn->refcount);
       curr = Curl_node_next(curr);
     }
-    fprintf(stderr, "\n");
+    curl_mfprintf(stderr, "\n");
 
     he = Curl_hash_next_element(&iter);
   }
index 4f42fef0e833b026cde2d5ac2ac6f890154e255b..efe6248214e99422dbdd51b072f798b26a075085 100644 (file)
@@ -75,8 +75,7 @@
 #include "http_proxy.h"
 #include "socks.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -267,7 +266,7 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen,
     case AF_UNIX:
       if(salen > (curl_socklen_t)sizeof(CURL_SA_FAMILY_T)) {
         su = (struct sockaddr_un*)sa;
-        msnprintf(addr, MAX_IPADR_LEN, "%s", su->sun_path);
+        curl_msnprintf(addr, MAX_IPADR_LEN, "%s", su->sun_path);
       }
       else
         addr[0] = 0; /* socket with no name */
index 3a0549c4b1a3ae94c1527012633f8daa8b674f09..28cccacdb64704f3a79436cee24139a144451348 100644 (file)
@@ -53,8 +53,7 @@
 #include "content_encoding.h"
 #include "strdup.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index c5fbe1344dd6835c277ae72367c52fe907308828..59a841a303c78d96d7de43791811238c473c17f6 100644 (file)
@@ -89,8 +89,7 @@ Example set of cookies:
 #include "llist.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -1479,7 +1478,7 @@ void Curl_cookie_cleanup(struct CookieInfo *ci)
  */
 static char *get_netscape_format(const struct Cookie *co)
 {
-  return aprintf(
+  return curl_maprintf(
     "%s"     /* httponly preamble */
     "%s%s\t" /* domain */
     "%s\t"   /* tailmatch */
@@ -1575,7 +1574,7 @@ static CURLcode cookie_output(struct Curl_easy *data,
         error = CURLE_OUT_OF_MEMORY;
         goto error;
       }
-      fprintf(out, "%s\n", format_ptr);
+      curl_mfprintf(out, "%s\n", format_ptr);
       free(format_ptr);
     }
 
index 1c144c6025f48f5f6cd2020d5f7b554556d05c53..c2788e7780a4841d014e87957ce60326c916fd90 100644 (file)
@@ -42,8 +42,7 @@
 #include "select.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index c4ad71a02e1a2702d9bd23516be953d53acf27c9..e26ee656bda4d3b1a13f1ce936b41e02126623e2 100644 (file)
@@ -53,8 +53,8 @@
 #include "fake_addrinfo.h"
 #include "curlx/inet_pton.h"
 #include "curlx/warnless.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 5e25f0eab60e3e59379703e267adc7687e189915..c41cff21cde94ca4eebba0a057575c868ab1fac0 100644 (file)
@@ -30,8 +30,8 @@
 #include "urldata.h"
 #include "rand.h"
 #include "curl_fopen.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -122,7 +122,7 @@ CURLcode Curl_fopen(struct Curl_easy *data, const char *filename,
   if(dir) {
     /* The temp filename should not end up too long for the target file
        system */
-    tempstore = aprintf("%s%s.tmp", dir, randbuf);
+    tempstore = curl_maprintf("%s%s.tmp", dir, randbuf);
     free(dir);
   }
 
index 92b867f7753b264b21e3832cf49f246b53992d14..87f644a9084fe11f51f942224bd359dcc4922617 100644 (file)
@@ -29,8 +29,7 @@
 #include "curl_gssapi.h"
 #include "sendf.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -244,9 +243,10 @@ stub_gss_init_sec_context(OM_uint32 *min,
     }
 
     /* Token format: creds:target:type:padding */
-    used = msnprintf(token, length, "%s:%.*s:%d:", creds,
-                     (int)target_desc.length, (const char *)target_desc.value,
-                     ctx->sent);
+    used = curl_msnprintf(token, length, "%s:%.*s:%d:", creds,
+                          (int)target_desc.length,
+                          (const char *)target_desc.value,
+                          ctx->sent);
 
     gss_release_buffer(&minor_status, &target_desc);
   }
@@ -387,9 +387,9 @@ static size_t display_gss_error(OM_uint32 status, int type,
                                   &status_string);
     if(maj_stat == GSS_S_COMPLETE && status_string.length > 0) {
       if(GSS_LOG_BUFFER_LEN > len + status_string.length + 3) {
-        len += msnprintf(buf + len, GSS_LOG_BUFFER_LEN - len,
-                         "%.*s. ", (int)status_string.length,
-                         (char *)status_string.value);
+        len += curl_msnprintf(buf + len, GSS_LOG_BUFFER_LEN - len,
+                              "%.*s. ", (int)status_string.length,
+                              (char *)status_string.value);
       }
     }
     gss_release_buffer(&min_stat, &status_string);
index e040db2ab659755c6697c3fcae21d7987fe3c5c0..cf0e4dc28832c29defc5658ed054847883e5e109 100644 (file)
 #include "curl_endian.h"
 #include "curl_des.h"
 #include "curl_md4.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -567,14 +567,15 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
     return CURLE_OUT_OF_MEMORY;
 
   /* Create the BLOB structure */
-  msnprintf((char *)ptr + HMAC_MD5_LENGTH, NTLMv2_BLOB_LEN,
-            "%c%c%c%c"           /* NTLMv2_BLOB_SIGNATURE */
-            "%c%c%c%c"           /* Reserved = 0 */
-            "%c%c%c%c%c%c%c%c",  /* Timestamp */
-            NTLMv2_BLOB_SIGNATURE[0], NTLMv2_BLOB_SIGNATURE[1],
-            NTLMv2_BLOB_SIGNATURE[2], NTLMv2_BLOB_SIGNATURE[3],
-            0, 0, 0, 0,
-            LONGQUARTET(tw.dwLowDateTime), LONGQUARTET(tw.dwHighDateTime));
+  curl_msnprintf((char *)ptr + HMAC_MD5_LENGTH, NTLMv2_BLOB_LEN,
+                 "%c%c%c%c"           /* NTLMv2_BLOB_SIGNATURE */
+                 "%c%c%c%c"           /* Reserved = 0 */
+                 "%c%c%c%c%c%c%c%c",  /* Timestamp */
+                 NTLMv2_BLOB_SIGNATURE[0], NTLMv2_BLOB_SIGNATURE[1],
+                 NTLMv2_BLOB_SIGNATURE[2], NTLMv2_BLOB_SIGNATURE[3],
+                 0, 0, 0, 0,
+                 LONGQUARTET(tw.dwLowDateTime),
+                 LONGQUARTET(tw.dwHighDateTime));
 
   memcpy(ptr + 32, challenge_client, 8);
   if(ntlm->target_info_len)
index 6e0fa1fa8d8450b65b46be01a5d7b150e4e30616..207ba7125d62ab9a358a5644c3adbdc31abd6cef 100644 (file)
@@ -24,8 +24,6 @@
  *
  ***************************************************************************/
 
-#include <curl/mprintf.h>
-
 #define MERR_OK        0
 #define MERR_MEM       1
 #define MERR_TOO_LARGE 2
@@ -36,29 +34,4 @@ extern const unsigned char Curl_ldigits[];
 /* Upper-case digits.  */
 extern const unsigned char Curl_udigits[];
 
-#ifdef BUILDING_LIBCURL
-
-/*
- * This header should be included by ALL code in libcurl that uses any
- * *rintf() functions.
- */
-
-# undef printf
-# undef fprintf
-# undef msnprintf
-# undef vprintf
-# undef vfprintf
-# undef mvsnprintf
-# undef aprintf
-# undef vaprintf
-# define printf curl_mprintf
-# define fprintf curl_mfprintf
-# define msnprintf curl_msnprintf
-# define vprintf curl_mvprintf
-# define vfprintf curl_mvfprintf
-# define mvsnprintf curl_mvsnprintf
-# define aprintf curl_maprintf
-# define vaprintf curl_mvaprintf
-
-#endif /* BUILDING_LIBCURL */
 #endif /* HEADER_CURL_PRINTF_H */
index baee79fbeecfc612d7b30284566ccd093de65564..7006ca5eb94e54304d7976238f38ebcfa42fa1d0 100644 (file)
@@ -37,8 +37,7 @@
 #include <curl/curl.h>
 #include <librtmp/rtmp.h>
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -386,9 +385,9 @@ void Curl_rtmp_version(char *version, size_t len)
   else
     suff[0] = '\0';
 
-  msnprintf(version, len, "librtmp/%d.%d%s",
-            RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff,
-            suff);
+  curl_msnprintf(version, len, "librtmp/%d.%d%s",
+                 RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff,
+                 suff);
 }
 
 #endif  /* USE_LIBRTMP */
index 9c86f3ea086e30b66ff1208170d6d0f962a19aa8..c907c2c27bb2a1b1e007dfa8461b0cfa8c897d6d 100644 (file)
@@ -51,8 +51,8 @@
 #include "curl_sasl.h"
 #include "curlx/warnless.h"
 #include "sendf.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index f6fe6535f463053fc651f5aee2ce4e79be003fb9..694d14df4f09b1b15b2b5884fae27054372c173d 100644 (file)
@@ -983,6 +983,8 @@ extern curl_calloc_callback Curl_ccalloc;
 #define Curl_safefree(ptr) \
   do { free((ptr)); (ptr) = NULL;} while(0)
 
+#include <curl/curl.h> /* for CURL_EXTERN, mprintf.h */
+
 #ifdef CURLDEBUG
 #ifdef __clang__
 #  define ALLOC_FUNC         __attribute__((__malloc__))
@@ -1007,8 +1009,6 @@ extern curl_calloc_callback Curl_ccalloc;
 #  define ALLOC_SIZE2(n, s)
 #endif
 
-#include <curl/curl.h> /* for CURL_EXTERN */
-
 extern FILE *curl_dbg_logfile;
 
 /* memory functions */
index e04c425b3249b31e494a075e3fc6f252362bcef9..7f234437f291ee427b793984c2f2ac94f7db2acd 100644 (file)
@@ -47,8 +47,7 @@
 #include "vtls/vtls.h"
 #include "vquic/vquic.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -102,14 +101,14 @@ static size_t trc_print_ids(struct Curl_easy *data, char *buf, size_t maxlen)
                    data->conn->connection_id : data->state.recent_conn_id;
   if(data->id >= 0) {
     if(cid >= 0)
-      return msnprintf(buf, maxlen, CURL_TRC_FMT_IDSDC, data->id, cid);
+      return curl_msnprintf(buf, maxlen, CURL_TRC_FMT_IDSDC, data->id, cid);
     else
-      return msnprintf(buf, maxlen, CURL_TRC_FMT_IDSD, data->id);
+      return curl_msnprintf(buf, maxlen, CURL_TRC_FMT_IDSD, data->id);
   }
   else if(cid >= 0)
-    return msnprintf(buf, maxlen, CURL_TRC_FMT_IDSC, cid);
+    return curl_msnprintf(buf, maxlen, CURL_TRC_FMT_IDSC, cid);
   else {
-    return msnprintf(buf, maxlen, "[x-x] ");
+    return curl_msnprintf(buf, maxlen, "[x-x] ");
   }
 }
 
@@ -143,8 +142,8 @@ void Curl_debug(struct Curl_easy *data, curl_infotype type,
 
       if(CURL_TRC_IDS(data) && (size < TRC_LINE_MAX)) {
         len = trc_print_ids(data, buf, TRC_LINE_MAX);
-        len += msnprintf(buf + len, TRC_LINE_MAX - len, "%.*s",
-                         (int)size, ptr);
+        len += curl_msnprintf(buf + len, TRC_LINE_MAX - len, "%.*s",
+                              (int)size, ptr);
         len = trc_end_buf(buf, len, TRC_LINE_MAX, FALSE);
         Curl_set_in_callback(data, TRUE);
         (void)(*data->set.fdebug)(data, type, buf, len, data->set.debugdata);
@@ -189,7 +188,7 @@ void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
     size_t len;
     char error[CURL_ERROR_SIZE + 2];
     va_start(ap, fmt);
-    len = mvsnprintf(error, CURL_ERROR_SIZE, fmt, ap);
+    len = curl_mvsnprintf(error, CURL_ERROR_SIZE, fmt, ap);
 
     if(data->set.errorbuffer && !data->state.errorbuf) {
       strcpy(data->set.errorbuffer, error);
@@ -220,15 +219,15 @@ static void trc_infof(struct Curl_easy *data,
   if(CURL_TRC_IDS(data))
     len += trc_print_ids(data, buf + len, TRC_LINE_MAX - len);
   if(feat)
-    len += msnprintf(buf + len, TRC_LINE_MAX - len, "[%s] ", feat->name);
+    len += curl_msnprintf(buf + len, TRC_LINE_MAX - len, "[%s] ", feat->name);
   if(opt_id) {
     if(opt_id_idx > 0)
-      len += msnprintf(buf + len, TRC_LINE_MAX - len, "[%s-%d] ",
-                       opt_id, opt_id_idx);
+      len += curl_msnprintf(buf + len, TRC_LINE_MAX - len, "[%s-%d] ",
+                            opt_id, opt_id_idx);
     else
-      len += msnprintf(buf + len, TRC_LINE_MAX - len, "[%s] ", opt_id);
+      len += curl_msnprintf(buf + len, TRC_LINE_MAX - len, "[%s] ", opt_id);
   }
-  len += mvsnprintf(buf + len, TRC_LINE_MAX - len, fmt, ap);
+  len += curl_mvsnprintf(buf + len, TRC_LINE_MAX - len, fmt, ap);
   len = trc_end_buf(buf, len, TRC_LINE_MAX, TRUE);
   trc_write(data, CURLINFO_TEXT, buf, len);
 }
diff --git a/lib/curlx/.checksrc b/lib/curlx/.checksrc
deleted file mode 100644 (file)
index e69de29..0000000
index 6d988a00bf8435b168fec7999f3b0b9ff8d59d6e..7a9274b5f21b61f332eff9dcd0b792f0c8c2e743 100644 (file)
@@ -35,8 +35,7 @@
 #include "cw-out.h"
 #include "cw-pause.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 9b9554c551570cb63c7a3c3514d381bc94133067..1af4e8fa4192cdb9da1303f925aed5d0b7205e4a 100644 (file)
@@ -34,8 +34,7 @@
 #include "sendf.h"
 #include "cw-pause.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 819584f284a0f8582e38b99a0681ef2241c0a605..3296a45466ad074c6b107ee8ea55118f8a2c3e68 100644 (file)
@@ -59,9 +59,9 @@
 #include "escape.h"
 #include "progress.h"
 #include "dict.h"
-#include "curl_printf.h"
+
+/* The last 2 #include files should be: */
 #include "curl_memory.h"
-/* The last #include file should be: */
 #include "memdebug.h"
 
 
@@ -144,7 +144,7 @@ static CURLcode sendf(struct Curl_easy *data, const char *fmt, ...)
   char *sptr;
   va_list ap;
   va_start(ap, fmt);
-  s = vaprintf(fmt, ap); /* returns an allocated string */
+  s = curl_mvaprintf(fmt, ap); /* returns an allocated string */
   va_end(ap);
   if(!s)
     return CURLE_OUT_OF_MEMORY; /* failure */
index 7ac457ae0552530f9533647227dc2b0569f1a478..d871a524847b8200ed05b52db4d49877526f1359 100644 (file)
@@ -28,8 +28,7 @@
 #include <openssl/crypto.h>
 #endif
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 15e01357b82cbbc0faf4f674ecd9af6237712515..3dd7a2872d2f5226614e545e47ccbe41e6915772 100644 (file)
--- a/lib/doh.c
+++ b/lib/doh.c
@@ -41,8 +41,7 @@
 #include "escape.h"
 #include "urlapi-int.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -513,7 +512,7 @@ struct Curl_addrinfo *Curl_doh(struct Curl_easy *data,
     /* Only use HTTPS RR for HTTP(S) transfers */
     char *qname = NULL;
     if(port != PORT_HTTPS) {
-      qname = aprintf("_%d._https.%s", port, hostname);
+      qname = curl_maprintf("_%d._https.%s", port, hostname);
       if(!qname)
         goto error;
     }
@@ -890,8 +889,9 @@ static void doh_show(struct Curl_easy *data,
       len = sizeof(buffer) - len;
       for(j = 0; j < 16; j += 2) {
         size_t l;
-        msnprintf(ptr, len, "%s%02x%02x", j ? ":" : "", d->addr[i].ip.v6[j],
-                  d->addr[i].ip.v6[j + 1]);
+        curl_msnprintf(ptr, len, "%s%02x%02x", j ? ":" : "",
+                       d->addr[i].ip.v6[j],
+                       d->addr[i].ip.v6[j + 1]);
         l = strlen(ptr);
         len -= l;
         ptr += l;
index dcb9193a8bebb3e381867b594dd1c87304bef7cd..95d415bf0b492a335bb01a6b315bf115e2965364 100644 (file)
 #include "dynhds.h"
 #include "strcase.h"
 
-/* The last 3 #include files should be in this order */
 #ifdef USE_NGHTTP2
 #include <stdint.h>
 #include <nghttp2/nghttp2.h>
 #endif /* USE_NGHTTP2 */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 7a36034c03e352b0880d70d28f0b4fed6941c1d9..877cf13b9baf7836277005668fd77b33371f992f 100644 (file)
@@ -80,8 +80,7 @@
 
 #include "easy_lock.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -157,42 +156,42 @@ static CURLcode global_init(long flags, bool memoryfuncs)
   }
 
   if(Curl_trc_init()) {
-    DEBUGF(fprintf(stderr, "Error: Curl_trc_init failed\n"));
+    DEBUGF(curl_mfprintf(stderr, "Error: Curl_trc_init failed\n"));
     goto fail;
   }
 
   if(!Curl_ssl_init()) {
-    DEBUGF(fprintf(stderr, "Error: Curl_ssl_init failed\n"));
+    DEBUGF(curl_mfprintf(stderr, "Error: Curl_ssl_init failed\n"));
     goto fail;
   }
 
   if(!Curl_vquic_init()) {
-    DEBUGF(fprintf(stderr, "Error: Curl_vquic_init failed\n"));
+    DEBUGF(curl_mfprintf(stderr, "Error: Curl_vquic_init failed\n"));
     goto fail;
   }
 
   if(Curl_win32_init(flags)) {
-    DEBUGF(fprintf(stderr, "Error: win32_init failed\n"));
+    DEBUGF(curl_mfprintf(stderr, "Error: win32_init failed\n"));
     goto fail;
   }
 
   if(Curl_amiga_init()) {
-    DEBUGF(fprintf(stderr, "Error: Curl_amiga_init failed\n"));
+    DEBUGF(curl_mfprintf(stderr, "Error: Curl_amiga_init failed\n"));
     goto fail;
   }
 
   if(Curl_macos_init()) {
-    DEBUGF(fprintf(stderr, "Error: Curl_macos_init failed\n"));
+    DEBUGF(curl_mfprintf(stderr, "Error: Curl_macos_init failed\n"));
     goto fail;
   }
 
   if(Curl_async_global_init()) {
-    DEBUGF(fprintf(stderr, "Error: resolver_global_init failed\n"));
+    DEBUGF(curl_mfprintf(stderr, "Error: resolver_global_init failed\n"));
     goto fail;
   }
 
   if(Curl_ssh_init()) {
-    DEBUGF(fprintf(stderr, "Error: Curl_ssh_init failed\n"));
+    DEBUGF(curl_mfprintf(stderr, "Error: Curl_ssh_init failed\n"));
     goto fail;
   }
 
@@ -361,7 +360,7 @@ CURL *curl_easy_init(void)
     result = global_init(CURL_GLOBAL_DEFAULT, TRUE);
     if(result) {
       /* something in the global init failed, return nothing */
-      DEBUGF(fprintf(stderr, "Error: curl_global_init failed\n"));
+      DEBUGF(curl_mfprintf(stderr, "Error: curl_global_init failed\n"));
       global_init_unlock();
       return NULL;
     }
@@ -371,7 +370,7 @@ CURL *curl_easy_init(void)
   /* We use curl_open() with undefined URL so far */
   result = Curl_open(&data);
   if(result) {
-    DEBUGF(fprintf(stderr, "Error: Curl_open failed\n"));
+    DEBUGF(curl_mfprintf(stderr, "Error: Curl_open failed\n"));
     return NULL;
   }
 
@@ -407,7 +406,7 @@ static int events_timer(CURLM *multi,    /* multi handle */
   struct events *ev = userp;
   (void)multi;
 #if DEBUG_EV_POLL
-  fprintf(stderr, "events_timer: set timeout %ldms\n", timeout_ms);
+  curl_mfprintf(stderr, "events_timer: set timeout %ldms\n", timeout_ms);
 #endif
   ev->ms = timeout_ms;
   ev->msbump = TRUE;
@@ -559,7 +558,7 @@ static unsigned int populate_fds(struct pollfd *fds, struct events *ev)
     f->events = m->socket.events;
     f->revents = 0;
 #if DEBUG_EV_POLL
-    fprintf(stderr, "poll() %d check socket %d\n", numfds, f->fd);
+    curl_mfprintf(stderr, "poll() %d check socket %d\n", numfds, f->fd);
 #endif
     f++;
     numfds++;
@@ -579,19 +578,19 @@ static CURLcode poll_fds(struct events *ev,
   if(numfds) {
     /* wait for activity or timeout */
 #if DEBUG_EV_POLL
-    fprintf(stderr, "poll(numfds=%u, timeout=%ldms)\n", numfds, ev->ms);
+    curl_mfprintf(stderr, "poll(numfds=%u, timeout=%ldms)\n", numfds, ev->ms);
 #endif
     *pollrc = Curl_poll(fds, numfds, ev->ms);
 #if DEBUG_EV_POLL
-    fprintf(stderr, "poll(numfds=%u, timeout=%ldms) -> %d\n",
-            numfds, ev->ms, *pollrc);
+    curl_mfprintf(stderr, "poll(numfds=%u, timeout=%ldms) -> %d\n",
+                  numfds, ev->ms, *pollrc);
 #endif
     if(*pollrc < 0)
       return CURLE_UNRECOVERABLE_POLL;
   }
   else {
 #if DEBUG_EV_POLL
-    fprintf(stderr, "poll, but no fds, wait timeout=%ldms\n", ev->ms);
+    curl_mfprintf(stderr, "poll, but no fds, wait timeout=%ldms\n", ev->ms);
 #endif
     *pollrc = 0;
     if(ev->ms > 0)
@@ -629,7 +628,7 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
     if(!pollrc) {
       /* timeout! */
       ev->ms = 0;
-      /* fprintf(stderr, "call curl_multi_socket_action(TIMEOUT)\n"); */
+      /* curl_mfprintf(stderr, "call curl_multi_socket_action(TIMEOUT)\n"); */
       mcode = curl_multi_socket_action(multi, CURL_SOCKET_TIMEOUT, 0,
                                        &ev->running_handles);
     }
@@ -658,8 +657,8 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
         timediff_t timediff = curlx_timediff(curlx_now(), before);
         if(timediff > 0) {
 #if DEBUG_EV_POLL
-        fprintf(stderr, "poll timeout %ldms not updated, decrease by "
-                "time spent %ldms\n", ev->ms, (long)timediff);
+        curl_mfprintf(stderr, "poll timeout %ldms not updated, decrease by "
+                      "time spent %ldms\n", ev->ms, (long)timediff);
 #endif
           if(timediff > ev->ms)
             ev->ms = 0;
index a292ba3b6253beff4eb9e624e82642a81711f61c..e7587e49b40ed3e6427583d51d26a3fa4ab1ae6f 100644 (file)
@@ -36,9 +36,9 @@ struct Curl_easy;
 #include "escape.h"
 #include "strdup.h"
 #include "curlx/strparse.h"
-
-/* The last 3 #include files should be in this order */
 #include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 20d55ba2d1bdeb4bc7753b06b0ea140fca370f56..80edf78648577de3d00fe7b7b6b6047e42bbbcfe 100644 (file)
@@ -31,8 +31,7 @@
 #include <stdlib.h>
 #include <ares.h>
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -178,7 +177,7 @@ int r_getaddrinfo(const char *node,
     if(env) {
       rc = ares_set_servers_ports_csv(channel, env);
       if(rc) {
-        fprintf(stderr, "ares_set_servers_ports_csv failed: %d", rc);
+        curl_mfprintf(stderr, "ares_set_servers_ports_csv failed: %d", rc);
         /* Cleanup */
         ares_destroy(channel);
         return EAI_MEMORY; /* we can't run */
index 2d5818a1db42cc02877b96a07babf2b95030bd3f..fe07df5d2a92514e50b0a4cc4f72ee73101b22a0 100644 (file)
@@ -69,8 +69,8 @@
 #include "curlx/fopen.h"
 #include "curlx/warnless.h"
 #include "curl_range.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -488,8 +488,8 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
     static const char accept_ranges[]= { "Accept-ranges: bytes\r\n" };
     if(expected_size >= 0) {
       headerlen =
-        msnprintf(header, sizeof(header), "Content-Length: %" FMT_OFF_T "\r\n",
-                  expected_size);
+        curl_msnprintf(header, sizeof(header),
+                       "Content-Length: %" FMT_OFF_T "\r\n", expected_size);
       result = Curl_client_write(data, CLIENTWRITE_HEADER, header, headerlen);
       if(result)
         return result;
@@ -507,15 +507,15 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
 
     /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
     headerlen =
-      msnprintf(header, sizeof(header),
-                "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
-                Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
-                tm->tm_mday,
-                Curl_month[tm->tm_mon],
-                tm->tm_year + 1900,
-                tm->tm_hour,
-                tm->tm_min,
-                tm->tm_sec);
+      curl_msnprintf(header, sizeof(header),
+                     "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
+                     Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
+                     tm->tm_mday,
+                     Curl_month[tm->tm_mon],
+                     tm->tm_year + 1900,
+                     tm->tm_hour,
+                     tm->tm_min,
+                     tm->tm_sec);
     result = Curl_client_write(data, CLIENTWRITE_HEADER, header, headerlen);
     if(!result)
       /* end of headers */
index 475ca22fc86443186e2fe544cf54cd7504c7fe1a..a98384c18ac91ef621f52ef1c93893e99279cbee 100644 (file)
@@ -38,8 +38,8 @@ struct Curl_easy;
 #include "strdup.h"
 #include "rand.h"
 #include "curlx/warnless.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 32d3c445df4ee707aba4bf5386c07fc41e932201..c3b8aafbc5d5691a276ba0c9c607f19209bc2332 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -72,8 +72,8 @@
 #include "strdup.h"
 #include "curlx/strerr.h"
 #include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -1209,7 +1209,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
         source++;
       }
       *dest = 0;
-      msnprintf(dest, 20, ",%d,%d", (int)(port >> 8), (int)(port & 0xff));
+      curl_msnprintf(dest, 20, ",%d,%d", (int)(port >> 8), (int)(port & 0xff));
 
       result = Curl_pp_sendf(data, &ftpc->pp, "%s %s", mode[fcmd], target);
       if(result) {
@@ -1422,12 +1422,12 @@ static CURLcode ftp_state_list(struct Curl_easy *data,
     }
   }
 
-  cmd = aprintf("%s%s%.*s",
-                data->set.str[STRING_CUSTOMREQUEST] ?
-                data->set.str[STRING_CUSTOMREQUEST] :
-                (data->state.list_only ? "NLST" : "LIST"),
-                lstArg ? " " : "",
-                lstArglen, lstArg ? lstArg : "");
+  cmd = curl_maprintf("%s%s%.*s",
+                      data->set.str[STRING_CUSTOMREQUEST] ?
+                      data->set.str[STRING_CUSTOMREQUEST] :
+                      (data->state.list_only ? "NLST" : "LIST"),
+                      lstArg ? " " : "",
+                      lstArglen, lstArg ? lstArg : "");
 
   if(!cmd)
     return CURLE_OUT_OF_MEMORY;
@@ -1887,7 +1887,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data,
       ftpc->newhost = control_address_dup(data, conn);
     }
     else
-      ftpc->newhost = aprintf("%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]);
+      ftpc->newhost = curl_maprintf("%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]);
 
     if(!ftpc->newhost)
       return CURLE_OUT_OF_MEMORY;
@@ -2093,9 +2093,9 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
       if(ftp_213_date(resp, &year, &month, &day, &hour, &minute, &second)) {
         /* we have a time, reformat it */
         char timebuf[24];
-        msnprintf(timebuf, sizeof(timebuf),
-                  "%04d%02d%02d %02d:%02d:%02d GMT",
-                  year, month, day, hour, minute, second);
+        curl_msnprintf(timebuf, sizeof(timebuf),
+                       "%04d%02d%02d %02d:%02d:%02d GMT",
+                       year, month, day, hour, minute, second);
         /* now, convert this into a time() value: */
         if(!Curl_getdate_capped(timebuf, &data->info.filetime))
           showtime = TRUE;
@@ -2128,15 +2128,16 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
 
         /* format: "Tue, 15 Nov 1994 12:45:26" */
         headerbuflen =
-          msnprintf(headerbuf, sizeof(headerbuf),
-                    "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
-                    Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
-                    tm->tm_mday,
-                    Curl_month[tm->tm_mon],
-                    tm->tm_year + 1900,
-                    tm->tm_hour,
-                    tm->tm_min,
-                    tm->tm_sec);
+          curl_msnprintf(headerbuf, sizeof(headerbuf),
+                         "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d "
+                         "GMT\r\n",
+                         Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
+                         tm->tm_mday,
+                         Curl_month[tm->tm_mon],
+                         tm->tm_year + 1900,
+                         tm->tm_hour,
+                         tm->tm_min,
+                         tm->tm_sec);
         result = client_write_header(data, headerbuf, headerbuflen);
         if(result)
           return result;
@@ -2349,8 +2350,9 @@ static CURLcode ftp_state_size_resp(struct Curl_easy *data,
 #ifdef CURL_FTP_HTTPSTYLE_HEAD
     if(filesize != -1) {
       char clbuf[128];
-      int clbuflen = msnprintf(clbuf, sizeof(clbuf),
-                "Content-Length: %" FMT_OFF_T "\r\n", filesize);
+      int clbuflen = curl_msnprintf(clbuf, sizeof(clbuf),
+                                    "Content-Length: %" FMT_OFF_T "\r\n",
+                                    filesize);
       result = client_write_header(data, clbuf, clbuflen);
       if(result)
         return result;
@@ -3937,7 +3939,7 @@ static CURLcode wc_statemach(struct Curl_easy *data,
       struct Curl_llist_node *head = Curl_llist_head(&wildcard->filelist);
       struct curl_fileinfo *finfo = Curl_node_elem(head);
 
-      char *tmp_path = aprintf("%s%s", wildcard->path, finfo->filename);
+      char *tmp_path = curl_maprintf("%s%s", wildcard->path, finfo->filename);
       if(!tmp_path)
         return CURLE_OUT_OF_MEMORY;
 
index 360f7ae4fca03d182da24aae8ac516a0dc5c866d..de573d3c57b52cdcf89d3e3227d2d7f414e5b910 100644 (file)
@@ -52,8 +52,7 @@
 #include "multiif.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 93db85e9d02742d8a2843a85e72e082c953edb9d..6ff47d58c70ac7ec08a4913899f1207559434034 100644 (file)
@@ -40,9 +40,9 @@
 #include "url.h"
 #include "escape.h"
 #include "curlx/warnless.h"
-#include "curl_printf.h"
+
+/* The last 2 #include files should be: */
 #include "curl_memory.h"
-/* The last #include file should be: */
 #include "memdebug.h"
 
 /*
@@ -153,7 +153,7 @@ static CURLcode gopher_do(struct Curl_easy *data, bool *done)
   DEBUGASSERT(path);
 
   if(query)
-    gopherpath = aprintf("%s?%s", path, query);
+    gopherpath = curl_maprintf("%s?%s", path, query);
   else
     gopherpath = strdup(path);
 
index 89f47ed71e259eea1f559aeeb122bf394e97f54b..8312fbf050fddcab7125f9120f7224edffc70cee 100644 (file)
@@ -51,16 +51,16 @@ void Curl_hash_print(struct Curl_hash *h,
   if(!h)
     return;
 
-  fprintf(stderr, "=Hash dump=\n");
+  curl_mfprintf(stderr, "=Hash dump=\n");
 
   Curl_hash_start_iterate(h, &iter);
 
   he = Curl_hash_next_element(&iter);
   while(he) {
     if(iter.slot_index != last_index) {
-      fprintf(stderr, "index %d:", (int)iter.slot_index);
+      curl_mfprintf(stderr, "index %d:", (int)iter.slot_index);
       if(last_index != UINT_MAX) {
-        fprintf(stderr, "\n");
+        curl_mfprintf(stderr, "\n");
       }
       last_index = iter.slot_index;
     }
@@ -68,13 +68,13 @@ void Curl_hash_print(struct Curl_hash *h,
     if(func)
       func(he->ptr);
     else
-      fprintf(stderr, " [key=%.*s, he=%p, ptr=%p]",
-              (int)he->key_len, (char *)he->key,
-              (void *)he, (void *)he->ptr);
+      curl_mfprintf(stderr, " [key=%.*s, he=%p, ptr=%p]",
+                    (int)he->key_len, (char *)he->key,
+                    (void *)he, (void *)he->ptr);
 
     he = Curl_hash_next_element(&iter);
   }
-  fprintf(stderr, "\n");
+  curl_mfprintf(stderr, "\n");
 }
 #endif
 
index 426d0e57b77a1cb8c7e5f81d221742f1ab80b97c..5a5725711317c3fb6d549f3bc6a5338ea5915e8d 100644 (file)
@@ -30,8 +30,7 @@
 #include "headers.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index da260d713009a57b03246d3b89938369650b0d04..ceea1897322afb3017b3c343f6388fc446ea274e 100644 (file)
@@ -64,8 +64,7 @@
 #include "easy_lock.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -176,7 +175,7 @@ create_dnscache_id(const char *name,
     len = buflen - 7;
   /* store and lower case the name */
   Curl_strntolower(ptr, name, len);
-  return msnprintf(&ptr[len], 7, ":%u", port) + len;
+  return curl_msnprintf(&ptr[len], 7, ":%u", port) + len;
 }
 
 struct dnscache_prune_data {
index 2c356f3464e321a050eccfe17fc4738406fc9abc..e1ed007aafa37392a1486140ac66f9e4804029b1 100644 (file)
@@ -49,8 +49,8 @@
 #include "hash.h"
 #include "share.h"
 #include "url.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -125,7 +125,7 @@ struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
   hints.ai_family = PF_INET;
   hints.ai_socktype = SOCK_STREAM;
   if(port) {
-    msnprintf(sbuf, sizeof(sbuf), "%d", port);
+    curl_msnprintf(sbuf, sizeof(sbuf), "%d", port);
     sbufptr = sbuf;
   }
 
index 4c05f0247e1afc061a6ca350d86ec13dc388d218..9419b9e4d5feb3a3d950c50bbf944621bbdaecb0 100644 (file)
@@ -52,8 +52,8 @@
 #include "url.h"
 #include "curlx/inet_pton.h"
 #include "connect.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
 #ifdef DEBUG_ADDRINFO
 static void dump_addrinfo(const struct Curl_addrinfo *ai)
 {
-  printf("dump_addrinfo:\n");
+  curl_mprintf("dump_addrinfo:\n");
   for(; ai; ai = ai->ai_next) {
     char buf[INET6_ADDRSTRLEN];
-    printf("    fam %2d, CNAME %s, ",
-           ai->ai_family, ai->ai_canonname ? ai->ai_canonname : "<none>");
+    curl_mprintf("    fam %2d, CNAME %s, ",
+                 ai->ai_family,
+                 ai->ai_canonname ? ai->ai_canonname : "<none>");
     Curl_printable_address(ai, buf, sizeof(buf));
-    printf("%s\n", buf);
+    curl_mprintf("%s\n", buf);
   }
 }
 #else
@@ -122,7 +123,7 @@ struct Curl_addrinfo *Curl_sync_getaddrinfo(struct Curl_easy *data,
 #endif
 
   if(port) {
-    msnprintf(sbuf, sizeof(sbuf), "%d", port);
+    curl_msnprintf(sbuf, sizeof(sbuf), "%d", port);
     sbufptr = sbuf;
   }
 
index b84a470f90dcc567e4f64fc7e813ba9c32ebbfd8..28989764b90ff6e36c2b3faa180710f1b7681754 100644 (file)
@@ -41,8 +41,7 @@
 #include "strdup.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -308,9 +307,9 @@ static CURLcode hsts_push(struct Curl_easy *data,
     if(result)
       return result;
 
-    msnprintf(e.expire, sizeof(e.expire), "%d%02d%02d %02d:%02d:%02d",
-              stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
-              stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
+    curl_msnprintf(e.expire, sizeof(e.expire), "%d%02d%02d %02d:%02d:%02d",
+                   stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
+                   stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
   }
   else
     strcpy(e.expire, UNLIMITED);
@@ -331,14 +330,14 @@ static CURLcode hsts_out(struct stsentry *sts, FILE *fp)
     CURLcode result = Curl_gmtime((time_t)sts->expires, &stamp);
     if(result)
       return result;
-    fprintf(fp, "%s%s \"%d%02d%02d %02d:%02d:%02d\"\n",
-            sts->includeSubDomains ? ".": "", sts->host,
-            stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
-            stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
+    curl_mfprintf(fp, "%s%s \"%d%02d%02d %02d:%02d:%02d\"\n",
+                  sts->includeSubDomains ? ".": "", sts->host,
+                  stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
+                  stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
   }
   else
-    fprintf(fp, "%s%s \"%s\"\n",
-            sts->includeSubDomains ? ".": "", sts->host, UNLIMITED);
+    curl_mfprintf(fp, "%s%s \"%s\"\n",
+                  sts->includeSubDomains ? ".": "", sts->host, UNLIMITED);
   return CURLE_OK;
 }
 
index 3479bb4ec976f9fa3203bb3da34dd7b314936397..aea19d5167f5fc222fc2fae8293a7e96b9b9f1b2 100644 (file)
@@ -87,8 +87,7 @@
 #include "curl_ctype.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -337,7 +336,7 @@ static CURLcode http_output_basic(struct Curl_easy *data, bool proxy)
     pwd = data->state.aptr.passwd;
   }
 
-  out = aprintf("%s:%s", user ? user : "", pwd ? pwd : "");
+  out = curl_maprintf("%s:%s", user ? user : "", pwd ? pwd : "");
   if(!out)
     return CURLE_OUT_OF_MEMORY;
 
@@ -351,9 +350,9 @@ static CURLcode http_output_basic(struct Curl_easy *data, bool proxy)
   }
 
   free(*userp);
-  *userp = aprintf("%sAuthorization: Basic %s\r\n",
-                   proxy ? "Proxy-" : "",
-                   authorization);
+  *userp = curl_maprintf("%sAuthorization: Basic %s\r\n",
+                         proxy ? "Proxy-" : "",
+                         authorization);
   free(authorization);
   if(!*userp) {
     result = CURLE_OUT_OF_MEMORY;
@@ -381,8 +380,8 @@ static CURLcode http_output_bearer(struct Curl_easy *data)
 
   userp = &data->state.aptr.userpwd;
   free(*userp);
-  *userp = aprintf("Authorization: Bearer %s\r\n",
-                   data->set.str[STRING_BEARER]);
+  *userp = curl_maprintf("Authorization: Bearer %s\r\n",
+                         data->set.str[STRING_BEARER]);
 
   if(!*userp) {
     result = CURLE_OUT_OF_MEMORY;
@@ -1795,16 +1794,16 @@ CURLcode Curl_add_timecondition(struct Curl_easy *data,
    */
 
   /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
-  msnprintf(datestr, sizeof(datestr),
-            "%s: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
-            condp,
-            Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
-            tm->tm_mday,
-            Curl_month[tm->tm_mon],
-            tm->tm_year + 1900,
-            tm->tm_hour,
-            tm->tm_min,
-            tm->tm_sec);
+  curl_msnprintf(datestr, sizeof(datestr),
+                 "%s: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
+                 condp,
+                 Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
+                 tm->tm_mday,
+                 Curl_month[tm->tm_mon],
+                 tm->tm_year + 1900,
+                 tm->tm_hour,
+                 tm->tm_min,
+                 tm->tm_sec);
 
   result = curlx_dyn_add(req, datestr);
   return result;
@@ -1936,7 +1935,7 @@ static CURLcode http_set_aptr_host(struct Curl_easy *data)
 #endif
 
     if(!curl_strequal("Host:", ptr)) {
-      aptr->host = aprintf("Host:%s\r\n", &ptr[5]);
+      aptr->host = curl_maprintf("Host:%s\r\n", &ptr[5]);
       if(!aptr->host)
         return CURLE_OUT_OF_MEMORY;
     }
@@ -1952,13 +1951,14 @@ static CURLcode http_set_aptr_host(struct Curl_easy *data)
         (conn->remote_port == PORT_HTTP)) )
       /* if(HTTPS on port 443) OR (HTTP on port 80) then do not include
          the port number in the host string */
-      aptr->host = aprintf("Host: %s%s%s\r\n", conn->bits.ipv6_ip ? "[" : "",
-                           host, conn->bits.ipv6_ip ? "]" : "");
+      aptr->host = curl_maprintf("Host: %s%s%s\r\n",
+                                 conn->bits.ipv6_ip ? "[" : "",
+                                 host, conn->bits.ipv6_ip ? "]" : "");
     else
-      aptr->host = aprintf("Host: %s%s%s:%d\r\n",
-                           conn->bits.ipv6_ip ? "[" : "",
-                           host, conn->bits.ipv6_ip ? "]" : "",
-                           conn->remote_port);
+      aptr->host = curl_maprintf("Host: %s%s%s:%d\r\n",
+                                 conn->bits.ipv6_ip ? "[" : "",
+                                 host, conn->bits.ipv6_ip ? "]" : "",
+                                 conn->remote_port);
 
     if(!aptr->host)
       /* without Host: we cannot make a nice request */
@@ -2494,8 +2494,8 @@ static CURLcode http_range(struct Curl_easy *data,
        !Curl_checkheaders(data, STRCONST("Range"))) {
       /* if a line like this was already allocated, free the previous one */
       free(data->state.aptr.rangeline);
-      data->state.aptr.rangeline = aprintf("Range: bytes=%s\r\n",
-                                           data->state.range);
+      data->state.aptr.rangeline = curl_maprintf("Range: bytes=%s\r\n",
+                                                 data->state.range);
     }
     else if((httpreq == HTTPREQ_POST || httpreq == HTTPREQ_PUT) &&
             !Curl_checkheaders(data, STRCONST("Content-Range"))) {
@@ -2508,8 +2508,8 @@ static CURLcode http_range(struct Curl_easy *data,
            remote part so we tell the server (and act accordingly) that we
            upload the whole file (again) */
         data->state.aptr.rangeline =
-          aprintf("Content-Range: bytes 0-%" FMT_OFF_T "/%" FMT_OFF_T "\r\n",
-                  req_clen - 1, req_clen);
+          curl_maprintf("Content-Range: bytes 0-%" FMT_OFF_T "/"
+                        "%" FMT_OFF_T "\r\n", req_clen - 1, req_clen);
 
       }
       else if(data->state.resume_from) {
@@ -2521,15 +2521,16 @@ static CURLcode http_range(struct Curl_easy *data,
                                data->state.infilesize :
                                (data->state.resume_from + req_clen);
         data->state.aptr.rangeline =
-          aprintf("Content-Range: bytes %s%" FMT_OFF_T "/%" FMT_OFF_T "\r\n",
-                  data->state.range, total_len-1, total_len);
+          curl_maprintf("Content-Range: bytes %s%" FMT_OFF_T "/"
+                        "%" FMT_OFF_T "\r\n",
+                        data->state.range, total_len-1, total_len);
       }
       else {
         /* Range was selected and then we just pass the incoming range and
            append total size */
         data->state.aptr.rangeline =
-          aprintf("Content-Range: bytes %s/%" FMT_OFF_T "\r\n",
-                  data->state.range, req_clen);
+          curl_maprintf("Content-Range: bytes %s/%" FMT_OFF_T "\r\n",
+                        data->state.range, req_clen);
       }
       if(!data->state.aptr.rangeline)
         return CURLE_OUT_OF_MEMORY;
@@ -2931,7 +2932,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
     /* setup the authentication headers, how that method and host are known */
     char *pq = NULL;
     if(data->state.up.query) {
-      pq = aprintf("%s?%s", data->state.up.path, data->state.up.query);
+      pq = curl_maprintf("%s?%s", data->state.up.path, data->state.up.query);
       if(!pq)
         return CURLE_OUT_OF_MEMORY;
     }
index 537e6db2ff98a70b552d109d44b6a7ad33456f8e..098dd7cd64f846310a892b9429dc7d332e538168 100644 (file)
@@ -32,8 +32,7 @@
 #include "http1.h"
 #include "urlapi-int.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index c526bf0fa4c3b3cdce14503798412b6971e94486..c33c633cf632aa4a936e41ee0155abcf268aba88 100644 (file)
@@ -47,8 +47,8 @@
 #include "transfer.h"
 #include "curlx/dynbuf.h"
 #include "headers.h"
+
 /* The last 3 #include files should be in this order */
-#include "curl_printf.h"
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -734,7 +734,7 @@ static CURLcode http2_send_ping(struct Curl_cfilter *cf,
 void Curl_http2_ver(char *p, size_t len)
 {
   nghttp2_info *h2 = nghttp2_version(0);
-  (void)msnprintf(p, len, "nghttp2/%s", h2->version_str);
+  (void)curl_msnprintf(p, len, "nghttp2/%s", h2->version_str);
 }
 
 static CURLcode nw_out_flush(struct Curl_cfilter *cf,
@@ -1214,48 +1214,48 @@ static int fr_print(const nghttp2_frame *frame, char *buffer, size_t blen)
 {
   switch(frame->hd.type) {
     case NGHTTP2_DATA: {
-      return msnprintf(buffer, blen,
-                       "FRAME[DATA, len=%d, eos=%d, padlen=%d]",
-                       (int)frame->hd.length,
-                       !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM),
-                       (int)frame->data.padlen);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[DATA, len=%d, eos=%d, padlen=%d]",
+                            (int)frame->hd.length,
+                            !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM),
+                            (int)frame->data.padlen);
     }
     case NGHTTP2_HEADERS: {
-      return msnprintf(buffer, blen,
-                       "FRAME[HEADERS, len=%d, hend=%d, eos=%d]",
-                       (int)frame->hd.length,
-                       !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS),
-                       !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM));
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[HEADERS, len=%d, hend=%d, eos=%d]",
+                            (int)frame->hd.length,
+                            !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS),
+                            !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM));
     }
     case NGHTTP2_PRIORITY: {
-      return msnprintf(buffer, blen,
-                       "FRAME[PRIORITY, len=%d, flags=%d]",
-                       (int)frame->hd.length, frame->hd.flags);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[PRIORITY, len=%d, flags=%d]",
+                            (int)frame->hd.length, frame->hd.flags);
     }
     case NGHTTP2_RST_STREAM: {
-      return msnprintf(buffer, blen,
-                       "FRAME[RST_STREAM, len=%d, flags=%d, error=%u]",
-                       (int)frame->hd.length, frame->hd.flags,
-                       frame->rst_stream.error_code);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[RST_STREAM, len=%d, flags=%d, error=%u]",
+                            (int)frame->hd.length, frame->hd.flags,
+                            frame->rst_stream.error_code);
     }
     case NGHTTP2_SETTINGS: {
       if(frame->hd.flags & NGHTTP2_FLAG_ACK) {
-        return msnprintf(buffer, blen, "FRAME[SETTINGS, ack=1]");
+        return curl_msnprintf(buffer, blen, "FRAME[SETTINGS, ack=1]");
       }
-      return msnprintf(buffer, blen,
-                       "FRAME[SETTINGS, len=%d]", (int)frame->hd.length);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[SETTINGS, len=%d]", (int)frame->hd.length);
     }
     case NGHTTP2_PUSH_PROMISE: {
-      return msnprintf(buffer, blen,
-                       "FRAME[PUSH_PROMISE, len=%d, hend=%d]",
-                       (int)frame->hd.length,
-                       !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS));
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[PUSH_PROMISE, len=%d, hend=%d]",
+                            (int)frame->hd.length,
+                            !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS));
     }
     case NGHTTP2_PING: {
-      return msnprintf(buffer, blen,
-                       "FRAME[PING, len=%d, ack=%d]",
-                       (int)frame->hd.length,
-                       frame->hd.flags&NGHTTP2_FLAG_ACK);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[PING, len=%d, ack=%d]",
+                            (int)frame->hd.length,
+                            frame->hd.flags&NGHTTP2_FLAG_ACK);
     }
     case NGHTTP2_GOAWAY: {
       char scratch[128];
@@ -1265,19 +1265,20 @@ static int fr_print(const nghttp2_frame *frame, char *buffer, size_t blen)
       if(len)
         memcpy(scratch, frame->goaway.opaque_data, len);
       scratch[len] = '\0';
-      return msnprintf(buffer, blen, "FRAME[GOAWAY, error=%d, reason='%s', "
-                       "last_stream=%d]", frame->goaway.error_code,
-                       scratch, frame->goaway.last_stream_id);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[GOAWAY, error=%d, reason='%s', "
+                            "last_stream=%d]", frame->goaway.error_code,
+                            scratch, frame->goaway.last_stream_id);
     }
     case NGHTTP2_WINDOW_UPDATE: {
-      return msnprintf(buffer, blen,
-                       "FRAME[WINDOW_UPDATE, incr=%d]",
-                       frame->window_update.window_size_increment);
+      return curl_msnprintf(buffer, blen,
+                            "FRAME[WINDOW_UPDATE, incr=%d]",
+                            frame->window_update.window_size_increment);
     }
     default:
-      return msnprintf(buffer, blen, "FRAME[%d, len=%d, flags=%d]",
-                       frame->hd.type, (int)frame->hd.length,
-                       frame->hd.flags);
+      return curl_msnprintf(buffer, blen, "FRAME[%d, len=%d, flags=%d]",
+                            frame->hd.type, (int)frame->hd.length,
+                            frame->hd.flags);
   }
 }
 
@@ -1592,8 +1593,8 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
     if(!strcmp(HTTP_PSEUDO_AUTHORITY, (const char *)name)) {
       /* pseudo headers are lower case */
       int rc = 0;
-      char *check = aprintf("%s:%d", cf->conn->host.name,
-                            cf->conn->remote_port);
+      char *check = curl_maprintf("%s:%d", cf->conn->host.name,
+                                  cf->conn->remote_port);
       if(!check)
         /* no memory */
         return NGHTTP2_ERR_CALLBACK_FAILURE;
@@ -1640,7 +1641,7 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
       }
       stream->push_headers = headp;
     }
-    h = aprintf("%s:%s", name, value);
+    h = curl_maprintf("%s:%s", name, value);
     if(h)
       stream->push_headers[stream->push_headers_used++] = h;
     return 0;
@@ -1671,8 +1672,8 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
       cf_h2_header_error(cf, data_s, stream, result);
       return NGHTTP2_ERR_CALLBACK_FAILURE;
     }
-    msnprintf(buffer, sizeof(buffer), HTTP_PSEUDO_STATUS ":%u\r",
-              stream->status_code);
+    curl_msnprintf(buffer, sizeof(buffer), HTTP_PSEUDO_STATUS ":%u\r",
+                   stream->status_code);
     result = Curl_headers_push(data_s, buffer, CURLH_PSEUDO);
     if(result) {
       cf_h2_header_error(cf, data_s, stream, result);
index c62db499ca19642e377c7ab560f220de417d7338..f592f3844feba99716c1afa6997e41c520a1435d 100644 (file)
@@ -39,8 +39,7 @@
 
 #include <time.h>
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -245,14 +244,14 @@ static CURLcode make_headers(struct Curl_easy *data,
   struct curl_slist *l;
   bool again = TRUE;
 
-  msnprintf(date_hdr_key, DATE_HDR_KEY_LEN, "X-%.*s-Date",
-            (int)plen, provider1);
+  curl_msnprintf(date_hdr_key, DATE_HDR_KEY_LEN, "X-%.*s-Date",
+                 (int)plen, provider1);
   /* provider1 ucfirst */
   Curl_strntolower(&date_hdr_key[2], provider1, plen);
   date_hdr_key[2] = Curl_raw_toupper(provider1[0]);
 
-  msnprintf(date_full_hdr, DATE_FULL_HDR_LEN,
-            "x-%.*s-date:%s", (int)plen, provider1, timestamp);
+  curl_msnprintf(date_full_hdr, DATE_FULL_HDR_LEN,
+                 "x-%.*s-date:%s", (int)plen, provider1, timestamp);
   /* provider1 lowercase */
   Curl_strntolower(&date_full_hdr[2], provider1, plen);
 
@@ -265,7 +264,7 @@ static CURLcode make_headers(struct Curl_easy *data,
       fullhost = Curl_memdup0(data->state.aptr.host, pos);
     }
     else
-      fullhost = aprintf("host:%s", hostname);
+      fullhost = curl_maprintf("host:%s", hostname);
 
     if(fullhost)
       head = Curl_slist_append_nodup(NULL, fullhost);
@@ -329,7 +328,7 @@ static CURLcode make_headers(struct Curl_easy *data,
     if(!tmp_head)
       goto fail;
     head = tmp_head;
-    *date_header = aprintf("%s: %s\r\n", date_hdr_key, timestamp);
+    *date_header = curl_maprintf("%s: %s\r\n", date_hdr_key, timestamp);
   }
   else {
     const char *value;
@@ -417,8 +416,8 @@ static const char *parse_content_sha_hdr(struct Curl_easy *data,
   const char *value;
   size_t len;
 
-  key_len = msnprintf(key, sizeof(key), "x-%.*s-content-sha256",
-                      (int)plen, provider1);
+  key_len = curl_msnprintf(key, sizeof(key), "x-%.*s-content-sha256",
+                           (int)plen, provider1);
 
   value = Curl_checkheaders(data, key, key_len);
   if(!value)
@@ -490,8 +489,8 @@ static CURLcode calc_s3_payload_hash(struct Curl_easy *data,
   }
 
   /* format the required content-sha256 header */
-  msnprintf(header, CONTENT_SHA256_HDR_LEN,
-            "x-%.*s-content-sha256: %s", (int)plen, provider1, sha_hex);
+  curl_msnprintf(header, CONTENT_SHA256_HDR_LEN,
+                 "x-%.*s-content-sha256: %s", (int)plen, provider1, sha_hex);
 
   ret = CURLE_OK;
 fail:
@@ -850,38 +849,41 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
   result = CURLE_OUT_OF_MEMORY;
 
   canonical_request =
-    aprintf("%s\n" /* HTTPRequestMethod */
-            "%s\n" /* CanonicalURI */
-            "%s\n" /* CanonicalQueryString */
-            "%s\n" /* CanonicalHeaders */
-            "%s\n" /* SignedHeaders */
-            "%.*s",  /* HashedRequestPayload in hex */
-            method,
-            curlx_dyn_ptr(&canonical_path),
-            curlx_dyn_ptr(&canonical_query) ?
-            curlx_dyn_ptr(&canonical_query) : "",
-            curlx_dyn_ptr(&canonical_headers),
-            curlx_dyn_ptr(&signed_headers),
-            (int)payload_hash_len, payload_hash);
+    curl_maprintf("%s\n" /* HTTPRequestMethod */
+                  "%s\n" /* CanonicalURI */
+                  "%s\n" /* CanonicalQueryString */
+                  "%s\n" /* CanonicalHeaders */
+                  "%s\n" /* SignedHeaders */
+                  "%.*s",  /* HashedRequestPayload in hex */
+                  method,
+                  curlx_dyn_ptr(&canonical_path),
+                  curlx_dyn_ptr(&canonical_query) ?
+                  curlx_dyn_ptr(&canonical_query) : "",
+                  curlx_dyn_ptr(&canonical_headers),
+                  curlx_dyn_ptr(&signed_headers),
+                  (int)payload_hash_len, payload_hash);
   if(!canonical_request)
     goto fail;
 
   infof(data, "aws_sigv4: Canonical request (enclosed in []) - [%s]",
     canonical_request);
 
-  request_type = aprintf("%.*s4_request",
-                         (int)curlx_strlen(&provider0), curlx_str(&provider0));
+  request_type = curl_maprintf("%.*s4_request",
+                               (int)curlx_strlen(&provider0),
+                               curlx_str(&provider0));
   if(!request_type)
     goto fail;
 
-  /* provider0 is lowercased *after* aprintf() so that the buffer can be
-     written to */
+  /* provider0 is lowercased *after* curl_maprintf() so that the buffer
+     can be written to */
   Curl_strntolower(request_type, request_type, curlx_strlen(&provider0));
 
-  credential_scope = aprintf("%s/%.*s/%.*s/%s", date,
-                             (int)curlx_strlen(&region), curlx_str(&region),
-                             (int)curlx_strlen(&service), curlx_str(&service),
-                             request_type);
+  credential_scope = curl_maprintf("%s/%.*s/%.*s/%s", date,
+                                   (int)curlx_strlen(&region),
+                                   curlx_str(&region),
+                                   (int)curlx_strlen(&service),
+                                   curlx_str(&service),
+                                   request_type);
   if(!credential_scope)
     goto fail;
 
@@ -895,14 +897,15 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
    * Google allows using RSA key instead of HMAC, so this code might change
    * in the future. For now we only support HMAC.
    */
-  str_to_sign = aprintf("%.*s4-HMAC-SHA256\n" /* Algorithm */
-                        "%s\n" /* RequestDateTime */
-                        "%s\n" /* CredentialScope */
-                        "%s",  /* HashedCanonicalRequest in hex */
-                        (int)curlx_strlen(&provider0), curlx_str(&provider0),
-                        timestamp,
-                        credential_scope,
-                        sha_hex);
+  str_to_sign = curl_maprintf("%.*s4-HMAC-SHA256\n" /* Algorithm */
+                              "%s\n" /* RequestDateTime */
+                              "%s\n" /* CredentialScope */
+                              "%s",  /* HashedCanonicalRequest in hex */
+                              (int)curlx_strlen(&provider0),
+                              curlx_str(&provider0),
+                              timestamp,
+                              credential_scope,
+                              sha_hex);
   if(!str_to_sign)
     goto fail;
 
@@ -913,9 +916,9 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
   infof(data, "aws_sigv4: String to sign (enclosed in []) - [%s]",
     str_to_sign);
 
-  secret = aprintf("%.*s4%s", (int)curlx_strlen(&provider0),
-                   curlx_str(&provider0), data->state.aptr.passwd ?
-                   data->state.aptr.passwd : "");
+  secret = curl_maprintf("%.*s4%s", (int)curlx_strlen(&provider0),
+                         curlx_str(&provider0), data->state.aptr.passwd ?
+                         data->state.aptr.passwd : "");
   if(!secret)
     goto fail;
   /* make provider0 part done uppercase */
@@ -933,24 +936,25 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
 
   infof(data, "aws_sigv4: Signature - %s", sha_hex);
 
-  auth_headers = aprintf("Authorization: %.*s4-HMAC-SHA256 "
-                         "Credential=%s/%s, "
-                         "SignedHeaders=%s, "
-                         "Signature=%s\r\n"
-                         /*
-                          * date_header is added here, only if it was not
-                          * user-specified (using CURLOPT_HTTPHEADER).
-                          * date_header includes \r\n
-                          */
-                         "%s"
-                         "%s", /* optional sha256 header includes \r\n */
-                         (int)curlx_strlen(&provider0), curlx_str(&provider0),
-                         user,
-                         credential_scope,
-                         curlx_dyn_ptr(&signed_headers),
-                         sha_hex,
-                         date_header ? date_header : "",
-                         content_sha256_hdr);
+  auth_headers = curl_maprintf("Authorization: %.*s4-HMAC-SHA256 "
+                               "Credential=%s/%s, "
+                               "SignedHeaders=%s, "
+                               "Signature=%s\r\n"
+                               /*
+                                * date_header is added here, only if it was not
+                                * user-specified (using CURLOPT_HTTPHEADER).
+                                * date_header includes \r\n
+                                */
+                               "%s"
+                               "%s", /* optional sha256 header includes \r\n */
+                               (int)curlx_strlen(&provider0),
+                               curlx_str(&provider0),
+                               user,
+                               credential_scope,
+                               curlx_dyn_ptr(&signed_headers),
+                               sha_hex,
+                               date_header ? date_header : "",
+                               content_sha256_hdr);
   if(!auth_headers) {
     goto fail;
   }
index f735a820c7bc47dd6fe7f3d086e401203f639ac1..005d34e7b90584b7497ad190a45205ad1b9842f0 100644 (file)
@@ -27,7 +27,6 @@
 #ifndef CURL_DISABLE_HTTP
 
 #include "urldata.h" /* it includes http_chunks.h */
-#include "curl_printf.h"
 #include "curl_trc.h"
 #include "sendf.h"   /* for the client write stuff */
 #include "curlx/dynbuf.h"
@@ -584,7 +583,7 @@ static CURLcode add_chunk(struct Curl_easy *data,
     int hdlen;
     size_t n;
 
-    hdlen = msnprintf(hd, sizeof(hd), "%zx\r\n", nread);
+    hdlen = curl_msnprintf(hd, sizeof(hd), "%zx\r\n", nread);
     if(hdlen <= 0)
       return CURLE_READ_ERROR;
     /* On a soft-limited bufq, we do not need to check that all was written */
index f4e920706c63b61c3bd75b284ed58db024fd142a..097c81fd716a120459ae25085bfc8a4f7c1ece34 100644 (file)
@@ -32,8 +32,7 @@
 #include "http_digest.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -149,11 +148,11 @@ CURLcode Curl_output_digest(struct Curl_easy *data,
     if(tmp) {
       size_t urilen = tmp - (const char *)uripath;
       /* typecast is fine here since the value is always less than 32 bits */
-      path = (unsigned char *) aprintf("%.*s", (int)urilen, uripath);
+      path = (unsigned char *)curl_maprintf("%.*s", (int)urilen, uripath);
     }
   }
   if(!tmp)
-    path = (unsigned char *) strdup((const char *) uripath);
+    path = (unsigned char *)strdup((const char *) uripath);
 
   if(!path)
     return CURLE_OUT_OF_MEMORY;
@@ -164,9 +163,8 @@ CURLcode Curl_output_digest(struct Curl_easy *data,
   if(result)
     return result;
 
-  *allocuserpwd = aprintf("%sAuthorization: Digest %s\r\n",
-                          proxy ? "Proxy-" : "",
-                          response);
+  *allocuserpwd = curl_maprintf("%sAuthorization: Digest %s\r\n",
+                                proxy ? "Proxy-" : "", response);
   free(response);
   if(!*allocuserpwd)
     return CURLE_OUT_OF_MEMORY;
index 2c0b7e16d76ac23668b7a6b4c1abaa63ae760010..8a19c1ad87387c122b0d9e18d1a5c11223926cab 100644 (file)
@@ -34,8 +34,7 @@
 #include "vtls/vtls.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -219,8 +218,8 @@ CURLcode Curl_output_negotiate(struct Curl_easy *data,
     if(result)
       return result;
 
-    userp = aprintf("%sAuthorization: Negotiate %s\r\n", proxy ? "Proxy-" : "",
-                    base64);
+    userp = curl_maprintf("%sAuthorization: Negotiate %s\r\n",
+                          proxy ? "Proxy-" : "", base64);
 
     if(proxy) {
 #ifndef CURL_DISABLE_PROXY
index a172eb848dd9b4d8212a18a9cf5340401a5363bd..fa375b49bfc6670228caf10a1982b91a361ba104 100644 (file)
@@ -49,8 +49,7 @@
 #include "curl_sspi.h"
 #endif
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -210,9 +209,9 @@ CURLcode Curl_output_ntlm(struct Curl_easy *data, bool proxy)
                                   Curl_bufref_len(&ntlmmsg), &base64, &len);
       if(!result) {
         free(*allocuserpwd);
-        *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
-                                proxy ? "Proxy-" : "",
-                                base64);
+        *allocuserpwd = curl_maprintf("%sAuthorization: NTLM %s\r\n",
+                                      proxy ? "Proxy-" : "",
+                                      base64);
         free(base64);
         if(!*allocuserpwd)
           result = CURLE_OUT_OF_MEMORY;
@@ -229,9 +228,9 @@ CURLcode Curl_output_ntlm(struct Curl_easy *data, bool proxy)
                                    Curl_bufref_len(&ntlmmsg), &base64, &len);
       if(!result) {
         free(*allocuserpwd);
-        *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
-                                proxy ? "Proxy-" : "",
-                                base64);
+        *allocuserpwd = curl_maprintf("%sAuthorization: NTLM %s\r\n",
+                                      proxy ? "Proxy-" : "",
+                                      base64);
         free(base64);
         if(!*allocuserpwd)
           result = CURLE_OUT_OF_MEMORY;
index b756efe711b40bae0a1c95291757ca27a184927e..845ba2e8f8daf3be202ea75f38614ced07f0627d 100644 (file)
@@ -44,8 +44,7 @@
 #include "vauth/vauth.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -236,8 +235,8 @@ CURLcode Curl_http_proxy_create_CONNECT(struct httpreq **preq,
   if(result)
     goto out;
 
-  authority = aprintf("%s%s%s:%d", ipv6_ip ? "[" : "", hostname,
-                      ipv6_ip ?"]" : "", port);
+  authority = curl_maprintf("%s%s%s:%d", ipv6_ip ? "[" : "", hostname,
+                            ipv6_ip ?"]" : "", port);
   if(!authority) {
     result = CURLE_OUT_OF_MEMORY;
     goto out;
index 8aa7f3b26e47ef046201df1b94eec91e9654d900..ae2c106bcef298dafacc0b9126bb82d2442c32a0 100644 (file)
@@ -33,8 +33,7 @@
 #include "sendf.h"
 #include "strdup.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index bb6fd2cffc250dde7e5014b78a57e5a00152b24b..7e324db6c4b0b3fdb040ea753922ca85b2cc897c 100644 (file)
--- a/lib/idn.c
+++ b/lib/idn.c
@@ -45,8 +45,7 @@
 #endif
 #endif  /* USE_LIBIDN2 */
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index e501921d067be080c629e551a5a853500c1cad9a..79b0599106de9a59de0b14619356eff057686ddd 100644 (file)
@@ -54,8 +54,8 @@
 
 #include "curlx/inet_ntop.h"
 #include "if2ip.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -153,7 +153,7 @@ if2ip_result_t Curl_if2ip(int af,
               }
 
               if(scopeid)
-                msnprintf(scope, sizeof(scope), "%%%u", scopeid);
+                curl_msnprintf(scope, sizeof(scope), "%%%u", scopeid);
 #endif
             }
             else
@@ -162,7 +162,7 @@ if2ip_result_t Curl_if2ip(int af,
                 &((struct sockaddr_in *)(void *)iface->ifa_addr)->sin_addr;
             res = IF2IP_FOUND;
             ip = curlx_inet_ntop(af, addr, ipstr, sizeof(ipstr));
-            msnprintf(buf, buf_size, "%s%s", ip, scope);
+            curl_msnprintf(buf, buf_size, "%s%s", ip, scope);
             break;
           }
         }
index 41aec8ffab7337abb5c4470bcd48ccf9228e2f57..69e4e0c2c60834a188398c1bb1e517fb2a06e05e 100644 (file)
@@ -78,8 +78,7 @@
 #include "curlx/warnless.h"
 #include "curl_ctype.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -1943,9 +1942,9 @@ static CURLcode imap_sendf(struct Curl_easy *data,
   DEBUGASSERT(fmt);
 
   /* Calculate the tag based on the connection ID and command ID */
-  msnprintf(imapc->resptag, sizeof(imapc->resptag), "%c%03d",
-            'A' + curlx_sltosi((long)(data->conn->connection_id % 26)),
-            ++imapc->cmdid);
+  curl_msnprintf(imapc->resptag, sizeof(imapc->resptag), "%c%03d",
+                 'A' + curlx_sltosi((long)(data->conn->connection_id % 26)),
+                 ++imapc->cmdid);
 
   /* start with a blank buffer */
   curlx_dyn_reset(&imapc->dyn);
index 8a39c1a4becf536aa07c60bcd7f17c8d8c7b3827..be65ea2055c214775e679aa4a8724fca8417a136 100644 (file)
@@ -93,8 +93,8 @@
 #include "curlx/multibyte.h"
 #include "curlx/base64.h"
 #include "connect.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -746,7 +746,7 @@ static void ldap_trace_low(const char *fmt, ...)
     return;
 
   va_start(args, fmt);
-  vfprintf(stderr, fmt, args);
+  curl_mvfprintf(stderr, fmt, args);
   va_end(args);
 }
 #endif /* DEBUG_LDAP */
index 241aadf14e7a15a28eef9798867721d706e7e903..9db85786e125324a2913a44bfa32a724534096ae 100644 (file)
--- a/lib/md4.c
+++ b/lib/md4.c
@@ -82,8 +82,7 @@
 #include <mbedtls/md4.h>
 #endif
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index e7d42ec1c0f159e7ce710353480bc08a4ee96757..091924034055e448a52954e891eed7371b2ae730 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -77,8 +77,7 @@
 #include <wincrypt.h>
 #endif
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 0c9d156715836f7c06b0771fd30c6c402051aeb4..7ded52c1e97c47631d5c0fd9299b64200339d004 100644 (file)
@@ -31,8 +31,7 @@
 #include "urldata.h"
 #include "curlx/fopen.h"  /* for CURLX_FOPEN_LOW() */
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -114,8 +113,8 @@ static bool countcheck(const char *func, int line, const char *source)
       curl_dbg_log("LIMIT %s:%d %s reached memlimit\n",
                    source, line, func);
       /* log to stderr also */
-      fprintf(stderr, "LIMIT %s:%d %s reached memlimit\n",
-              source, line, func);
+      curl_mfprintf(stderr, "LIMIT %s:%d %s reached memlimit\n",
+                    source, line, func);
       fflush(curl_dbg_logfile); /* because it might crash now */
       /* !checksrc! disable ERRNOVAR 1 */
       CURL_SETERRNO(ENOMEM);
@@ -469,7 +468,7 @@ void curl_dbg_log(const char *format, ...)
     return;
 
   va_start(ap, format);
-  nchars = mvsnprintf(buf, sizeof(buf), format, ap);
+  nchars = curl_mvsnprintf(buf, sizeof(buf), format, ap);
   va_end(ap);
 
   if(nchars > (int)sizeof(buf) - 1)
index fe632604ed9d41dd339640b235455690c8fe2857..b403d29b1fd9d0a1037400da5fcc11c038add98d 100644 (file)
@@ -49,8 +49,8 @@ struct Curl_easy;
 #include "rand.h"
 #include "slist.h"
 #include "curlx/dynbuf.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -1688,7 +1688,7 @@ CURLcode Curl_mime_add_header(struct curl_slist **slp, const char *fmt, ...)
   va_list ap;
 
   va_start(ap, fmt);
-  s = vaprintf(fmt, ap);
+  s = curl_mvaprintf(fmt, ap);
   va_end(ap);
 
   if(s) {
index 01dd4e0a0d449daa20b2860a6a4bb8002b017a12..c76ce0a229b7085edd49d92b7507a1464f97d0fa 100644 (file)
 #include "url.h"
 #include "escape.h"
 #include "curlx/warnless.h"
-#include "curl_printf.h"
-#include "curl_memory.h"
 #include "multiif.h"
 #include "rand.h"
 
-/* The last #include file should be: */
+/* The last 2 #includes file should be: */
+#include "curl_memory.h"
 #include "memdebug.h"
 
 /* first byte is command.
index 91d2f56d47327ce2b5c260b90f835030988c94a2..ced03eea9fbfc0646b67c4c0f6bcde3299d1e55b 100644 (file)
@@ -54,8 +54,8 @@
 #include "socketpair.h"
 #include "socks.h"
 #include "urlapi-int.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -522,8 +522,8 @@ static void debug_print_sock_hash(void *p)
 {
   struct Curl_sh_entry *sh = (struct Curl_sh_entry *)p;
 
-  fprintf(stderr, " [readers %u][writers %u]",
-          sh->readers, sh->writers);
+  curl_mfprintf(stderr, " [readers %u][writers %u]",
+                sh->readers, sh->writers);
 }
 #endif
 
@@ -4004,12 +4004,14 @@ static void multi_xfer_dump(struct Curl_multi *multi, unsigned int mid,
 
   (void)multi;
   if(!data) {
-    fprintf(stderr, "mid=%u, entry=NULL, bug in xfer table?\n", mid);
+    curl_mfprintf(stderr, "mid=%u, entry=NULL, bug in xfer table?\n", mid);
   }
   else {
-    fprintf(stderr, "mid=%u, magic=%s, p=%p, id=%" FMT_OFF_T ", url=%s\n",
-            mid, (data->magic == CURLEASY_MAGIC_NUMBER) ? "GOOD" : "BAD!",
-            (void *)data, data->id, data->state.url);
+    curl_mfprintf(stderr, "mid=%u, magic=%s, p=%p, id=%" FMT_OFF_T
+                  ", url=%s\n",
+                  mid,
+                  (data->magic == CURLEASY_MAGIC_NUMBER) ? "GOOD" : "BAD!",
+                  (void *)data, data->id, data->state.url);
   }
 }
 
@@ -4017,15 +4019,15 @@ static void multi_xfer_tbl_dump(struct Curl_multi *multi)
 {
   unsigned int mid;
   void *entry;
-  fprintf(stderr, "=== multi xfer table (count=%u, capacity=%u\n",
-          Curl_uint_tbl_count(&multi->xfers),
-          Curl_uint_tbl_capacity(&multi->xfers));
+  curl_mfprintf(stderr, "=== multi xfer table (count=%u, capacity=%u\n",
+                Curl_uint_tbl_count(&multi->xfers),
+                Curl_uint_tbl_capacity(&multi->xfers));
   if(Curl_uint_tbl_first(&multi->xfers, &mid, &entry)) {
     multi_xfer_dump(multi, mid, entry);
     while(Curl_uint_tbl_next(&multi->xfers, mid, &mid, &entry))
       multi_xfer_dump(multi, mid, entry);
   }
-  fprintf(stderr, "===\n");
+  curl_mfprintf(stderr, "===\n");
   fflush(stderr);
 }
 #endif /* DEBUGBUILD */
index f43423510ff96dd11f2f646b66a0642585825151..ff755caa6aa383f2a49c5e01810a7d83edc3cfbd 100644 (file)
@@ -40,8 +40,8 @@
 #include "curlx/warnless.h"
 #include "multihandle.h"
 #include "socks.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index a227ffefcd95022af900e2b16c121d343f210c53..f06dff8ed515e0afbef0eda64d23c520019cd913 100644 (file)
@@ -42,8 +42,7 @@
 #include "curlx/fopen.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -437,7 +436,7 @@ NETRCcode Curl_parsenetrc(struct store_netrc *store, const char *host,
         return NETRC_FILE_MISSING; /* no home directory found (or possibly out
                                       of memory) */
 
-      filealloc = aprintf("%s%s.netrc", home, DIR_CHAR);
+      filealloc = curl_maprintf("%s%s.netrc", home, DIR_CHAR);
       if(!filealloc) {
         free(homea);
         return NETRC_OUT_OF_MEMORY;
@@ -448,7 +447,7 @@ NETRCcode Curl_parsenetrc(struct store_netrc *store, const char *host,
 #ifdef _WIN32
     if(retcode == NETRC_FILE_MISSING) {
       /* fallback to the old-style "_netrc" file */
-      filealloc = aprintf("%s%s_netrc", home, DIR_CHAR);
+      filealloc = curl_maprintf("%s%s_netrc", home, DIR_CHAR);
       if(!filealloc) {
         free(homea);
         return NETRC_OUT_OF_MEMORY;
index 22b067ad1b026569f4c35c13ec7ac7ceec891b91..2983fa4a3aa71d25932271f27e79d554a930c575 100644 (file)
@@ -64,9 +64,10 @@ UNITTEST bool Curl_cidr4_match(const char *ipv4,    /* 1.2.3.4 address */
     unsigned int haddr = htonl(address);
     unsigned int hcheck = htonl(check);
 #if 0
-    fprintf(stderr, "Host %s (%x) network %s (%x) bits %u mask %x => %x\n",
-            ipv4, haddr, network, hcheck, bits, mask,
-            (haddr ^ hcheck) & mask);
+    curl_mfprintf(stderr, "Host %s (%x) network %s (%x) "
+                  "bits %u mask %x => %x\n",
+                  ipv4, haddr, network, hcheck, bits, mask,
+                  (haddr ^ hcheck) & mask);
 #endif
     if((haddr ^ hcheck) & mask)
       return FALSE;
index 6aa74e028f8b7209836c24f2492b126c2c867799..72cfdc7039a8ab6cefa7a0eaed51497ecf9316d1 100644 (file)
@@ -52,8 +52,8 @@
 #include "connect.h"
 #include "curl_sasl.h"
 #include "strcase.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -619,12 +619,12 @@ static CURLcode oldap_connect(struct Curl_easy *data, bool *done)
   if(result)
     goto out;
 
-  hosturl = aprintf("%s://%s%s%s:%d",
-                    conn->handler->scheme,
-                    conn->bits.ipv6_ip ? "[" : "",
-                    conn->host.name,
-                    conn->bits.ipv6_ip ? "]" : "",
-                    conn->remote_port);
+  hosturl = curl_maprintf("%s://%s%s%s:%d",
+                          conn->handler->scheme,
+                          conn->bits.ipv6_ip ? "[" : "",
+                          conn->host.name,
+                          conn->bits.ipv6_ip ? "]" : "",
+                          conn->remote_port);
   if(!hosturl) {
     result = CURLE_OUT_OF_MEMORY;
     goto out;
index 195e059ed1f4f9f06eaeefe0a9a6515badb1e602..ddd4020894471b71ea7b4fd5575fc59ef8af1560 100644 (file)
@@ -39,8 +39,7 @@
 #include "vtls/vtls.h"
 #include "strdup.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index f5ecfd178ba626efa0620adee1b188214bd4fda7..ce9f81e3d5aaeb17116b2f13c2951663621c78c7 100644 (file)
@@ -77,8 +77,8 @@
 #include "curl_md5.h"
 #include "curlx/warnless.h"
 #include "strdup.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -600,7 +600,7 @@ static CURLcode pop3_perform_apop(struct Curl_easy *data,
 
   /* Convert the calculated 16 octet digest into a 32 byte hex string */
   for(i = 0; i < MD5_DIGEST_LEN; i++)
-    msnprintf(&secret[2 * i], 3, "%02x", digest[i]);
+    curl_msnprintf(&secret[2 * i], 3, "%02x", digest[i]);
 
   result = Curl_pp_sendf(data, &pop3c->pp, "APOP %s %s", conn->user, secret);
 
index 2fa0fa122886e1463a34274b46680e773b08019f..7b473ef3ae931a153f7f91ed517026064452a40b 100644 (file)
@@ -29,7 +29,6 @@
 #include "multiif.h"
 #include "progress.h"
 #include "curlx/timeval.h"
-#include "curl_printf.h"
 
 /* check rate limits within this many recent milliseconds, at minimum. */
 #define MIN_RATE_LIMIT_PERIOD 3000
@@ -48,7 +47,8 @@ static void time2str(char *r, curl_off_t seconds)
   if(h <= 99) {
     curl_off_t m = (seconds - (h * 3600)) / 60;
     curl_off_t s = (seconds - (h * 3600)) - (m * 60);
-    msnprintf(r, 9, "%2" FMT_OFF_T ":%02" FMT_OFF_T ":%02" FMT_OFF_T, h, m, s);
+    curl_msnprintf(r, 9, "%2" FMT_OFF_T ":%02" FMT_OFF_T ":%02" FMT_OFF_T,
+                   h, m, s);
   }
   else {
     /* this equals to more than 99 hours, switch to a more suitable output
@@ -56,9 +56,9 @@ static void time2str(char *r, curl_off_t seconds)
     curl_off_t d = seconds / 86400;
     h = (seconds - (d * 86400)) / 3600;
     if(d <= 999)
-      msnprintf(r, 9, "%3" FMT_OFF_T "d %02" FMT_OFF_T "h", d, h);
+      curl_msnprintf(r, 9, "%3" FMT_OFF_T "d %02" FMT_OFF_T "h", d, h);
     else
-      msnprintf(r, 9, "%7" FMT_OFF_T "d", d);
+      curl_msnprintf(r, 9, "%7" FMT_OFF_T "d", d);
   }
 }
 
@@ -71,7 +71,7 @@ static char *max6data(curl_off_t bytes, char *max6)
   const char unit[] = { 'k', 'M', 'G', 'T', 'P', 0 };
   int k = 0;
   if(bytes < 1000000) {
-    msnprintf(max6, 7, "%5" CURL_FORMAT_CURL_OFF_T, bytes);
+    curl_msnprintf(max6, 7, "%5" CURL_FORMAT_CURL_OFF_T, bytes);
     return max6;
   }
 
@@ -79,14 +79,15 @@ static char *max6data(curl_off_t bytes, char *max6)
     curl_off_t nbytes = bytes / 1024;
     if(nbytes < 1000) {
       /* xxx.yU */
-      msnprintf(max6, 7, "%3" CURL_FORMAT_CURL_OFF_T
-                ".%" CURL_FORMAT_CURL_OFF_T "%c", nbytes,
-                (bytes%1024) / (1024/10), unit[k]);
+      curl_msnprintf(max6, 7, "%3" CURL_FORMAT_CURL_OFF_T
+                     ".%" CURL_FORMAT_CURL_OFF_T "%c", nbytes,
+                     (bytes%1024) / (1024/10), unit[k]);
       break;
     }
     else if(nbytes < 100000) {
       /* xxxxxU */
-      msnprintf(max6, 7, "%5" CURL_FORMAT_CURL_OFF_T "%c", nbytes, unit[k]);
+      curl_msnprintf(max6, 7, "%5" CURL_FORMAT_CURL_OFF_T "%c",
+                     nbytes, unit[k]);
       break;
     }
     bytes = nbytes;
@@ -122,7 +123,7 @@ int Curl_pgrsDone(struct Curl_easy *data)
   if(!data->progress.hide && !data->progress.callback)
     /* only output if we do not use a progress callback and we are not
      * hidden */
-    fprintf(data->set.err, "\n");
+    curl_mfprintf(data->set.err, "\n");
 
   data->progress.speeder_c = 0; /* reset the progress meter display */
   return 0;
@@ -500,15 +501,15 @@ static void progress_meter(struct Curl_easy *data)
 
   if(!p->headers_out) {
     if(data->state.resume_from) {
-      fprintf(data->set.err,
-              "** Resuming transfer from byte position %" FMT_OFF_T "\n",
-              data->state.resume_from);
+      curl_mfprintf(data->set.err,
+                    "** Resuming transfer from byte position %" FMT_OFF_T "\n",
+                    data->state.resume_from);
     }
-    fprintf(data->set.err,
-            "  %% Total    %% Received %% Xferd  Average Speed   "
-            "Time    Time     Time  Current\n"
-            "                                 Dload  Upload   "
-            "Total   Spent    Left  Speed\n");
+    curl_mfprintf(data->set.err,
+                  "  %% Total    %% Received %% Xferd  Average Speed   "
+                  "Time    Time     Time  Current\n"
+                  "                                 Dload  Upload   "
+                  "Total   Spent    Left  Speed\n");
     p->headers_out = TRUE; /* headers are shown */
   }
 
@@ -542,23 +543,23 @@ static void progress_meter(struct Curl_easy *data)
   /* Get the percentage of data transferred so far */
   total_estm.percent = pgrs_est_percent(total_expected_size, total_cur_size);
 
-  fprintf(data->set.err,
-          "\r"
-          "%3" FMT_OFF_T " %s "
-          "%3" FMT_OFF_T " %s "
-          "%3" FMT_OFF_T " %s %s %s  %s %s %s %s",
-          total_estm.percent, /* 3 letters */           /* total % */
-          max6data(total_expected_size, max6[2]),       /* total size */
-          dl_estm.percent, /* 3 letters */              /* rcvd % */
-          max6data(p->dl.cur_size, max6[0]),            /* rcvd size */
-          ul_estm.percent, /* 3 letters */              /* xfer % */
-          max6data(p->ul.cur_size, max6[1]),            /* xfer size */
-          max6data(p->dl.speed, max6[3]),               /* avrg dl speed */
-          max6data(p->ul.speed, max6[4]),               /* avrg ul speed */
-          time_total,    /* 8 letters */                /* total time */
-          time_spent,    /* 8 letters */                /* time spent */
-          time_left,     /* 8 letters */                /* time left */
-          max6data(p->current_speed, max6[5])
+  curl_mfprintf(data->set.err,
+                "\r"
+                "%3" FMT_OFF_T " %s "
+                "%3" FMT_OFF_T " %s "
+                "%3" FMT_OFF_T " %s %s %s  %s %s %s %s",
+                total_estm.percent, /* 3 letters */         /* total % */
+                max6data(total_expected_size, max6[2]),     /* total size */
+                dl_estm.percent, /* 3 letters */            /* rcvd % */
+                max6data(p->dl.cur_size, max6[0]),          /* rcvd size */
+                ul_estm.percent, /* 3 letters */            /* xfer % */
+                max6data(p->ul.cur_size, max6[1]),          /* xfer size */
+                max6data(p->dl.speed, max6[3]),             /* avrg dl speed */
+                max6data(p->ul.speed, max6[4]),             /* avrg ul speed */
+                time_total,    /* 8 letters */              /* total time */
+                time_spent,    /* 8 letters */              /* time spent */
+                time_left,     /* 8 letters */              /* time left */
+                max6data(p->current_speed, max6[5])
     );
 
   /* we flush the output stream to make it appear as soon as possible */
index a488a46e9315a1a3dd2b4eefd06418b247dae6e6..832d6d21b94a6fafd1d05056e9156580c1e47d5a 100644 (file)
--- a/lib/psl.c
+++ b/lib/psl.c
@@ -31,8 +31,7 @@
 #include "psl.h"
 #include "share.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 8b7f07ae40551dc8ced76d7687131fc925150c2f..cbfcbf27409b5800a4168ee6c8a2327c173c253b 100644 (file)
@@ -38,8 +38,7 @@
 #include "rand.h"
 #include "escape.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index d3a46e0e6a760d5d062afa0fc38df8420559acec..4c66ce4ed0eb7b88bb31d05e08ea71dec468d614 100644 (file)
@@ -32,8 +32,7 @@
 #include "curlx/multibyte.h"
 #include "curlx/timeval.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 2d5ad9521209d24c12e451e52c24384611370bde..1fa568325bbf7749440b674a1cc524848dc35545 100644 (file)
@@ -36,8 +36,7 @@
 #include "url.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 1d5f44f91b248526c38e6591441801665f4e9198..3ede0fe62ddc11dff71b720386e69d632fe02918 100644 (file)
@@ -41,8 +41,8 @@
 #include "cfilters.h"
 #include "strdup.h"
 #include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -482,8 +482,8 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
     if(data->set.str[STRING_RTSP_TRANSPORT]) {
       free(data->state.aptr.rtsp_transport);
       data->state.aptr.rtsp_transport =
-        aprintf("Transport: %s\r\n",
-                data->set.str[STRING_RTSP_TRANSPORT]);
+        curl_maprintf("Transport: %s\r\n",
+                      data->set.str[STRING_RTSP_TRANSPORT]);
       if(!data->state.aptr.rtsp_transport)
         return CURLE_OUT_OF_MEMORY;
     }
@@ -508,7 +508,8 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
        data->set.str[STRING_ENCODING]) {
       free(data->state.aptr.accept_encoding);
       data->state.aptr.accept_encoding =
-        aprintf("Accept-Encoding: %s\r\n", data->set.str[STRING_ENCODING]);
+        curl_maprintf("Accept-Encoding: %s\r\n",
+                      data->set.str[STRING_ENCODING]);
 
       if(!data->state.aptr.accept_encoding) {
         result = CURLE_OUT_OF_MEMORY;
@@ -545,7 +546,8 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
   /* Referrer */
   Curl_safefree(data->state.aptr.ref);
   if(data->state.referer && !Curl_checkheaders(data, STRCONST("Referer")))
-    data->state.aptr.ref = aprintf("Referer: %s\r\n", data->state.referer);
+    data->state.aptr.ref = curl_maprintf("Referer: %s\r\n",
+                                         data->state.referer);
 
   p_referrer = data->state.aptr.ref;
 
@@ -561,7 +563,8 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
     /* Check to see if there is a range set in the custom headers */
     if(!Curl_checkheaders(data, STRCONST("Range")) && data->state.range) {
       free(data->state.aptr.rangeline);
-      data->state.aptr.rangeline = aprintf("Range: %s\r\n", data->state.range);
+      data->state.aptr.rangeline = curl_maprintf("Range: %s\r\n",
+                                                 data->state.range);
       p_range = data->state.aptr.rangeline;
     }
   }
index af78cb836b0be26b3af581478507c3b8b5d7eac6..7818082e754369af05a4a441c6021c2fa7ced5ee 100644 (file)
@@ -45,8 +45,8 @@
 #include "curlx/timediff.h"
 #include "curlx/wait.h"
 #include "curlx/warnless.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index a262d9036fd96a66a31f8e49e3cf528e84a16b8e..c6d84127620b3f01c25bfbee3187d03791a0dea1 100644 (file)
@@ -56,8 +56,7 @@
 #include "curlx/warnless.h"
 #include "ws.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 1c9ee42d41b9827d39639bd02fc978db91d309a5..5558bded0a116e134013e68b970efae9ecd8b3ca 100644 (file)
@@ -55,8 +55,7 @@
 #include "strdup.h"
 #include "escape.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index c5ed8b9c8f6957f3cf12bdda7f0fe602dffced10..2d0357189a0ecf56fba2944aaca47b6a8c04ba25 100644 (file)
@@ -52,8 +52,7 @@
 #include <wincrypt.h>
 #endif
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index d1ab55eb2769efc3dc6ccaf5321f6bf76ac62337..711622a170a2782c4c2a1e38cc77c6f69c3db6de 100644 (file)
@@ -34,8 +34,7 @@
 #include "hsts.h"
 #include "url.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index bf02119ea1dbd25e1a1b55426ce200ea5483c92a..f7d06eb4900eb2db0b1c7a12d92fda468fe81b47 100644 (file)
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -42,8 +42,7 @@
 #include "escape.h"
 #include "curl_endian.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -718,12 +717,12 @@ static CURLcode smb_send_setup(struct Curl_easy *data)
   p += sizeof(lm);
   memcpy(p, nt, sizeof(nt));
   p += sizeof(nt);
-  p += msnprintf(p, byte_count - sizeof(nt) - sizeof(lm),
-                 "%s%c"  /* user */
-                 "%s%c"  /* domain */
-                 "%s%c"  /* OS */
-                 "%s", /* client name */
-                 smbc->user, 0, smbc->domain, 0, CURL_OS, 0, CLIENTNAME);
+  p += curl_msnprintf(p, byte_count - sizeof(nt) - sizeof(lm),
+                      "%s%c"  /* user */
+                      "%s%c"  /* domain */
+                      "%s%c"  /* OS */
+                      "%s", /* client name */
+                      smbc->user, 0, smbc->domain, 0, CURL_OS, 0, CLIENTNAME);
   p++; /* count the final null-termination */
   DEBUGASSERT(byte_count == (size_t)(p - msg.bytes));
   msg.byte_count = smb_swap16((unsigned short)byte_count);
@@ -750,11 +749,11 @@ static CURLcode smb_send_tree_connect(struct Curl_easy *data,
   msg.andx.command = SMB_COM_NO_ANDX_COMMAND;
   msg.pw_len = 0;
 
-  p += msnprintf(p, byte_count,
-                 "\\\\%s\\"  /* hostname */
-                 "%s%c"      /* share */
-                 "%s",       /* service */
-                 conn->host.name, smbc->share, 0, SERVICENAME);
+  p += curl_msnprintf(p, byte_count,
+                      "\\\\%s\\"  /* hostname */
+                      "%s%c"      /* share */
+                      "%s",       /* service */
+                      conn->host.name, smbc->share, 0, SERVICENAME);
   p++; /* count the final null-termination */
   DEBUGASSERT(byte_count == (size_t)(p - msg.bytes));
   msg.byte_count = smb_swap16((unsigned short)byte_count);
index 84ff693a3c4ea7e0a5af3fe6dc784e40c55d30ca..8daf0ad89de3f5995a84443479f680ab2242fe69 100644 (file)
@@ -81,8 +81,7 @@
 #include "idn.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -712,14 +711,14 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data,
             (!Curl_is_ASCII_name(host.name)));
 
     if(host.name) {
-      from = aprintf("<%s@%s>%s", address, host.name, suffix);
+      from = curl_maprintf("<%s@%s>%s", address, host.name, suffix);
 
       Curl_free_idnconverted_hostname(&host);
     }
     else
       /* An invalid mailbox was provided but we will simply let the server
          worry about that and reply with a 501 error */
-      from = aprintf("<%s>%s", address, suffix);
+      from = curl_maprintf("<%s>%s", address, suffix);
 
     free(address);
   }
@@ -754,14 +753,14 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data,
         utf8 = TRUE;
 
       if(host.name) {
-        auth = aprintf("<%s@%s>%s", address, host.name, suffix);
+        auth = curl_maprintf("<%s@%s>%s", address, host.name, suffix);
 
         Curl_free_idnconverted_hostname(&host);
       }
       else
         /* An invalid mailbox was provided but we will simply let the server
            worry about it */
-        auth = aprintf("<%s>%s", address, suffix);
+        auth = curl_maprintf("<%s>%s", address, suffix);
       free(address);
     }
     else
@@ -806,7 +805,7 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data,
 
   /* Calculate the optional SIZE parameter */
   if(smtpc->size_supported && data->state.infilesize > 0) {
-    size = aprintf("%" FMT_OFF_T, data->state.infilesize);
+    size = curl_maprintf("%" FMT_OFF_T, data->state.infilesize);
 
     if(!size) {
       result = CURLE_OUT_OF_MEMORY;
index d2fd41141b242343bfdea910277780828eeb9bd6..45e908bbf3a946d43c49a40c9a62b80f318f903c 100644 (file)
@@ -134,8 +134,7 @@ int Curl_socketpair(int domain, int type, int protocol,
 #include "curlx/timeval.h"  /* needed before select.h */
 #include "select.h"   /* for Curl_poll */
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index da974ad6d8d72749ad2c2ab4bad5efbb4cb1a8c8..ba7b28d04a01f89be47184f9206bdef1dd43a00f 100644 (file)
@@ -45,8 +45,7 @@
 #include "curlx/inet_pton.h"
 #include "url.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index a88b6f7b75f72caedb00e82460e8de249a00fbb9..5ad93441a830384535e554e43740a414d751c38a 100644 (file)
@@ -37,8 +37,7 @@
 #include "curlx/warnless.h"
 #include "strdup.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -160,8 +159,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
       return CURLE_OUT_OF_MEMORY;
     service.length = serviceptr_length +
       strlen(conn->socks_proxy.host.name) + 1;
-    msnprintf(service.value, service.length + 1, "%s@%s",
-              serviceptr, conn->socks_proxy.host.name);
+    curl_msnprintf(service.value, service.length + 1, "%s@%s",
+                   serviceptr, conn->socks_proxy.host.name);
 
     gss_major_status = gss_import_name(&gss_minor_status, &service,
                                        GSS_C_NT_HOSTBASED_SERVICE, &server);
index 16e22d1f39f5f7831cd84b29509a0d1dc4575044..69b000421944319b327afeacdae6cd85f126d825 100644 (file)
@@ -38,8 +38,8 @@
 #include "curlx/multibyte.h"
 #include "curlx/warnless.h"
 #include "strdup.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -104,7 +104,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
   if(strchr(service, '/'))
     service_name = strdup(service);
   else
-    service_name = aprintf("%s/%s", service, conn->socks_proxy.host.name);
+    service_name = curl_maprintf("%s/%s",
+                                 service, conn->socks_proxy.host.name);
   if(!service_name)
     return CURLE_OUT_OF_MEMORY;
 
index 259a0c8931ce76bc8e5d51af409278705bf12b3b..1ae15d3704bd60befb47d7e57f0235271416948d 100644 (file)
@@ -60,8 +60,7 @@
 #include "curlx/warnless.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -814,7 +813,7 @@ static CURLcode check_telnet_options(struct Curl_easy *data,
       DEBUGF(infof(data, "set a non ASCII username in telnet"));
       return CURLE_BAD_FUNCTION_ARGUMENT;
     }
-    msnprintf(buffer, sizeof(buffer), "USER,%s", data->conn->user);
+    curl_msnprintf(buffer, sizeof(buffer), "USER,%s", data->conn->user);
     beg = curl_slist_append(tn->telnet_vars, buffer);
     if(!beg) {
       curl_slist_free_all(tn->telnet_vars);
@@ -957,9 +956,10 @@ static CURLcode suboption(struct Curl_easy *data, struct TELNET *tn)
         failf(data, "Tool long telnet TTYPE");
         return CURLE_SEND_ERROR;
       }
-      len = msnprintf((char *)temp, sizeof(temp), "%c%c%c%c%s%c%c",
-                      CURL_IAC, CURL_SB, CURL_TELOPT_TTYPE,
-                      CURL_TELQUAL_IS, tn->subopt_ttype, CURL_IAC, CURL_SE);
+      len = curl_msnprintf((char *)temp, sizeof(temp), "%c%c%c%c%s%c%c",
+                           CURL_IAC, CURL_SB, CURL_TELOPT_TTYPE,
+                           CURL_TELQUAL_IS, tn->subopt_ttype, CURL_IAC,
+                           CURL_SE);
       bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len);
 
       if(bytes_written < 0) {
@@ -976,9 +976,10 @@ static CURLcode suboption(struct Curl_easy *data, struct TELNET *tn)
         failf(data, "Tool long telnet XDISPLOC");
         return CURLE_SEND_ERROR;
       }
-      len = msnprintf((char *)temp, sizeof(temp), "%c%c%c%c%s%c%c",
-                      CURL_IAC, CURL_SB, CURL_TELOPT_XDISPLOC,
-                      CURL_TELQUAL_IS, tn->subopt_xdisploc, CURL_IAC, CURL_SE);
+      len = curl_msnprintf((char *)temp, sizeof(temp), "%c%c%c%c%s%c%c",
+                           CURL_IAC, CURL_SB, CURL_TELOPT_XDISPLOC,
+                           CURL_TELQUAL_IS, tn->subopt_xdisploc, CURL_IAC,
+                           CURL_SE);
       bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len);
       if(bytes_written < 0) {
         err = SOCKERRNO;
@@ -987,9 +988,9 @@ static CURLcode suboption(struct Curl_easy *data, struct TELNET *tn)
       printsub(data, '>', &temp[2], len-2);
       break;
     case CURL_TELOPT_NEW_ENVIRON:
-      len = msnprintf((char *)temp, sizeof(temp), "%c%c%c%c",
-                      CURL_IAC, CURL_SB, CURL_TELOPT_NEW_ENVIRON,
-                      CURL_TELQUAL_IS);
+      len = curl_msnprintf((char *)temp, sizeof(temp), "%c%c%c%c",
+                           CURL_IAC, CURL_SB, CURL_TELOPT_NEW_ENVIRON,
+                           CURL_TELQUAL_IS);
       for(v = tn->telnet_vars; v; v = v->next) {
         size_t tmplen = (strlen(v->data) + 1);
         if(bad_option(v->data))
@@ -998,18 +999,18 @@ static CURLcode suboption(struct Curl_easy *data, struct TELNET *tn)
         if(len + tmplen < (int)sizeof(temp)-6) {
           char *s = strchr(v->data, ',');
           if(!s)
-            len += msnprintf((char *)&temp[len], sizeof(temp) - len,
-                             "%c%s", CURL_NEW_ENV_VAR, v->data);
+            len += curl_msnprintf((char *)&temp[len], sizeof(temp) - len,
+                                  "%c%s", CURL_NEW_ENV_VAR, v->data);
           else {
             size_t vlen = s - v->data;
-            len += msnprintf((char *)&temp[len], sizeof(temp) - len,
-                             "%c%.*s%c%s", CURL_NEW_ENV_VAR,
-                             (int)vlen, v->data, CURL_NEW_ENV_VALUE, ++s);
+            len += curl_msnprintf((char *)&temp[len], sizeof(temp) - len,
+                                  "%c%.*s%c%s", CURL_NEW_ENV_VAR,
+                                  (int)vlen, v->data, CURL_NEW_ENV_VALUE, ++s);
           }
         }
       }
-      msnprintf((char *)&temp[len], sizeof(temp) - len,
-                "%c%c", CURL_IAC, CURL_SE);
+      curl_msnprintf((char *)&temp[len], sizeof(temp) - len,
+                     "%c%c", CURL_IAC, CURL_SE);
       len += 2;
       bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len);
       if(bytes_written < 0) {
index b6bc5e9bdca194c5e93f5f23bc24835c0ca10f73..b81fd3ee14b57f07a8b72d2696b0b5b796c1d32b 100644 (file)
@@ -65,8 +65,7 @@
 #include "curlx/strerr.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -474,18 +473,18 @@ static CURLcode tftp_send_first(struct tftp_conn *state,
       return CURLE_TFTP_ILLEGAL; /* too long filename field */
     }
 
-    msnprintf((char *)state->spacket.data + 2,
-              state->blksize,
-              "%s%c%s%c", filename, '\0',  mode, '\0');
+    curl_msnprintf((char *)state->spacket.data + 2,
+                   state->blksize,
+                   "%s%c%s%c", filename, '\0',  mode, '\0');
     sbytes = 4 + strlen(filename) + strlen(mode);
 
     /* optional addition of TFTP options */
     if(!data->set.tftp_no_options) {
       char buf[64];
       /* add tsize option */
-      msnprintf(buf, sizeof(buf), "%" FMT_OFF_T,
-                data->state.upload && (data->state.infilesize != -1) ?
-                data->state.infilesize : 0);
+      curl_msnprintf(buf, sizeof(buf), "%" FMT_OFF_T,
+                     data->state.upload && (data->state.infilesize != -1) ?
+                     data->state.infilesize : 0);
 
       result = tftp_option_add(state, &sbytes,
                                (char *)state->spacket.data + sbytes,
@@ -495,7 +494,7 @@ static CURLcode tftp_send_first(struct tftp_conn *state,
                                  (char *)state->spacket.data + sbytes, buf);
 
       /* add blksize option */
-      msnprintf(buf, sizeof(buf), "%d", state->requested_blksize);
+      curl_msnprintf(buf, sizeof(buf), "%d", state->requested_blksize);
       if(result == CURLE_OK)
         result = tftp_option_add(state, &sbytes,
                                  (char *)state->spacket.data + sbytes,
@@ -505,7 +504,7 @@ static CURLcode tftp_send_first(struct tftp_conn *state,
                                  (char *)state->spacket.data + sbytes, buf);
 
       /* add timeout option */
-      msnprintf(buf, sizeof(buf), "%d", state->retry_time);
+      curl_msnprintf(buf, sizeof(buf), "%d", state->retry_time);
       if(result == CURLE_OK)
         result = tftp_option_add(state, &sbytes,
                                  (char *)state->spacket.data + sbytes,
index 62528d2275770ce67ca9908f7206246a567ba219..e8c030687a5ed2731032c3414ef9be35d4b1b99c 100644 (file)
@@ -83,8 +83,7 @@
 #include "setopt.h"
 #include "headers.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -623,7 +622,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
   if(data->set.str[STRING_USERAGENT]) {
     free(data->state.aptr.uagent);
     data->state.aptr.uagent =
-      aprintf("User-Agent: %s\r\n", data->set.str[STRING_USERAGENT]);
+      curl_maprintf("User-Agent: %s\r\n", data->set.str[STRING_USERAGENT]);
     if(!data->state.aptr.uagent)
       return CURLE_OUT_OF_MEMORY;
   }
index 1c60f22adff241ca37ffe32bfc08d3ee0a2f18ee..7b822344c1f6d96fb8313db2a5d08269afce0a4f 100644 (file)
@@ -25,8 +25,7 @@
 #include "curl_setup.h"
 #include "uint-bset.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index d12cdcb4aa1fa69bae1f1ebb0705e811e0c79687..2e8e2a139e7400e10a5aab6211f31d5204c50281 100644 (file)
@@ -26,8 +26,7 @@
 #include "uint-bset.h"
 #include "uint-spbset.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 21bcb6e1cf380e1a0b9bf9f48e9931f52c66f6be..5077363ab0f39d164d1a582f7cdb3f99cddb8ae8 100644 (file)
@@ -25,8 +25,7 @@
 #include "curl_setup.h"
 #include "uint-table.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 2a46354c611d207dfdab08294a37da94d75a6497..6a433b09efd1cc6a169d1218656000fddd9ddd11 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
 #include "headers.h"
 #include "curlx/strerr.h"
 #include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -504,7 +504,7 @@ CURLcode Curl_open(struct Curl_easy **curl)
   data = calloc(1, sizeof(struct Curl_easy));
   if(!data) {
     /* this is a serious error */
-    DEBUGF(fprintf(stderr, "Error: calloc of Curl_easy failed\n"));
+    DEBUGF(curl_mfprintf(stderr, "Error: calloc of Curl_easy failed\n"));
     return CURLE_OUT_OF_MEMORY;
   }
 
@@ -1785,8 +1785,9 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
 
   if(data->set.str[STRING_DEFAULT_PROTOCOL] &&
      !Curl_is_absolute_url(data->state.url, NULL, 0, TRUE)) {
-    char *url = aprintf("%s://%s", data->set.str[STRING_DEFAULT_PROTOCOL],
-                        data->state.url);
+    char *url = curl_maprintf("%s://%s",
+                              data->set.str[STRING_DEFAULT_PROTOCOL],
+                              data->state.url);
     if(!url)
       return CURLE_OUT_OF_MEMORY;
     if(data->state.url_alloc)
@@ -1997,7 +1998,7 @@ static CURLcode setup_range(struct Curl_easy *data)
       free(s->range);
 
     if(s->resume_from)
-      s->range = aprintf("%" FMT_OFF_T "-", s->resume_from);
+      s->range = curl_maprintf("%" FMT_OFF_T "-", s->resume_from);
     else
       s->range = strdup(data->set.str[STRING_SET_RANGE]);
 
@@ -2055,9 +2056,10 @@ static CURLcode setup_connection_internals(struct Curl_easy *data,
   }
 
 #ifdef USE_IPV6
-  conn->destination = aprintf("%u/%d/%s", conn->scope_id, port, hostname);
+  conn->destination = curl_maprintf("%u/%d/%s", conn->scope_id, port,
+                                    hostname);
 #else
-  conn->destination = aprintf("%d/%s", port, hostname);
+  conn->destination = curl_maprintf("%d/%s", port, hostname);
 #endif
   if(!conn->destination)
     return CURLE_OUT_OF_MEMORY;
@@ -2105,7 +2107,8 @@ static char *detect_proxy(struct Curl_easy *data,
   (void)data;
 #endif
 
-  msnprintf(proxy_env, sizeof(proxy_env), "%s_proxy", conn->handler->scheme);
+  curl_msnprintf(proxy_env, sizeof(proxy_env), "%s_proxy",
+                 conn->handler->scheme);
 
   /* read the protocol proxy: */
   proxy = curl_getenv(proxy_env);
@@ -2323,7 +2326,7 @@ static CURLcode parse_proxy(struct Curl_easy *data,
     if(strcmp("/", path)) {
       is_unix_proxy = TRUE;
       free(host);
-      host = aprintf(UNIX_SOCKET_PREFIX"%s", path);
+      host = curl_maprintf(UNIX_SOCKET_PREFIX"%s", path);
       if(!host) {
         result = CURLE_OUT_OF_MEMORY;
         goto error;
@@ -2671,7 +2674,7 @@ static CURLcode parse_remote_port(struct Curl_easy *data,
     char portbuf[16];
     CURLUcode uc;
     conn->remote_port = data->set.use_port;
-    msnprintf(portbuf, sizeof(portbuf), "%d", conn->remote_port);
+    curl_msnprintf(portbuf, sizeof(portbuf), "%d", conn->remote_port);
     uc = curl_url_set(data->state.uh, CURLUPART_PORT, portbuf, 0);
     if(uc)
       return CURLE_OUT_OF_MEMORY;
@@ -2982,10 +2985,10 @@ static CURLcode parse_connect_to_string(struct Curl_easy *data,
   else {
     /* check whether the URL's hostname matches */
     size_t hostname_to_match_len;
-    char *hostname_to_match = aprintf("%s%s%s",
-                                      conn->bits.ipv6_ip ? "[" : "",
-                                      conn->host.name,
-                                      conn->bits.ipv6_ip ? "]" : "");
+    char *hostname_to_match = curl_maprintf("%s%s%s",
+                                            conn->bits.ipv6_ip ? "[" : "",
+                                            conn->host.name,
+                                            conn->bits.ipv6_ip ? "]" : "");
     if(!hostname_to_match)
       return CURLE_OUT_OF_MEMORY;
     hostname_to_match_len = strlen(hostname_to_match);
@@ -3703,7 +3706,7 @@ static CURLcode create_conn(struct Curl_easy *data,
        */
       result = Curl_ssl_conn_config_init(data, conn);
       if(result) {
-        DEBUGF(fprintf(stderr, "Error: init connection ssl config\n"));
+        DEBUGF(curl_mfprintf(stderr, "Error: init connection ssl config\n"));
         goto out;
       }
 
index 7776645b4a0b33f0f5ffa39fc692e3f8dd2a5ac1..0a6ae5ba1a7caef53b1784d9354b6502db192bd8 100644 (file)
@@ -37,8 +37,7 @@
 #include "curlx/strparse.h"
 #include "curl_memrchr.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
@@ -461,7 +460,7 @@ UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host,
     u->portnum = (unsigned short) port;
     /* generate a new port number string to get rid of leading zeroes etc */
     free(u->port);
-    u->port = aprintf("%" CURL_FORMAT_CURL_OFF_T, port);
+    u->port = curl_maprintf("%" CURL_FORMAT_CURL_OFF_T, port);
     if(!u->port)
       return CURLUE_OUT_OF_MEMORY;
   }
@@ -1430,12 +1429,12 @@ static CURLUcode urlget_url(const CURLU *u, char **part, unsigned int flags)
   bool urlencode = (flags & CURLU_URLENCODE) ? 1 : 0;
   char portbuf[7];
   if(u->scheme && curl_strequal("file", u->scheme)) {
-    url = aprintf("file://%s%s%s%s%s",
-                  u->path,
-                  show_query ? "?": "",
-                  u->query ? u->query : "",
-                  show_fragment ? "#": "",
-                  u->fragment ? u->fragment : "");
+    url = curl_maprintf("file://%s%s%s%s%s",
+                        u->path,
+                        show_query ? "?": "",
+                        u->query ? u->query : "",
+                        show_fragment ? "#": "",
+                        u->fragment ? u->fragment : "");
   }
   else if(!u->host)
     return CURLUE_NO_HOST;
@@ -1454,7 +1453,7 @@ static CURLUcode urlget_url(const CURLU *u, char **part, unsigned int flags)
       /* there is no stored port number, but asked to deliver
          a default one for the scheme */
       if(h) {
-        msnprintf(portbuf, sizeof(portbuf), "%u", h->defport);
+        curl_msnprintf(portbuf, sizeof(portbuf), "%u", h->defport);
         port = portbuf;
       }
     }
@@ -1502,26 +1501,26 @@ static CURLUcode urlget_url(const CURLU *u, char **part, unsigned int flags)
     }
 
     if(!(flags & CURLU_NO_GUESS_SCHEME) || !u->guessed_scheme)
-      msnprintf(schemebuf, sizeof(schemebuf), "%s://", scheme);
+      curl_msnprintf(schemebuf, sizeof(schemebuf), "%s://", scheme);
     else
       schemebuf[0] = 0;
 
-    url = aprintf("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
-                  schemebuf,
-                  u->user ? u->user : "",
-                  u->password ? ":": "",
-                  u->password ? u->password : "",
-                  options ? ";" : "",
-                  options ? options : "",
-                  (u->user || u->password || options) ? "@": "",
-                  allochost ? allochost : u->host,
-                  port ? ":": "",
-                  port ? port : "",
-                  u->path ? u->path : "/",
-                  show_query ? "?": "",
-                  u->query ? u->query : "",
-                  show_fragment ? "#": "",
-                  u->fragment ? u->fragment : "");
+    url = curl_maprintf("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+                        schemebuf,
+                        u->user ? u->user : "",
+                        u->password ? ":": "",
+                        u->password ? u->password : "",
+                        options ? ";" : "",
+                        options ? options : "",
+                        (u->user || u->password || options) ? "@": "",
+                        allochost ? allochost : u->host,
+                        port ? ":": "",
+                        port ? port : "",
+                        u->path ? u->path : "/",
+                        show_query ? "?": "",
+                        u->query ? u->query : "",
+                        show_fragment ? "#": "",
+                        u->fragment ? u->fragment : "");
     free(allochost);
   }
   if(!url)
@@ -1580,7 +1579,7 @@ CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
          a default one for the scheme */
       const struct Curl_handler *h = Curl_get_scheme_handler(u->scheme);
       if(h) {
-        msnprintf(portbuf, sizeof(portbuf), "%u", h->defport);
+        curl_msnprintf(portbuf, sizeof(portbuf), "%u", h->defport);
         ptr = portbuf;
       }
     }
@@ -1665,7 +1664,7 @@ static CURLUcode set_url_port(CURLU *u, const char *provided_port)
   if(curlx_str_number(&provided_port, &port, 0xffff) || *provided_port)
     /* weirdly provided number, not good! */
     return CURLUE_BAD_PORT_NUMBER;
-  tmp = aprintf("%" CURL_FORMAT_CURL_OFF_T, port);
+  tmp = curl_maprintf("%" CURL_FORMAT_CURL_OFF_T, port);
   if(!tmp)
     return CURLUE_OUT_OF_MEMORY;
   free(u->port);
diff --git a/lib/vauth/.checksrc b/lib/vauth/.checksrc
deleted file mode 100644 (file)
index e69de29..0000000
index ebf026fcf5ff93bb557d97032bad69b92263fbfc..dcfb13912d27bcdfaad6e309e755cfbf72d0f670 100644 (file)
@@ -37,7 +37,6 @@
 #include "vauth.h"
 #include "../curlx/warnless.h"
 #include "../sendf.h"
-#include "../curl_printf.h"
 
 /* The last #include files should be: */
 #include "../curl_memory.h"
index 3586e1012d0a35b841b2f77a42780153043ad3b1..2754ddc4a29fd96969eb82f435ea520345629116 100644 (file)
@@ -35,7 +35,6 @@
 #include "../curl_hmac.h"
 #include "../curl_md5.h"
 #include "../curlx/warnless.h"
-#include "../curl_printf.h"
 
 /* The last #include files should be: */
 #include "../curl_memory.h"
@@ -82,7 +81,7 @@ CURLcode Curl_auth_create_cram_md5_message(const struct bufref *chlg,
   Curl_HMAC_final(ctxt, digest);
 
   /* Generate the response */
-  response = aprintf(
+  response = curl_maprintf(
     "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
     userp, digest[0], digest[1], digest[2], digest[3], digest[4],
     digest[5], digest[6], digest[7], digest[8], digest[9], digest[10],
index 898629a958f15deb317bcea4b1aef239a6501da0..4196ae725c1d314ed0f28e79a5470556a028ba10 100644 (file)
@@ -42,7 +42,6 @@
 #include "../vtls/vtls.h"
 #include "../curlx/warnless.h"
 #include "../curlx/strparse.h"
-#include "../curl_printf.h"
 #include "../rand.h"
 
 /* The last #include files should be: */
@@ -147,7 +146,7 @@ static void auth_digest_md5_to_ascii(unsigned char *source, /* 16 bytes */
 {
   int i;
   for(i = 0; i < 16; i++)
-    msnprintf((char *) &dest[i * 2], 3, "%02x", source[i]);
+    curl_msnprintf((char *) &dest[i * 2], 3, "%02x", source[i]);
 }
 
 /* Convert sha256 or SHA-512/256 chunk to RFC7616 -suitable ASCII string */
@@ -156,7 +155,7 @@ static void auth_digest_sha256_to_ascii(unsigned char *source, /* 32 bytes */
 {
   int i;
   for(i = 0; i < 32; i++)
-    msnprintf((char *) &dest[i * 2], 3, "%02x", source[i]);
+    curl_msnprintf((char *) &dest[i * 2], 3, "%02x", source[i]);
 }
 
 /* Perform quoted-string escaping as described in RFC2616 and its errata */
@@ -404,7 +403,7 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
 
   /* Convert calculated 16 octet hex into 32 bytes string */
   for(i = 0; i < MD5_DIGEST_LEN; i++)
-    msnprintf(&HA1_hex[2 * i], 3, "%02x", digest[i]);
+    curl_msnprintf(&HA1_hex[2 * i], 3, "%02x", digest[i]);
 
   /* Generate our SPN */
   spn = Curl_auth_build_spn(service, data->conn->host.name, NULL);
@@ -427,7 +426,7 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
   Curl_MD5_final(ctxt, digest);
 
   for(i = 0; i < MD5_DIGEST_LEN; i++)
-    msnprintf(&HA2_hex[2 * i], 3, "%02x", digest[i]);
+    curl_msnprintf(&HA2_hex[2 * i], 3, "%02x", digest[i]);
 
   /* Now calculate the response hash */
   ctxt = Curl_MD5_init(&Curl_DIGEST_MD5);
@@ -457,14 +456,14 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
   Curl_MD5_final(ctxt, digest);
 
   for(i = 0; i < MD5_DIGEST_LEN; i++)
-    msnprintf(&resp_hash_hex[2 * i], 3, "%02x", digest[i]);
+    curl_msnprintf(&resp_hash_hex[2 * i], 3, "%02x", digest[i]);
 
   /* Generate the response */
-  response = aprintf("username=\"%s\",realm=\"%s\",nonce=\"%s\","
-                     "cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\",response=%s,"
-                     "qop=%s",
-                     userp, realm, nonce,
-                     cnonce, nonceCount, spn, resp_hash_hex, qop);
+  response = curl_maprintf("username=\"%s\",realm=\"%s\",nonce=\"%s\","
+                           "cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\","
+                           "response=%s,qop=%s",
+                           userp, realm, nonce,
+                           cnonce, nonceCount, spn, resp_hash_hex, qop);
   free(spn);
   if(!response)
     return CURLE_OUT_OF_MEMORY;
@@ -707,7 +706,8 @@ static CURLcode auth_create_digest_http_message(
   }
 
   if(digest->userhash) {
-    hashthis = aprintf("%s:%s", userp, digest->realm ? digest->realm : "");
+    hashthis = curl_maprintf("%s:%s", userp,
+                             digest->realm ? digest->realm : "");
     if(!hashthis)
       return CURLE_OUT_OF_MEMORY;
 
@@ -729,8 +729,8 @@ static CURLcode auth_create_digest_http_message(
            unq(nonce-value) ":" unq(cnonce-value)
   */
 
-  hashthis = aprintf("%s:%s:%s", userp, digest->realm ? digest->realm : "",
-                     passwdp);
+  hashthis = curl_maprintf("%s:%s:%s", userp,
+                           digest->realm ? digest->realm : "", passwdp);
   if(!hashthis)
     return CURLE_OUT_OF_MEMORY;
 
@@ -742,7 +742,7 @@ static CURLcode auth_create_digest_http_message(
 
   if(digest->algo & SESSION_ALGO) {
     /* nonce and cnonce are OUTSIDE the hash */
-    tmp = aprintf("%s:%s:%s", ha1, digest->nonce, digest->cnonce);
+    tmp = curl_maprintf("%s:%s:%s", ha1, digest->nonce, digest->cnonce);
     if(!tmp)
       return CURLE_OUT_OF_MEMORY;
 
@@ -766,7 +766,7 @@ static CURLcode auth_create_digest_http_message(
     5.1.1 of RFC 2616)
   */
 
-  hashthis = aprintf("%s:%s", request, uripath);
+  hashthis = curl_maprintf("%s:%s", request, uripath);
   if(!hashthis)
     return CURLE_OUT_OF_MEMORY;
 
@@ -782,7 +782,7 @@ static CURLcode auth_create_digest_http_message(
     }
     convert_to_ascii(hashbuf, (unsigned char *)hashed);
 
-    hashthis2 = aprintf("%s:%s", hashthis, hashed);
+    hashthis2 = curl_maprintf("%s:%s", hashthis, hashed);
     free(hashthis);
     hashthis = hashthis2;
   }
@@ -797,11 +797,11 @@ static CURLcode auth_create_digest_http_message(
   convert_to_ascii(hashbuf, ha2);
 
   if(digest->qop) {
-    hashthis = aprintf("%s:%s:%08x:%s:%s:%s", ha1, digest->nonce, digest->nc,
-                       digest->cnonce, digest->qop, ha2);
+    hashthis = curl_maprintf("%s:%s:%08x:%s:%s:%s", ha1, digest->nonce,
+                             digest->nc, digest->cnonce, digest->qop, ha2);
   }
   else {
-    hashthis = aprintf("%s:%s:%s", ha1, digest->nonce, ha2);
+    hashthis = curl_maprintf("%s:%s:%s", ha1, digest->nonce, ha2);
   }
 
   if(!hashthis)
@@ -848,37 +848,37 @@ static CURLcode auth_create_digest_http_message(
   }
 
   if(digest->qop) {
-    response = aprintf("username=\"%s\", "
-                       "realm=\"%s\", "
-                       "nonce=\"%s\", "
-                       "uri=\"%s\", "
-                       "cnonce=\"%s\", "
-                       "nc=%08x, "
-                       "qop=%s, "
-                       "response=\"%s\"",
-                       userp_quoted,
-                       realm_quoted,
-                       nonce_quoted,
-                       uripath,
-                       digest->cnonce,
-                       digest->nc,
-                       digest->qop,
-                       request_digest);
+    response = curl_maprintf("username=\"%s\", "
+                             "realm=\"%s\", "
+                             "nonce=\"%s\", "
+                             "uri=\"%s\", "
+                             "cnonce=\"%s\", "
+                             "nc=%08x, "
+                             "qop=%s, "
+                             "response=\"%s\"",
+                             userp_quoted,
+                             realm_quoted,
+                             nonce_quoted,
+                             uripath,
+                             digest->cnonce,
+                             digest->nc,
+                             digest->qop,
+                             request_digest);
 
     /* Increment nonce-count to use another nc value for the next request */
     digest->nc++;
   }
   else {
-    response = aprintf("username=\"%s\", "
-                       "realm=\"%s\", "
-                       "nonce=\"%s\", "
-                       "uri=\"%s\", "
-                       "response=\"%s\"",
-                       userp_quoted,
-                       realm_quoted,
-                       nonce_quoted,
-                       uripath,
-                       request_digest);
+    response = curl_maprintf("username=\"%s\", "
+                             "realm=\"%s\", "
+                             "nonce=\"%s\", "
+                             "uri=\"%s\", "
+                             "response=\"%s\"",
+                             userp_quoted,
+                             realm_quoted,
+                             nonce_quoted,
+                             uripath,
+                             request_digest);
   }
   free(nonce_quoted);
   free(realm_quoted);
@@ -895,7 +895,7 @@ static CURLcode auth_create_digest_http_message(
       free(response);
       return CURLE_OUT_OF_MEMORY;
     }
-    tmp = aprintf("%s, opaque=\"%s\"", response, opaque_quoted);
+    tmp = curl_maprintf("%s, opaque=\"%s\"", response, opaque_quoted);
     free(response);
     free(opaque_quoted);
     if(!tmp)
@@ -906,7 +906,7 @@ static CURLcode auth_create_digest_http_message(
 
   if(digest->algorithm) {
     /* Append the algorithm */
-    tmp = aprintf("%s, algorithm=%s", response, digest->algorithm);
+    tmp = curl_maprintf("%s, algorithm=%s", response, digest->algorithm);
     free(response);
     if(!tmp)
       return CURLE_OUT_OF_MEMORY;
@@ -916,7 +916,7 @@ static CURLcode auth_create_digest_http_message(
 
   if(digest->userhash) {
     /* Append the userhash */
-    tmp = aprintf("%s, userhash=true", response);
+    tmp = curl_maprintf("%s, userhash=true", response);
     free(response);
     if(!tmp)
       return CURLE_OUT_OF_MEMORY;
index 3684c8f4b24776b75e05537f074f64a7d93f48a8..8fbb62af80d63c4d04e40ecfbb3c1548258a8eba 100644 (file)
@@ -36,8 +36,7 @@
 
 #include <gsasl.h>
 
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "../curl_memory.h"
 #include "../memdebug.h"
 
index fd46619d846b43d05339e1212f7b720a679e8bd4..70144e5514ad0a7961e02efb3597cce01fa02d31 100644 (file)
@@ -36,7 +36,6 @@
 #include "../urldata.h"
 #include "../curl_gssapi.h"
 #include "../sendf.h"
-#include "../curl_printf.h"
 
 /* The last #include files should be: */
 #include "../curl_memory.h"
index 6164cd388be83c40bed3f36bb51cfe53ef6fb9c6..791fc87d1153b61fc658e03b21f076080fd91c00 100644 (file)
@@ -48,7 +48,6 @@
 
 #include "vauth.h"
 #include "../curl_endian.h"
-#include "../curl_printf.h"
 
 /* The last #include files should be: */
 #include "../curl_memory.h"
 static void ntlm_print_flags(FILE *handle, unsigned long flags)
 {
   if(flags & NTLMFLAG_NEGOTIATE_UNICODE)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_UNICODE ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_UNICODE ");
   if(flags & NTLMFLAG_NEGOTIATE_OEM)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_OEM ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_OEM ");
   if(flags & NTLMFLAG_REQUEST_TARGET)
-    fprintf(handle, "NTLMFLAG_REQUEST_TARGET ");
+    curl_mfprintf(handle, "NTLMFLAG_REQUEST_TARGET ");
   if(flags & (1 << 3))
-    fprintf(handle, "NTLMFLAG_UNKNOWN_3 ");
+    curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_3 ");
   if(flags & NTLMFLAG_NEGOTIATE_SIGN)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_SIGN ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_SIGN ");
   if(flags & NTLMFLAG_NEGOTIATE_SEAL)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_SEAL ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_SEAL ");
   if(flags & NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE ");
   if(flags & NTLMFLAG_NEGOTIATE_LM_KEY)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_LM_KEY ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_LM_KEY ");
   if(flags & NTLMFLAG_NEGOTIATE_NTLM_KEY)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_NTLM_KEY ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_NTLM_KEY ");
   if(flags & (1 << 10))
-    fprintf(handle, "NTLMFLAG_UNKNOWN_10 ");
+    curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_10 ");
   if(flags & NTLMFLAG_NEGOTIATE_ANONYMOUS)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_ANONYMOUS ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_ANONYMOUS ");
   if(flags & NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED ");
   if(flags & NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED ");
   if(flags & NTLMFLAG_NEGOTIATE_LOCAL_CALL)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_LOCAL_CALL ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_LOCAL_CALL ");
   if(flags & NTLMFLAG_NEGOTIATE_ALWAYS_SIGN)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_ALWAYS_SIGN ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_ALWAYS_SIGN ");
   if(flags & NTLMFLAG_TARGET_TYPE_DOMAIN)
-    fprintf(handle, "NTLMFLAG_TARGET_TYPE_DOMAIN ");
+    curl_mfprintf(handle, "NTLMFLAG_TARGET_TYPE_DOMAIN ");
   if(flags & NTLMFLAG_TARGET_TYPE_SERVER)
-    fprintf(handle, "NTLMFLAG_TARGET_TYPE_SERVER ");
+    curl_mfprintf(handle, "NTLMFLAG_TARGET_TYPE_SERVER ");
   if(flags & NTLMFLAG_TARGET_TYPE_SHARE)
-    fprintf(handle, "NTLMFLAG_TARGET_TYPE_SHARE ");
+    curl_mfprintf(handle, "NTLMFLAG_TARGET_TYPE_SHARE ");
   if(flags & NTLMFLAG_NEGOTIATE_NTLM2_KEY)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_NTLM2_KEY ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_NTLM2_KEY ");
   if(flags & NTLMFLAG_REQUEST_INIT_RESPONSE)
-    fprintf(handle, "NTLMFLAG_REQUEST_INIT_RESPONSE ");
+    curl_mfprintf(handle, "NTLMFLAG_REQUEST_INIT_RESPONSE ");
   if(flags & NTLMFLAG_REQUEST_ACCEPT_RESPONSE)
-    fprintf(handle, "NTLMFLAG_REQUEST_ACCEPT_RESPONSE ");
+    curl_mfprintf(handle, "NTLMFLAG_REQUEST_ACCEPT_RESPONSE ");
   if(flags & NTLMFLAG_REQUEST_NONNT_SESSION_KEY)
-    fprintf(handle, "NTLMFLAG_REQUEST_NONNT_SESSION_KEY ");
+    curl_mfprintf(handle, "NTLMFLAG_REQUEST_NONNT_SESSION_KEY ");
   if(flags & NTLMFLAG_NEGOTIATE_TARGET_INFO)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_TARGET_INFO ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_TARGET_INFO ");
   if(flags & (1 << 24))
-    fprintf(handle, "NTLMFLAG_UNKNOWN_24 ");
+    curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_24 ");
   if(flags & (1 << 25))
-    fprintf(handle, "NTLMFLAG_UNKNOWN_25 ");
+    curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_25 ");
   if(flags & (1 << 26))
-    fprintf(handle, "NTLMFLAG_UNKNOWN_26 ");
+    curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_26 ");
   if(flags & (1 << 27))
-    fprintf(handle, "NTLMFLAG_UNKNOWN_27 ");
+    curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_27 ");
   if(flags & (1 << 28))
-    fprintf(handle, "NTLMFLAG_UNKNOWN_28 ");
+    curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_28 ");
   if(flags & NTLMFLAG_NEGOTIATE_128)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_128 ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_128 ");
   if(flags & NTLMFLAG_NEGOTIATE_KEY_EXCHANGE)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_KEY_EXCHANGE ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_KEY_EXCHANGE ");
   if(flags & NTLMFLAG_NEGOTIATE_56)
-    fprintf(handle, "NTLMFLAG_NEGOTIATE_56 ");
+    curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_56 ");
 }
 
 static void ntlm_print_hex(FILE *handle, const char *buf, size_t len)
@@ -237,9 +236,9 @@ static void ntlm_print_hex(FILE *handle, const char *buf, size_t len)
 
   (void)handle;
 
-  fprintf(stderr, "0x");
+  curl_mfprintf(stderr, "0x");
   while(len-- > 0)
-    fprintf(stderr, "%02.2x", (unsigned int)*p++);
+    curl_mfprintf(stderr, "%02.2x", (unsigned int)*p++);
 }
 #else
 # define DEBUG_OUT(x) Curl_nop_stmt
@@ -394,12 +393,12 @@ CURLcode Curl_auth_decode_ntlm_type2_message(struct Curl_easy *data,
   }
 
   DEBUG_OUT({
-    fprintf(stderr, "**** TYPE2 header flags=0x%08.8lx ", ntlm->flags);
+    curl_mfprintf(stderr, "**** TYPE2 header flags=0x%08.8lx ", ntlm->flags);
     ntlm_print_flags(stderr, ntlm->flags);
-    fprintf(stderr, "\n                  nonce=");
+    curl_mfprintf(stderr, "\n                  nonce=");
     ntlm_print_hex(stderr, (char *)ntlm->nonce, 8);
-    fprintf(stderr, "\n****\n");
-    fprintf(stderr, "**** Header %s\n ", header);
+    curl_mfprintf(stderr, "\n****\n");
+    curl_mfprintf(stderr, "**** Header %s\n ", header);
   });
 
   return result;
@@ -475,37 +474,37 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
   /* Clean up any former leftovers and initialise to defaults */
   Curl_auth_cleanup_ntlm(ntlm);
 
-  ntlmbuf = aprintf(NTLMSSP_SIGNATURE "%c"
-                    "\x01%c%c%c" /* 32-bit type = 1 */
-                    "%c%c%c%c"   /* 32-bit NTLM flag field */
-                    "%c%c"       /* domain length */
-                    "%c%c"       /* domain allocated space */
-                    "%c%c"       /* domain name offset */
-                    "%c%c"       /* 2 zeroes */
-                    "%c%c"       /* host length */
-                    "%c%c"       /* host allocated space */
-                    "%c%c"       /* hostname offset */
-                    "%c%c"       /* 2 zeroes */
-                    "%s"         /* hostname */
-                    "%s",        /* domain string */
-                    0,           /* trailing zero */
-                    0, 0, 0,     /* part of type-1 long */
-
-                    LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM |
-                                NTLMFLAG_REQUEST_TARGET |
-                                NTLMFLAG_NEGOTIATE_NTLM_KEY |
-                                NTLMFLAG_NEGOTIATE_NTLM2_KEY |
-                                NTLMFLAG_NEGOTIATE_ALWAYS_SIGN),
-                    SHORTPAIR(domlen),
-                    SHORTPAIR(domlen),
-                    SHORTPAIR(domoff),
-                    0, 0,
-                    SHORTPAIR(hostlen),
-                    SHORTPAIR(hostlen),
-                    SHORTPAIR(hostoff),
-                    0, 0,
-                    host,  /* this is empty */
-                    domain /* this is empty */);
+  ntlmbuf = curl_maprintf(NTLMSSP_SIGNATURE "%c"
+                          "\x01%c%c%c" /* 32-bit type = 1 */
+                          "%c%c%c%c"   /* 32-bit NTLM flag field */
+                          "%c%c"       /* domain length */
+                          "%c%c"       /* domain allocated space */
+                          "%c%c"       /* domain name offset */
+                          "%c%c"       /* 2 zeroes */
+                          "%c%c"       /* host length */
+                          "%c%c"       /* host allocated space */
+                          "%c%c"       /* hostname offset */
+                          "%c%c"       /* 2 zeroes */
+                          "%s"         /* hostname */
+                          "%s",        /* domain string */
+                          0,           /* trailing zero */
+                          0, 0, 0,     /* part of type-1 long */
+
+                          LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM |
+                                      NTLMFLAG_REQUEST_TARGET |
+                                      NTLMFLAG_NEGOTIATE_NTLM_KEY |
+                                      NTLMFLAG_NEGOTIATE_NTLM2_KEY |
+                                      NTLMFLAG_NEGOTIATE_ALWAYS_SIGN),
+                          SHORTPAIR(domlen),
+                          SHORTPAIR(domlen),
+                          SHORTPAIR(domoff),
+                          0, 0,
+                          SHORTPAIR(hostlen),
+                          SHORTPAIR(hostlen),
+                          SHORTPAIR(hostoff),
+                          0, 0,
+                          host,  /* this is empty */
+                          domain /* this is empty */);
 
   if(!ntlmbuf)
     return CURLE_OUT_OF_MEMORY;
@@ -514,25 +513,25 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
   size = 32 + hostlen + domlen;
 
   DEBUG_OUT({
-    fprintf(stderr, "* TYPE1 header flags=0x%02.2x%02.2x%02.2x%02.2x "
-            "0x%08.8x ",
-            LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM |
-                        NTLMFLAG_REQUEST_TARGET |
-                        NTLMFLAG_NEGOTIATE_NTLM_KEY |
-                        NTLMFLAG_NEGOTIATE_NTLM2_KEY |
-                        NTLMFLAG_NEGOTIATE_ALWAYS_SIGN),
-            NTLMFLAG_NEGOTIATE_OEM |
-            NTLMFLAG_REQUEST_TARGET |
-            NTLMFLAG_NEGOTIATE_NTLM_KEY |
-            NTLMFLAG_NEGOTIATE_NTLM2_KEY |
-            NTLMFLAG_NEGOTIATE_ALWAYS_SIGN);
+    curl_mfprintf(stderr, "* TYPE1 header flags=0x%02.2x%02.2x%02.2x%02.2x "
+                  "0x%08.8x ",
+                  LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM |
+                              NTLMFLAG_REQUEST_TARGET |
+                              NTLMFLAG_NEGOTIATE_NTLM_KEY |
+                              NTLMFLAG_NEGOTIATE_NTLM2_KEY |
+                              NTLMFLAG_NEGOTIATE_ALWAYS_SIGN),
+                  NTLMFLAG_NEGOTIATE_OEM |
+                  NTLMFLAG_REQUEST_TARGET |
+                  NTLMFLAG_NEGOTIATE_NTLM_KEY |
+                  NTLMFLAG_NEGOTIATE_NTLM2_KEY |
+                  NTLMFLAG_NEGOTIATE_ALWAYS_SIGN);
     ntlm_print_flags(stderr,
                      NTLMFLAG_NEGOTIATE_OEM |
                      NTLMFLAG_REQUEST_TARGET |
                      NTLMFLAG_NEGOTIATE_NTLM_KEY |
                      NTLMFLAG_NEGOTIATE_NTLM2_KEY |
                      NTLMFLAG_NEGOTIATE_ALWAYS_SIGN);
-    fprintf(stderr, "\n****\n");
+    curl_mfprintf(stderr, "\n****\n");
   });
 
   Curl_bufref_set(out, ntlmbuf, size, curl_free);
@@ -693,82 +692,84 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
   hostoff = useroff + userlen;
 
   /* Create the big type-3 message binary blob */
-  size = msnprintf((char *)ntlmbuf, NTLM_BUFSIZE,
-                   NTLMSSP_SIGNATURE "%c"
-                   "\x03%c%c%c"  /* 32-bit type = 3 */
-
-                   "%c%c"  /* LanManager length */
-                   "%c%c"  /* LanManager allocated space */
-                   "%c%c"  /* LanManager offset */
-                   "%c%c"  /* 2 zeroes */
-
-                   "%c%c"  /* NT-response length */
-                   "%c%c"  /* NT-response allocated space */
-                   "%c%c"  /* NT-response offset */
-                   "%c%c"  /* 2 zeroes */
-
-                   "%c%c"  /* domain length */
-                   "%c%c"  /* domain allocated space */
-                   "%c%c"  /* domain name offset */
-                   "%c%c"  /* 2 zeroes */
-
-                   "%c%c"  /* user length */
-                   "%c%c"  /* user allocated space */
-                   "%c%c"  /* user offset */
-                   "%c%c"  /* 2 zeroes */
-
-                   "%c%c"  /* host length */
-                   "%c%c"  /* host allocated space */
-                   "%c%c"  /* host offset */
-                   "%c%c"  /* 2 zeroes */
-
-                   "%c%c"  /* session key length (unknown purpose) */
-                   "%c%c"  /* session key allocated space (unknown purpose) */
-                   "%c%c"  /* session key offset (unknown purpose) */
-                   "%c%c"  /* 2 zeroes */
-
-                   "%c%c%c%c",  /* flags */
-
-                   /* domain string */
-                   /* user string */
-                   /* host string */
-                   /* LanManager response */
-                   /* NT response */
-
-                   0,                /* null-termination */
-                   0, 0, 0,          /* type-3 long, the 24 upper bits */
-
-                   SHORTPAIR(0x18),  /* LanManager response length, twice */
-                   SHORTPAIR(0x18),
-                   SHORTPAIR(lmrespoff),
-                   0x0, 0x0,
-
-                   SHORTPAIR(ntresplen),  /* NT-response length, twice */
-                   SHORTPAIR(ntresplen),
-                   SHORTPAIR(ntrespoff),
-                   0x0, 0x0,
-
-                   SHORTPAIR(domlen),
-                   SHORTPAIR(domlen),
-                   SHORTPAIR(domoff),
-                   0x0, 0x0,
-
-                   SHORTPAIR(userlen),
-                   SHORTPAIR(userlen),
-                   SHORTPAIR(useroff),
-                   0x0, 0x0,
-
-                   SHORTPAIR(hostlen),
-                   SHORTPAIR(hostlen),
-                   SHORTPAIR(hostoff),
-                   0x0, 0x0,
-
-                   0x0, 0x0,
-                   0x0, 0x0,
-                   0x0, 0x0,
-                   0x0, 0x0,
-
-                   LONGQUARTET(ntlm->flags));
+  size = curl_msnprintf((char *)ntlmbuf, NTLM_BUFSIZE,
+                         NTLMSSP_SIGNATURE "%c"
+                         "\x03%c%c%c"  /* 32-bit type = 3 */
+
+                         "%c%c"  /* LanManager length */
+                         "%c%c"  /* LanManager allocated space */
+                         "%c%c"  /* LanManager offset */
+                         "%c%c"  /* 2 zeroes */
+
+                         "%c%c"  /* NT-response length */
+                         "%c%c"  /* NT-response allocated space */
+                         "%c%c"  /* NT-response offset */
+                         "%c%c"  /* 2 zeroes */
+
+                         "%c%c"  /* domain length */
+                         "%c%c"  /* domain allocated space */
+                         "%c%c"  /* domain name offset */
+                         "%c%c"  /* 2 zeroes */
+
+                         "%c%c"  /* user length */
+                         "%c%c"  /* user allocated space */
+                         "%c%c"  /* user offset */
+                         "%c%c"  /* 2 zeroes */
+
+                         "%c%c"  /* host length */
+                         "%c%c"  /* host allocated space */
+                         "%c%c"  /* host offset */
+                         "%c%c"  /* 2 zeroes */
+
+                         "%c%c"  /* session key length (unknown purpose) */
+                         "%c%c"  /* session key allocated space
+                                    (unknown purpose) */
+                         "%c%c"  /* session key offset (unknown purpose) */
+                         "%c%c"  /* 2 zeroes */
+
+                         "%c%c%c%c",  /* flags */
+
+                         /* domain string */
+                         /* user string */
+                         /* host string */
+                         /* LanManager response */
+                         /* NT response */
+
+                         0,                /* null-termination */
+                         0, 0, 0,          /* type-3 long, the 24 upper bits */
+
+                         SHORTPAIR(0x18),  /* LanManager response length,
+                                              twice */
+                         SHORTPAIR(0x18),
+                         SHORTPAIR(lmrespoff),
+                         0x0, 0x0,
+
+                         SHORTPAIR(ntresplen),  /* NT-response length, twice */
+                         SHORTPAIR(ntresplen),
+                         SHORTPAIR(ntrespoff),
+                         0x0, 0x0,
+
+                         SHORTPAIR(domlen),
+                         SHORTPAIR(domlen),
+                         SHORTPAIR(domoff),
+                         0x0, 0x0,
+
+                         SHORTPAIR(userlen),
+                         SHORTPAIR(userlen),
+                         SHORTPAIR(useroff),
+                         0x0, 0x0,
+
+                         SHORTPAIR(hostlen),
+                         SHORTPAIR(hostlen),
+                         SHORTPAIR(hostoff),
+                         0x0, 0x0,
+
+                         0x0, 0x0,
+                         0x0, 0x0,
+                         0x0, 0x0,
+                         0x0, 0x0,
+
+                         LONGQUARTET(ntlm->flags));
 
   DEBUGASSERT(size == 64);
   DEBUGASSERT(size == (size_t)lmrespoff);
@@ -780,7 +781,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
   }
 
   DEBUG_OUT({
-    fprintf(stderr, "**** TYPE3 header lmresp=");
+    curl_mfprintf(stderr, "**** TYPE3 header lmresp=");
     ntlm_print_hex(stderr, (char *)&ntlmbuf[lmrespoff], 0x18);
   });
 
@@ -794,17 +795,17 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
   size += ntresplen;
 
   DEBUG_OUT({
-    fprintf(stderr, "\n   ntresp=");
+    curl_mfprintf(stderr, "\n   ntresp=");
     ntlm_print_hex(stderr, (char *)&ntlmbuf[ntrespoff], ntresplen);
   });
 
   free(ntlmv2resp);/* Free the dynamic buffer allocated for NTLMv2 */
 
   DEBUG_OUT({
-    fprintf(stderr, "\n   flags=0x%02.2x%02.2x%02.2x%02.2x 0x%08.8x ",
-            LONGQUARTET(ntlm->flags), ntlm->flags);
+    curl_mfprintf(stderr, "\n   flags=0x%02.2x%02.2x%02.2x%02.2x 0x%08.8x ",
+                  LONGQUARTET(ntlm->flags), ntlm->flags);
     ntlm_print_flags(stderr, ntlm->flags);
-    fprintf(stderr, "\n****\n");
+    curl_mfprintf(stderr, "\n****\n");
   });
 
   /* Make sure that the domain, user and host strings fit in the
index a84dc60dafd11e5188d85ed25ac10c32edb73620..cf7addf53597f3a2aa02672eda0f6e87c1e85929 100644 (file)
@@ -35,7 +35,6 @@
 
 #include "vauth.h"
 #include "../curlx/warnless.h"
-#include "../curl_printf.h"
 
 /* The last #include files should be: */
 #include "../curl_memory.h"
@@ -67,11 +66,11 @@ CURLcode Curl_auth_create_oauth_bearer_message(const char *user,
 
   /* Generate the message */
   if(port == 0 || port == 80)
-    oauth = aprintf("n,a=%s,\1host=%s\1auth=Bearer %s\1\1", user, host,
-                    bearer);
+    oauth = curl_maprintf("n,a=%s,\1host=%s\1auth=Bearer %s\1\1", user, host,
+                          bearer);
   else
-    oauth = aprintf("n,a=%s,\1host=%s\1port=%ld\1auth=Bearer %s\1\1", user,
-                    host, port, bearer);
+    oauth = curl_maprintf("n,a=%s,\1host=%s\1port=%ld\1auth=Bearer %s\1\1",
+                          user, host, port, bearer);
   if(!oauth)
     return CURLE_OUT_OF_MEMORY;
 
@@ -98,7 +97,7 @@ CURLcode Curl_auth_create_xoauth_bearer_message(const char *user,
                                                 struct bufref *out)
 {
   /* Generate the message */
-  char *xoauth = aprintf("user=%s\1auth=Bearer %s\1\1", user, bearer);
+  char *xoauth = curl_maprintf("user=%s\1auth=Bearer %s\1\1", user, bearer);
   if(!xoauth)
     return CURLE_OUT_OF_MEMORY;
 
index c6cf4285725a6005a0dfc9f26c452267b476cc11..6ee687dcab229303302e9016b61b1ec99ff78bf0 100644 (file)
@@ -30,7 +30,6 @@
 #include "../strdup.h"
 #include "../urldata.h"
 #include "../curlx/multibyte.h"
-#include "../curl_printf.h"
 #include "../url.h"
 
 /* The last #include files should be: */
@@ -62,11 +61,11 @@ char *Curl_auth_build_spn(const char *service, const char *host,
 
   /* Generate our SPN */
   if(host && realm)
-    spn = aprintf("%s/%s@%s", service, host, realm);
+    spn = curl_maprintf("%s/%s@%s", service, host, realm);
   else if(host)
-    spn = aprintf("%s/%s", service, host);
+    spn = curl_maprintf("%s/%s", service, host);
   else if(realm)
-    spn = aprintf("%s@%s", service, realm);
+    spn = curl_maprintf("%s@%s", service, realm);
 
   /* Return our newly allocated SPN */
   return spn;
@@ -89,7 +88,7 @@ TCHAR *Curl_auth_build_spn(const char *service, const char *host,
      formulate the SPN instead. */
 
   /* Generate our UTF8 based SPN */
-  utf8_spn = aprintf("%s/%s", service, host);
+  utf8_spn = curl_maprintf("%s/%s", service, host);
   if(!utf8_spn)
     return NULL;
 
index 8158f26e735b8b99dd998e38a8702e51cc0843a9..3798fed6e1d97c260be94358a8ba6f755534db0f 100644 (file)
@@ -34,7 +34,6 @@
 #include "http2.h"
 #include "vssh/ssh.h"
 #include "vquic/vquic.h"
-#include "curl_printf.h"
 #include "easy_lock.h"
 
 #ifdef USE_ARES
@@ -89,7 +88,7 @@ static void brotli_version(char *buf, size_t bufsz)
   unsigned int major = brotli_version >> 24;
   unsigned int minor = (brotli_version & 0x00FFFFFF) >> 12;
   unsigned int patch = brotli_version & 0x00000FFF;
-  (void)msnprintf(buf, bufsz, "brotli/%u.%u.%u", major, minor, patch);
+  (void)curl_msnprintf(buf, bufsz, "brotli/%u.%u.%u", major, minor, patch);
 }
 #endif
 
@@ -100,7 +99,7 @@ static void zstd_version(char *buf, size_t bufsz)
   unsigned int major = version / (100 * 100);
   unsigned int minor = (version - (major * 100 * 100)) / 100;
   unsigned int patch = version - (major * 100 * 100) - (minor * 100);
-  (void)msnprintf(buf, bufsz, "zstd/%u.%u.%u", major, minor, patch);
+  (void)curl_msnprintf(buf, bufsz, "zstd/%u.%u.%u", major, minor, patch);
 }
 #endif
 
@@ -116,13 +115,13 @@ static void oldap_version(char *buf, size_t bufsz)
     unsigned int minor =
       (((unsigned int)api.ldapai_vendor_version - major * 10000)
        - patch) / 100;
-    msnprintf(buf, bufsz, "%s/%u.%u.%u",
-              api.ldapai_vendor_name, major, minor, patch);
+    curl_msnprintf(buf, bufsz, "%s/%u.%u.%u",
+                   api.ldapai_vendor_name, major, minor, patch);
     ldap_memfree(api.ldapai_vendor_name);
     ber_memvfree((void **)api.ldapai_extensions);
   }
   else
-    msnprintf(buf, bufsz, "OpenLDAP");
+    curl_msnprintf(buf, bufsz, "OpenLDAP");
 }
 #endif
 
@@ -132,10 +131,10 @@ static void psl_version(char *buf, size_t bufsz)
 #if defined(PSL_VERSION_MAJOR) && (PSL_VERSION_MAJOR > 0 ||     \
                                    PSL_VERSION_MINOR >= 11)
   int num = psl_check_version_number(0);
-  msnprintf(buf, bufsz, "libpsl/%d.%d.%d",
-            num >> 16, (num >> 8) & 0xff, num & 0xff);
+  curl_msnprintf(buf, bufsz, "libpsl/%d.%d.%d",
+                 num >> 16, (num >> 8) & 0xff, num & 0xff);
 #else
-  msnprintf(buf, bufsz, "libpsl/%s", psl_get_version());
+  curl_msnprintf(buf, bufsz, "libpsl/%s", psl_get_version());
 #endif
 }
 #endif
@@ -148,11 +147,11 @@ static void psl_version(char *buf, size_t bufsz)
 static void idn_version(char *buf, size_t bufsz)
 {
 #ifdef USE_LIBIDN2
-  msnprintf(buf, bufsz, "libidn2/%s", idn2_check_version(NULL));
+  curl_msnprintf(buf, bufsz, "libidn2/%s", idn2_check_version(NULL));
 #elif defined(USE_WIN32_IDN)
-  msnprintf(buf, bufsz, "WinIDN");
+  curl_msnprintf(buf, bufsz, "WinIDN");
 #elif defined(USE_APPLE_IDN)
-  msnprintf(buf, bufsz, "AppleIDN");
+  curl_msnprintf(buf, bufsz, "AppleIDN");
 #endif
 }
 #endif
@@ -219,7 +218,7 @@ char *curl_version(void)
   /* Override version string when environment variable CURL_VERSION is set */
   const char *debugversion = getenv("CURL_VERSION");
   if(debugversion) {
-    msnprintf(out, sizeof(out), "%s", debugversion);
+    curl_msnprintf(out, sizeof(out), "%s", debugversion);
     return out;
   }
 #endif
@@ -230,7 +229,7 @@ char *curl_version(void)
   src[i++] = ssl_version;
 #endif
 #ifdef HAVE_LIBZ
-  msnprintf(z_version, sizeof(z_version), "zlib/%s", zlibVersion());
+  curl_msnprintf(z_version, sizeof(z_version), "zlib/%s", zlibVersion());
   src[i++] = z_version;
 #endif
 #ifdef HAVE_BROTLI
@@ -242,8 +241,8 @@ char *curl_version(void)
   src[i++] = zstd_ver;
 #endif
 #ifdef USE_ARES
-  msnprintf(cares_version, sizeof(cares_version),
-            "c-ares/%s", ares_version(NULL));
+  curl_msnprintf(cares_version, sizeof(cares_version),
+                 "c-ares/%s", ares_version(NULL));
   src[i++] = cares_version;
 #endif
 #ifdef USE_IDN
@@ -271,8 +270,8 @@ char *curl_version(void)
   src[i++] = rtmp_version;
 #endif
 #ifdef USE_GSASL
-  msnprintf(gsasl_buf, sizeof(gsasl_buf), "libgsasl/%s",
-            gsasl_check_version(NULL));
+  curl_msnprintf(gsasl_buf, sizeof(gsasl_buf), "libgsasl/%s",
+                 gsasl_check_version(NULL));
   src[i++] = gsasl_buf;
 #endif
 #ifdef USE_OPENLDAP
diff --git a/lib/vquic/.checksrc b/lib/vquic/.checksrc
deleted file mode 100644 (file)
index e69de29..0000000
index 4c7a7857b529c848b5493024b9b4d44b3b6d016a..3a301f1b71fb85dd1f792d096c8c30b368ae5092 100644 (file)
@@ -72,8 +72,7 @@
 
 #include "../curlx/warnless.h"
 
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "../curl_memory.h"
 #include "../memdebug.h"
 
@@ -111,8 +110,8 @@ void Curl_ngtcp2_ver(char *p, size_t len)
 {
   const ngtcp2_info *ng2 = ngtcp2_version(0);
   const nghttp3_info *ht3 = nghttp3_version(0);
-  (void)msnprintf(p, len, "ngtcp2/%s nghttp3/%s",
-                  ng2->version_str, ht3->version_str);
+  (void)curl_msnprintf(p, len, "ngtcp2/%s nghttp3/%s",
+                       ng2->version_str, ht3->version_str);
 }
 
 struct cf_ngtcp2_ctx {
@@ -389,9 +388,9 @@ static void quic_printf(void *user_data, const char *fmt, ...)
   (void)ctx;  /* need an easy handle to infof() message */
   va_list ap;
   va_start(ap, fmt);
-  vfprintf(stderr, fmt, ap);
+  curl_mvfprintf(stderr, fmt, ap);
   va_end(ap);
-  fprintf(stderr, "\n");
+  curl_mfprintf(stderr, "\n");
 }
 #endif
 
index 351519d65aa76888fb613c9c4174c5e188af9391..0862d688444f78aa73dc6b23e3b4f58f5a65adf7 100644 (file)
@@ -58,8 +58,7 @@
 #include "../curlx/warnless.h"
 #include "../curlx/strerr.h"
 
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "../curl_memory.h"
 #include "../memdebug.h"
 
@@ -511,9 +510,9 @@ static CURLcode cf_osslq_ssl_err(struct Curl_cfilter *cf,
     lerr = SSL_get_verify_result(ctx->tls.ossl.ssl);
     if(lerr != X509_V_OK) {
       ssl_config->certverifyresult = lerr;
-      msnprintf(ebuf, sizeof(ebuf),
-                "SSL certificate problem: %s",
-                X509_verify_cert_error_string(lerr));
+      curl_msnprintf(ebuf, sizeof(ebuf),
+                     "SSL certificate problem: %s",
+                     X509_verify_cert_error_string(lerr));
     }
     else
       err_descr = "SSL certificate verification failed";
@@ -867,8 +866,8 @@ static int cb_h3_recv_header(nghttp3_conn *conn, int64_t sid,
                                      (const char *)h3val.base, h3val.len);
     if(result)
       return -1;
-    ncopy = msnprintf(line, sizeof(line), "HTTP/3 %03d \r\n",
-                      stream->status_code);
+    ncopy = curl_msnprintf(line, sizeof(line), "HTTP/3 %03d \r\n",
+                           stream->status_code);
     CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] status: %s", stream_id, line);
     result = write_resp_raw(cf, data, line, ncopy, FALSE);
     if(result) {
@@ -2465,7 +2464,7 @@ bool Curl_conn_is_osslq(const struct Curl_easy *data,
 void Curl_osslq_ver(char *p, size_t len)
 {
   const nghttp3_info *ht3 = nghttp3_version(0);
-  (void)msnprintf(p, len, "nghttp3/%s", ht3->version_str);
+  (void)curl_msnprintf(p, len, "nghttp3/%s", ht3->version_str);
 }
 
 #endif /* !CURL_DISABLE_HTTP && USE_OPENSSL_QUIC && USE_NGHTTP3 */
index da67819abb2bfe3977c335ea0b2db82bb86fa340..f5fd20fccbf1a350a1c93fe3394f1a8173c06269 100644 (file)
@@ -52,8 +52,7 @@
 #include "../vtls/keylog.h"
 #include "../vtls/vtls.h"
 
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "../curl_memory.h"
 #include "../memdebug.h"
 
@@ -80,7 +79,7 @@
  */
 void Curl_quiche_ver(char *p, size_t len)
 {
-  (void)msnprintf(p, len, "quiche/%s", quiche_version());
+  (void)curl_msnprintf(p, len, "quiche/%s", quiche_version());
 }
 
 struct cf_quiche_ctx {
@@ -109,7 +108,7 @@ static int debug_log_init = 0;
 static void quiche_debug_log(const char *line, void *argp)
 {
   (void)argp;
-  fprintf(stderr, "%s\n", line);
+  curl_mfprintf(stderr, "%s\n", line);
 }
 #endif
 
index 6576c5cd454aa41cf53e3f17acd9b24ed310be68..fa89c0b80967eea1d5618b3e3d32933d8cd493e9 100644 (file)
@@ -53,8 +53,7 @@
 #include "../vtls/vtls_scache.h"
 #include "vquic-tls.h"
 
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "../curl_memory.h"
 #include "../memdebug.h"
 
index d7ed7927be390f2dd9da7a50f15a6c40ef0573a6..f722c7e127a2aad7b3f4949ea931df77ee39baee 100644 (file)
@@ -46,8 +46,7 @@
 #include "../curlx/strerr.h"
 #include "../curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "../curl_memory.h"
 #include "../memdebug.h"
 
@@ -675,7 +674,7 @@ CURLcode Curl_qlogdir(struct Curl_easy *data,
       result = curlx_dyn_add(&fname, "/");
     for(i = 0; (i < scidlen) && !result; i++) {
       char hex[3];
-      msnprintf(hex, 3, "%02x", scid[i]);
+      curl_msnprintf(hex, 3, "%02x", scid[i]);
       result = curlx_dyn_add(&fname, hex);
     }
     if(!result)
diff --git a/lib/vssh/.checksrc b/lib/vssh/.checksrc
deleted file mode 100644 (file)
index e69de29..0000000
index 0f51137e8c72c21544a823385b964636675d769b..78d7986a9ecdfb46b3dbd46f90c511f2caa6d039 100644 (file)
@@ -76,8 +76,7 @@
 #include <fcntl.h>
 #endif
 
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "../curl_memory.h"
 #include "../memdebug.h"
 
@@ -358,7 +357,7 @@ static int myssh_is_known(struct Curl_easy *data, struct ssh_conn *sshc)
     }
 
     for(i = 0; i < 16; i++)
-      msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char)hash[i]);
+      curl_msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char)hash[i]);
 
     infof(data, "SSH MD5 fingerprint: %s", md5buffer);
 
@@ -602,7 +601,7 @@ static int myssh_in_SFTP_READDIR(struct Curl_easy *data,
     if(data->set.list_only) {
       char *tmpLine;
 
-      tmpLine = aprintf("%s\n", sshc->readdir_filename);
+      tmpLine = curl_maprintf("%s\n", sshc->readdir_filename);
       if(!tmpLine) {
         myssh_to(data, sshc, SSH_SFTP_CLOSE);
         sshc->actualcode = CURLE_OUT_OF_MEMORY;
@@ -628,8 +627,8 @@ static int myssh_in_SFTP_READDIR(struct Curl_easy *data,
       if((sshc->readdir_attrs->flags & SSH_FILEXFER_ATTR_PERMISSIONS) &&
          ((sshc->readdir_attrs->permissions & SSH_S_IFMT) ==
           SSH_S_IFLNK)) {
-        sshc->readdir_linkPath = aprintf("%s%s", sshp->path,
-                                         sshc->readdir_filename);
+        sshc->readdir_linkPath = curl_maprintf("%s%s", sshp->path,
+                                               sshc->readdir_filename);
 
         if(!sshc->readdir_linkPath) {
           myssh_to(data, sshc, SSH_SFTP_CLOSE);
@@ -766,24 +765,24 @@ static int myssh_in_SFTP_QUOTE_STATVFS(struct Curl_easy *data,
     #define CURL_LIBSSH_VFS_SIZE_MASK PRIu64
     #endif
     CURLcode result = CURLE_OK;
-    char *tmp = aprintf("statvfs:\n"
-                        "f_bsize: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
-                        "f_frsize: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
-                        "f_blocks: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
-                        "f_bfree: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
-                        "f_bavail: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
-                        "f_files: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
-                        "f_ffree: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
-                        "f_favail: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
-                        "f_fsid: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
-                        "f_flag: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
-                        "f_namemax: %" CURL_LIBSSH_VFS_SIZE_MASK "\n",
-                        statvfs->f_bsize, statvfs->f_frsize,
-                        statvfs->f_blocks, statvfs->f_bfree,
-                        statvfs->f_bavail, statvfs->f_files,
-                        statvfs->f_ffree, statvfs->f_favail,
-                        statvfs->f_fsid, statvfs->f_flag,
-                        statvfs->f_namemax);
+    char *tmp = curl_maprintf("statvfs:\n"
+                              "f_bsize: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+                              "f_frsize: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+                              "f_blocks: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+                              "f_bfree: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+                              "f_bavail: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+                              "f_files: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+                              "f_ffree: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+                              "f_favail: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+                              "f_fsid: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+                              "f_flag: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+                              "f_namemax: %" CURL_LIBSSH_VFS_SIZE_MASK "\n",
+                              statvfs->f_bsize, statvfs->f_frsize,
+                              statvfs->f_blocks, statvfs->f_bfree,
+                              statvfs->f_bavail, statvfs->f_files,
+                              statvfs->f_ffree, statvfs->f_favail,
+                              statvfs->f_fsid, statvfs->f_flag,
+                              statvfs->f_namemax);
     sftp_statvfs_free(statvfs);
 
     if(!tmp)
@@ -1577,7 +1576,8 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data,
 
   if(curl_strequal("pwd", cmd)) {
     /* output debug output if that is requested */
-    char *tmp = aprintf("257 \"%s\" is current directory.\n", sshp->path);
+    char *tmp = curl_maprintf("257 \"%s\" is current directory.\n",
+                              sshp->path);
     if(!tmp) {
       sshc->actualcode = CURLE_OUT_OF_MEMORY;
       myssh_to(data, sshc, SSH_SFTP_CLOSE);
@@ -2564,7 +2564,7 @@ static CURLcode myssh_connect(struct Curl_easy *data, bool *done)
 
   if(conn->bits.ipv6_ip) {
     char ipv6[MAX_IPADR_LEN];
-    msnprintf(ipv6, sizeof(ipv6), "[%s]", conn->host.name);
+    curl_msnprintf(ipv6, sizeof(ipv6), "[%s]", conn->host.name);
     rc = ssh_options_set(sshc->ssh_session, SSH_OPTIONS_HOST, ipv6);
   }
   else
@@ -3150,7 +3150,7 @@ static CURLcode sftp_recv(struct Curl_easy *data, int sockindex,
 CURLcode Curl_ssh_init(void)
 {
   if(ssh_init()) {
-    DEBUGF(fprintf(stderr, "Error: libssh_init failed\n"));
+    DEBUGF(curl_mfprintf(stderr, "Error: libssh_init failed\n"));
     return CURLE_FAILED_INIT;
   }
   return CURLE_OK;
@@ -3163,7 +3163,7 @@ void Curl_ssh_cleanup(void)
 
 void Curl_ssh_version(char *buffer, size_t buflen)
 {
-  (void)msnprintf(buffer, buflen, "libssh/%s", ssh_version(0));
+  (void)curl_msnprintf(buffer, buflen, "libssh/%s", ssh_version(0));
 }
 
 #endif                          /* USE_LIBSSH */
index 390602b35aeb4d0cfc4481e78ba9824f596a8185..8ad263e7f3e99b67cd4ee8ee8e4399898291a771 100644 (file)
@@ -71,8 +71,7 @@
 #include "../curlx/base64.h" /* for base64 encoding/decoding */
 #include "../curl_sha256.h"
 
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "../curl_memory.h"
 #include "../memdebug.h"
 
@@ -174,11 +173,11 @@ kbd_callback(const char *name, int name_len, const char *instruction,
   struct Curl_easy *data = (struct Curl_easy *)*abstract;
 
 #ifdef CURL_LIBSSH2_DEBUG
-  fprintf(stderr, "name=%s\n", name);
-  fprintf(stderr, "name_len=%d\n", name_len);
-  fprintf(stderr, "instruction=%s\n", instruction);
-  fprintf(stderr, "instruction_len=%d\n", instruction_len);
-  fprintf(stderr, "num_prompts=%d\n", num_prompts);
+  curl_mfprintf(stderr, "name=%s\n", name);
+  curl_mfprintf(stderr, "name_len=%d\n", name_len);
+  curl_mfprintf(stderr, "instruction=%s\n", instruction);
+  curl_mfprintf(stderr, "instruction_len=%d\n", instruction_len);
+  curl_mfprintf(stderr, "num_prompts=%d\n", num_prompts);
 #else
   (void)name;
   (void)name_len;
@@ -662,7 +661,8 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data,
       /* The fingerprint points to static storage (!), do not free() it. */
       int i;
       for(i = 0; i < 16; i++) {
-        msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char) fingerprint[i]);
+        curl_msnprintf(&md5buffer[i*2], 3, "%02x",
+                       (unsigned char)fingerprint[i]);
       }
 
       infof(data, "SSH MD5 fingerprint: %s", md5buffer);
@@ -871,7 +871,8 @@ static CURLcode sftp_quote(struct Curl_easy *data,
 
   if(curl_strequal("pwd", cmd)) {
     /* output debug output if that is requested */
-    char *tmp = aprintf("257 \"%s\" is current directory.\n", sshp->path);
+    char *tmp = curl_maprintf("257 \"%s\" is current directory.\n",
+                              sshp->path);
     if(!tmp)
       return CURLE_OUT_OF_MEMORY;
     Curl_debug(data, CURLINFO_HEADER_OUT, "PWD\n", 4);
@@ -1193,12 +1194,12 @@ static CURLcode ssh_state_pkey_init(struct Curl_easy *data,
       /* If no private key file is specified, try some common paths. */
       if(home) {
         /* Try ~/.ssh first. */
-        sshc->rsa = aprintf("%s/.ssh/id_rsa", home);
+        sshc->rsa = curl_maprintf("%s/.ssh/id_rsa", home);
         if(!sshc->rsa)
           out_of_memory = TRUE;
         else if(curlx_stat(sshc->rsa, &sbuf)) {
           free(sshc->rsa);
-          sshc->rsa = aprintf("%s/.ssh/id_dsa", home);
+          sshc->rsa = curl_maprintf("%s/.ssh/id_dsa", home);
           if(!sshc->rsa)
             out_of_memory = TRUE;
           else if(curlx_stat(sshc->rsa, &sbuf)) {
@@ -2234,24 +2235,24 @@ static CURLcode ssh_state_sftp_quote_statvfs(struct Curl_easy *data,
 #define CURL_LIBSSH2_VFS_SIZE_MASK "llu"
 #endif
     CURLcode result;
-    char *tmp = aprintf("statvfs:\n"
-                        "f_bsize: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
-                        "f_frsize: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
-                        "f_blocks: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
-                        "f_bfree: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
-                        "f_bavail: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
-                        "f_files: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
-                        "f_ffree: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
-                        "f_favail: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
-                        "f_fsid: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
-                        "f_flag: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
-                        "f_namemax: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n",
-                        statvfs.f_bsize, statvfs.f_frsize,
-                        statvfs.f_blocks, statvfs.f_bfree,
-                        statvfs.f_bavail, statvfs.f_files,
-                        statvfs.f_ffree, statvfs.f_favail,
-                        statvfs.f_fsid, statvfs.f_flag,
-                        statvfs.f_namemax);
+    char *tmp = curl_maprintf("statvfs:\n"
+                              "f_bsize: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+                              "f_frsize: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+                              "f_blocks: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+                              "f_bfree: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+                              "f_bavail: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+                              "f_files: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+                              "f_ffree: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+                              "f_favail: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+                              "f_fsid: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+                              "f_flag: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+                              "f_namemax: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n",
+                              statvfs.f_bsize, statvfs.f_frsize,
+                              statvfs.f_blocks, statvfs.f_bfree,
+                              statvfs.f_bavail, statvfs.f_files,
+                              statvfs.f_ffree, statvfs.f_favail,
+                              statvfs.f_fsid, statvfs.f_flag,
+                              statvfs.f_namemax);
     if(!tmp) {
       myssh_state(data, sshc, SSH_SFTP_CLOSE);
       sshc->nextstate = SSH_NO_STATE;
@@ -3974,7 +3975,7 @@ static const char *sftp_libssh2_strerror(unsigned long err)
 CURLcode Curl_ssh_init(void)
 {
   if(libssh2_init(0)) {
-    DEBUGF(fprintf(stderr, "Error: libssh2_init failed\n"));
+    DEBUGF(curl_mfprintf(stderr, "Error: libssh2_init failed\n"));
     return CURLE_FAILED_INIT;
   }
   return CURLE_OK;
@@ -3987,7 +3988,7 @@ void Curl_ssh_cleanup(void)
 
 void Curl_ssh_version(char *buffer, size_t buflen)
 {
-  (void)msnprintf(buffer, buflen, "libssh2/%s", libssh2_version(0));
+  (void)curl_msnprintf(buffer, buflen, "libssh2/%s", libssh2_version(0));
 }
 
 /* The SSH session is associated with the *CONNECTION* but the callback user
diff --git a/lib/vtls/.checksrc b/lib/vtls/.checksrc
deleted file mode 100644 (file)
index e69de29..0000000
index 4bf60c1a4abbc656476091eb2386ac015b0143fc..23fb3a3c5d164535d45f18ca637667a4edf9d77e 100644 (file)
@@ -25,7 +25,6 @@
 
 #if defined(USE_MBEDTLS) || defined(USE_RUSTLS)
 #include "cipher_suite.h"
-#include "../curl_printf.h"
 #include <string.h>
 
 /*
@@ -630,9 +629,9 @@ static int cs_zip_to_str(const uint8_t zip[6],
 
     /* append the part string to the buffer */
     if(i > 0)
-      r = msnprintf(&buf[len], buf_size - len, "%c%s", separator, entry);
+      r = curl_msnprintf(&buf[len], buf_size - len, "%c%s", separator, entry);
     else
-      r = msnprintf(&buf[len], buf_size - len, "%s", entry);
+      r = curl_msnprintf(&buf[len], buf_size - len, "%s", entry);
 
     if(r < 0)
       return -1;
@@ -703,7 +702,7 @@ int Curl_cipher_suite_get_str(uint16_t id, char *buf, size_t buf_size,
     r = cs_zip_to_str(cs_list[j].zip, buf, buf_size);
 
   if(r < 0)
-    msnprintf(buf, buf_size, "TLS_UNKNOWN_0x%04x", id);
+    curl_msnprintf(buf, buf_size, "TLS_UNKNOWN_0x%04x", id);
 
   return r;
 }
index 3d69ab1d1cab3790afe6c69e18dfdfbd1e8040a9..43edbd57ad2b16449c3af605655ed8aad6e76352 100644 (file)
@@ -59,7 +59,6 @@
 #include "../curlx/warnless.h"
 #include "x509asn1.h"
 #include "../multiif.h"
-#include "../curl_printf.h"
 #include "../curl_memory.h"
 /* The last #include file should be: */
 #include "../memdebug.h"
@@ -70,7 +69,7 @@
 #ifdef GTLSDEBUG
 static void tls_log_func(int level, const char *str)
 {
-    fprintf(stderr, "|<%d>| %s", level, str);
+    curl_mfprintf(stderr, "|<%d>| %s", level, str);
 }
 #endif
 static bool gtls_inited = FALSE;
@@ -191,17 +190,17 @@ static void showtime(struct Curl_easy *data,
   if(result)
     return;
 
-  msnprintf(str,
-            sizeof(str),
-            "  %s: %s, %02d %s %4d %02d:%02d:%02d GMT",
-            text,
-            Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
-            tm->tm_mday,
-            Curl_month[tm->tm_mon],
-            tm->tm_year + 1900,
-            tm->tm_hour,
-            tm->tm_min,
-            tm->tm_sec);
+  curl_msnprintf(str,
+                 sizeof(str),
+                 "  %s: %s, %02d %s %4d %02d:%02d:%02d GMT",
+                 text,
+                 Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
+                 tm->tm_mday,
+                 Curl_month[tm->tm_mon],
+                 tm->tm_year + 1900,
+                 tm->tm_hour,
+                 tm->tm_min,
+                 tm->tm_sec);
   infof(data, "%s", str);
 }
 #endif
@@ -2272,7 +2271,7 @@ out:
 
 size_t Curl_gtls_version(char *buffer, size_t size)
 {
-  return msnprintf(buffer, size, "GnuTLS/%s", gnutls_check_version(NULL));
+  return curl_msnprintf(buffer, size, "GnuTLS/%s", gnutls_check_version(NULL));
 }
 
 /* data might be NULL! */
index aa7e8d67ef4d6aa73ab4d38a0ce7809bdcf9484a..3ff131b441a0c22f70074d73e504a9a5f2394240 100644 (file)
@@ -67,8 +67,7 @@
 #include "mbedtls_threadlock.h"
 #include "../strdup.h"
 
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "../curl_memory.h"
 #include "../memdebug.h"
 
@@ -307,7 +306,7 @@ mbed_cipher_suite_get_str(uint16_t id, char *buf, size_t buf_size,
                           bool prefer_rfc)
 {
   if(id == MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8)
-    msnprintf(buf, buf_size, "%s", "TLS_ECJPAKE_WITH_AES_128_CCM_8");
+    curl_msnprintf(buf, buf_size, "%s", "TLS_ECJPAKE_WITH_AES_128_CCM_8");
   else
     return Curl_cipher_suite_get_str(id, buf, buf_size, prefer_rfc);
   return 0;
@@ -1336,10 +1335,10 @@ static size_t mbedtls_version(char *buffer, size_t size)
 #ifdef MBEDTLS_VERSION_C
   /* if mbedtls_version_get_number() is available it is better */
   unsigned int version = mbedtls_version_get_number();
-  return msnprintf(buffer, size, "mbedTLS/%u.%u.%u", version >> 24,
-                   (version >> 16) & 0xff, (version >> 8) & 0xff);
+  return curl_msnprintf(buffer, size, "mbedTLS/%u.%u.%u", version >> 24,
+                        (version >> 16) & 0xff, (version >> 8) & 0xff);
 #else
-  return msnprintf(buffer, size, "mbedTLS/%s", MBEDTLS_VERSION_STRING);
+  return curl_msnprintf(buffer, size, "mbedTLS/%s", MBEDTLS_VERSION_STRING);
 #endif
 }
 
index 682c221852c82b1c4fde6aa701f93cd48f7d399f..ed70308b739d7057c2d2360c27d74d8f0df7c174 100644 (file)
@@ -36,9 +36,9 @@
 #endif
 
 #include "mbedtls_threadlock.h"
-#include "../curl_printf.h"
+
+/* The last 2 #include files should be: */
 #include "../curl_memory.h"
-/* The last #include file should be: */
 #include "../memdebug.h"
 
 /* number of thread locks */
@@ -96,14 +96,14 @@ int Curl_mbedtlsthreadlock_lock_function(int n)
   if(n < NUMT) {
 #if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
     if(pthread_mutex_lock(&mutex_buf[n])) {
-      DEBUGF(fprintf(stderr,
-                     "Error: mbedtlsthreadlock_lock_function failed\n"));
+      DEBUGF(curl_mfprintf(stderr, "Error: "
+                           "mbedtlsthreadlock_lock_function failed\n"));
       return 0; /* pthread_mutex_lock failed */
     }
 #elif defined(_WIN32)
     if(WaitForSingleObject(mutex_buf[n], INFINITE) == WAIT_FAILED) {
-      DEBUGF(fprintf(stderr,
-                     "Error: mbedtlsthreadlock_lock_function failed\n"));
+      DEBUGF(curl_mfprintf(stderr, "Error: "
+                           "mbedtlsthreadlock_lock_function failed\n"));
       return 0; /* pthread_mutex_lock failed */
     }
 #endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
@@ -116,14 +116,14 @@ int Curl_mbedtlsthreadlock_unlock_function(int n)
   if(n < NUMT) {
 #if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
     if(pthread_mutex_unlock(&mutex_buf[n])) {
-      DEBUGF(fprintf(stderr,
-                     "Error: mbedtlsthreadlock_unlock_function failed\n"));
+      DEBUGF(curl_mfprintf(stderr, "Error: "
+                           "mbedtlsthreadlock_unlock_function failed\n"));
       return 0; /* pthread_mutex_unlock failed */
     }
 #elif defined(_WIN32)
     if(!ReleaseMutex(mutex_buf[n])) {
-      DEBUGF(fprintf(stderr,
-                     "Error: mbedtlsthreadlock_unlock_function failed\n"));
+      DEBUGF(curl_mfprintf(stderr, "Error: "
+                           "mbedtlsthreadlock_unlock_function failed\n"));
       return 0; /* pthread_mutex_lock failed */
     }
 #endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
index 409c9c09460c5fec8308e5eb006e61da57386408..3145d4d203150a39077ee886bf9f0c33e57e2b57 100644 (file)
@@ -66,7 +66,6 @@
 #include "../curlx/strerr.h"
 #include "../curlx/strparse.h"
 #include "../strdup.h"
-#include "../curl_printf.h"
 #include "apple.h"
 
 #include <openssl/ssl.h>
@@ -274,7 +273,7 @@ static CURLcode pubkey_show(struct Curl_easy *data,
 {
   char namebuf[32];
 
-  msnprintf(namebuf, sizeof(namebuf), "%s(%s)", type, name);
+  curl_msnprintf(namebuf, sizeof(namebuf), "%s(%s)", type, name);
 
   if(bn)
     BN_print(mem, bn);
@@ -2803,7 +2802,7 @@ static void ossl_trace(int direction, int ssl_ver, int content_type,
   case 0:
     break;
   default:
-    msnprintf(unknown, sizeof(unknown), "(%x)", ssl_ver);
+    curl_msnprintf(unknown, sizeof(unknown), "(%x)", ssl_ver);
     verstr = unknown;
     break;
   }
@@ -2850,10 +2849,10 @@ static void ossl_trace(int direction, int ssl_ver, int content_type,
       msg_name = ssl_msg_type(ssl_ver, msg_type);
     }
 
-    txt_len = msnprintf(ssl_buf, sizeof(ssl_buf),
-                        "%s (%s), %s, %s (%d):\n",
-                        verstr, direction ? "OUT" : "IN",
-                        tls_rt_name, msg_name, msg_type);
+    txt_len = curl_msnprintf(ssl_buf, sizeof(ssl_buf),
+                             "%s (%s), %s, %s (%d):\n",
+                             verstr, direction ? "OUT" : "IN",
+                             tls_rt_name, msg_name, msg_type);
     Curl_debug(data, CURLINFO_TEXT, ssl_buf, (size_t)txt_len);
   }
 
@@ -4866,7 +4865,8 @@ static void infof_certstack(struct Curl_easy *data, const SSL *ssl)
       char group_name[80] = "";
       get_group_name = EVP_PKEY_get_group_name(current_pkey, group_name,
                                                sizeof(group_name), NULL);
-      msnprintf(group_name_final, sizeof(group_name_final), "/%s", group_name);
+      curl_msnprintf(group_name_final, sizeof(group_name_final), "/%s",
+                     group_name);
     }
     type_name = current_pkey ? EVP_PKEY_get0_type_name(current_pkey) : NULL;
 #else
@@ -5278,8 +5278,8 @@ static CURLcode ossl_send_earlydata(struct Curl_cfilter *cf,
         else if(sockerr)
           curlx_strerror(sockerr, error_buffer, sizeof(error_buffer));
         else
-          msnprintf(error_buffer, sizeof(error_buffer), "%s",
-                    SSL_ERROR_to_str(err));
+          curl_msnprintf(error_buffer, sizeof(error_buffer), "%s",
+                         SSL_ERROR_to_str(err));
 
         failf(data, OSSL_PACKAGE " SSL_write:early_data: %s, errno %d",
               error_buffer, sockerr);
@@ -5464,8 +5464,8 @@ static CURLcode ossl_send(struct Curl_cfilter *cf,
       else if(sockerr)
         curlx_strerror(sockerr, error_buffer, sizeof(error_buffer));
       else
-        msnprintf(error_buffer, sizeof(error_buffer), "%s",
-                  SSL_ERROR_to_str(err));
+        curl_msnprintf(error_buffer, sizeof(error_buffer), "%s",
+                       SSL_ERROR_to_str(err));
 
       failf(data, OSSL_PACKAGE " SSL_write: %s, errno %d",
             error_buffer, sockerr);
@@ -5561,8 +5561,8 @@ static CURLcode ossl_recv(struct Curl_cfilter *cf,
         else if(sockerr && err == SSL_ERROR_SYSCALL)
           curlx_strerror(sockerr, error_buffer, sizeof(error_buffer));
         else
-          msnprintf(error_buffer, sizeof(error_buffer), "%s",
-                    SSL_ERROR_to_str(err));
+          curl_msnprintf(error_buffer, sizeof(error_buffer), "%s",
+                         SSL_ERROR_to_str(err));
         failf(data, OSSL_PACKAGE " SSL_read: %s, errno %d",
               error_buffer, sockerr);
         result = CURLE_RECV_ERROR;
@@ -5584,8 +5584,8 @@ static CURLcode ossl_recv(struct Curl_cfilter *cf,
           if(sockerr)
             curlx_strerror(sockerr, error_buffer, sizeof(error_buffer));
           else {
-            msnprintf(error_buffer, sizeof(error_buffer),
-                      "Connection closed abruptly");
+            curl_msnprintf(error_buffer, sizeof(error_buffer),
+                           "Connection closed abruptly");
           }
           failf(data, OSSL_PACKAGE " SSL_read: %s, errno %d",
                 error_buffer, sockerr);
@@ -5705,7 +5705,7 @@ size_t Curl_ossl_version(char *buffer, size_t size)
   if(curl_strnequal(ver, expected, sizeof(expected) - 1)) {
     ver += sizeof(expected) - 1;
   }
-  count = msnprintf(buffer, size, "%s/%s", OSSL_PACKAGE, ver);
+  count = curl_msnprintf(buffer, size, "%s/%s", OSSL_PACKAGE, ver);
   for(p = buffer; *p; ++p) {
     if(ISBLANK(*p))
       *p = '_';
@@ -5713,17 +5713,17 @@ size_t Curl_ossl_version(char *buffer, size_t size)
   return count;
 #elif defined(OPENSSL_IS_BORINGSSL)
 #ifdef CURL_BORINGSSL_VERSION
-  return msnprintf(buffer, size, "%s/%s",
-                   OSSL_PACKAGE, CURL_BORINGSSL_VERSION);
+  return curl_msnprintf(buffer, size, "%s/%s",
+                        OSSL_PACKAGE, CURL_BORINGSSL_VERSION);
 #else
-  return msnprintf(buffer, size, OSSL_PACKAGE);
+  return curl_msnprintf(buffer, size, OSSL_PACKAGE);
 #endif
 #elif defined(OPENSSL_IS_AWSLC)
-  return msnprintf(buffer, size, "%s/%s",
-                   OSSL_PACKAGE, AWSLC_VERSION_NUMBER_STRING);
+  return curl_msnprintf(buffer, size, "%s/%s",
+                        OSSL_PACKAGE, AWSLC_VERSION_NUMBER_STRING);
 #elif defined(OPENSSL_VERSION_STRING)  /* OpenSSL 3+ */
-  return msnprintf(buffer, size, "%s/%s",
-                   OSSL_PACKAGE, OpenSSL_version(OPENSSL_VERSION_STRING));
+  return curl_msnprintf(buffer, size, "%s/%s",
+                        OSSL_PACKAGE, OpenSSL_version(OPENSSL_VERSION_STRING));
 #else
   /* not LibreSSL, BoringSSL and not using OpenSSL_version */
 
@@ -5746,16 +5746,16 @@ size_t Curl_ossl_version(char *buffer, size_t size)
   else
     sub[0]='\0';
 
-  return msnprintf(buffer, size, "%s/%lx.%lx.%lx%s"
+  return curl_msnprintf(buffer, size, "%s/%lx.%lx.%lx%s"
 #ifdef OPENSSL_FIPS
-                   "-fips"
-#endif
-                   ,
-                   OSSL_PACKAGE,
-                   (ssleay_value >> 28) & 0xf,
-                   (ssleay_value >> 20) & 0xff,
-                   (ssleay_value >> 12) & 0xff,
-                   sub);
+                        "-fips"
+#endif
+                        ,
+                        OSSL_PACKAGE,
+                        (ssleay_value >> 28) & 0xf,
+                        (ssleay_value >> 20) & 0xff,
+                        (ssleay_value >> 12) & 0xff,
+                        sub);
 #endif
 }
 
index ce7a4d5c9dcb7c470fb67728997e79fd34a48f92..a3ab49a101eac43e5af7f0a1e5a69cddb005e37b 100644 (file)
@@ -28,8 +28,6 @@
 
 #ifdef USE_RUSTLS
 
-#include "../curl_printf.h"
-
 #include <rustls.h>
 
 #include "../curlx/fopen.h"
@@ -520,7 +518,7 @@ cr_keylog_log_cb(struct rustls_str label,
   (void)client_random_len;
   DEBUGASSERT(client_random_len == CLIENT_RANDOM_SIZE);
   /* Turning a "rustls_str" into a null delimited "c" string */
-  msnprintf(clabel, label.len + 1, "%.*s", (int)label.len, label.data);
+  curl_msnprintf(clabel, label.len + 1, "%.*s", (int)label.len, label.data);
   Curl_tls_keylog_write(clabel, client_random, secret, secret_len);
 }
 
@@ -1389,7 +1387,7 @@ cr_close(struct Curl_cfilter *cf, struct Curl_easy *data)
 static size_t cr_version(char *buffer, size_t size)
 {
   const struct rustls_str ver = rustls_version();
-  return msnprintf(buffer, size, "%.*s", (int)ver.len, ver.data);
+  return curl_msnprintf(buffer, size, "%.*s", (int)ver.len, ver.data);
 }
 
 static CURLcode
index c0e96c93bf4c8dbfcb9caac6701cc36be13df89a..ae5834d84342b333e4737f5e08edf5f39c1aa29c 100644 (file)
@@ -52,7 +52,6 @@
 #include "../curlx/multibyte.h"
 #include "../curlx/warnless.h"
 #include "x509asn1.h"
-#include "../curl_printf.h"
 #include "../multiif.h"
 #include "../system_win32.h"
 #include "../curlx/version_win32.h"
 #define CERT_THUMBPRINT_DATA_LEN 20
 
 /* Uncomment to force verbose output
- * #define infof(x, y, ...) printf(y, __VA_ARGS__)
- * #define failf(x, y, ...) printf(y, __VA_ARGS__)
+ * #define infof(x, y, ...) curl_mprintf(y, __VA_ARGS__)
+ * #define failf(x, y, ...) curl_mprintf(y, __VA_ARGS__)
  */
 
 /* Offered when targeting Vista (XP SP2+) */
@@ -2586,7 +2585,7 @@ static void schannel_cleanup(void)
 
 static size_t schannel_version(char *buffer, size_t size)
 {
-  return msnprintf(buffer, size, "Schannel");
+  return curl_msnprintf(buffer, size, "Schannel");
 }
 
 static CURLcode schannel_random(struct Curl_easy *data,
index f73d758ba196fcef509efc01f889ce8d3484f4ce..e64a113ff2b694e6cd1b9921645805e863e2363e 100644 (file)
@@ -46,7 +46,6 @@
 #include "../strerror.h"
 #include "../curlx/winapi.h"
 #include "../curlx/multibyte.h"
-#include "../curl_printf.h"
 #include "hostcheck.h"
 #include "../curlx/version_win32.h"
 
index ccd567cd864cc25229cdf41e3d7a34386df0e85c..b715dab035d20470c0b440d6f725f4079345c426 100644 (file)
@@ -71,7 +71,6 @@
 #include "../curl_sha256.h"
 #include "../curlx/warnless.h"
 #include "../curlx/base64.h"
-#include "../curl_printf.h"
 #include "../curlx/inet_pton.h"
 #include "../connect.h"
 #include "../select.h"
@@ -1094,8 +1093,8 @@ static size_t multissl_version(char *buffer, size_t size)
       bool paren = (selected != available_backends[i]);
 
       if(available_backends[i]->version(vb, sizeof(vb))) {
-        p += msnprintf(p, end - p, "%s%s%s%s", (p != backends ? " " : ""),
-                       (paren ? "(" : ""), vb, (paren ? ")" : ""));
+        p += curl_msnprintf(p, end - p, "%s%s%s%s", (p != backends ? " " : ""),
+                            (paren ? "(" : ""), vb, (paren ? ")" : ""));
       }
     }
 
index 16e3f0314f64dd21a28cf19d95df38ea4596e940..763b474cfc7d37cd5915672ae6eb5ce2dec22efc 100644 (file)
@@ -46,7 +46,6 @@
 #include "../curl_sha256.h"
 #include "../rand.h"
 #include "../curlx/warnless.h"
-#include "../curl_printf.h"
 #include "../strdup.h"
 
 /* The last #include files should be: */
index ed024356766e79607a7089452c9d64448e4fafcd..6186ce985be70f2ff772bfe2b2e34c6be4900929 100644 (file)
@@ -69,7 +69,6 @@
 #include "../select.h"
 #include "../strdup.h"
 #include "x509asn1.h"
-#include "../curl_printf.h"
 #include "../multiif.h"
 
 #include <wolfssl/ssl.h>
@@ -2056,9 +2055,9 @@ static CURLcode wssl_recv(struct Curl_cfilter *cf,
 size_t Curl_wssl_version(char *buffer, size_t size)
 {
 #if LIBWOLFSSL_VERSION_HEX >= 0x03006000
-  return msnprintf(buffer, size, "wolfSSL/%s", wolfSSL_lib_version());
+  return curl_msnprintf(buffer, size, "wolfSSL/%s", wolfSSL_lib_version());
 #elif defined(WOLFSSL_VERSION)
-  return msnprintf(buffer, size, "wolfSSL/%s", WOLFSSL_VERSION);
+  return curl_msnprintf(buffer, size, "wolfSSL/%s", WOLFSSL_VERSION);
 #endif
 }
 
index 96b7f5bd630c32ab77702f4651f18eb657c5f74c..c5fc86351524197bbbb30e526b77fcf71f8b969b 100644 (file)
@@ -49,8 +49,7 @@
 #include "x509asn1.h"
 #include "../curlx/dynbuf.h"
 
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "../curl_memory.h"
 #include "../memdebug.h"
 
@@ -998,7 +997,7 @@ static int do_pubkey(struct Curl_easy *data, int certnum,
       infof(data, "   ECC Public Key (%zu bits)", len);
     if(data->set.ssl.certinfo) {
       char q[sizeof(len) * 8 / 3 + 1];
-      (void)msnprintf(q, sizeof(q), "%zu", len);
+      (void)curl_msnprintf(q, sizeof(q), "%zu", len);
       if(ssl_push_certinfo(data, certnum, "ECC Public Key", q))
         return 1;
     }
@@ -1033,7 +1032,7 @@ static int do_pubkey(struct Curl_easy *data, int certnum,
       infof(data, "   RSA Public Key (%zu bits)", len);
     if(data->set.ssl.certinfo) {
       char r[sizeof(len) * 8 / 3 + 1];
-      msnprintf(r, sizeof(r), "%zu", len);
+      curl_msnprintf(r, sizeof(r), "%zu", len);
       if(ssl_push_certinfo(data, certnum, "RSA Public Key", r))
         return 1;
     }
index 36c9c91f6542044af11823d23106b1bf173fc723..d3379c6502375abd3d196ed09040dbf2b27b5196 100644 (file)
--- a/lib/ws.c
+++ b/lib/ws.c
@@ -42,8 +42,7 @@
 #include "curlx/nonblock.h"
 #include "curlx/strparse.h"
 
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
 #include "curl_memory.h"
 #include "memdebug.h"
 
index 02edcd63c0c12361b80e2b97804bdd5ae55d5d66..ca497b351d43ae53407a4dd9c689e1293958d1d6 100644 (file)
@@ -107,6 +107,7 @@ parse_command_line(const char *cmdargs, size_t len,
   }
 
   if(quote) {
+    /* !checksrc! disable BANNEDFUNC 1 */
     fprintf(stderr, "Unterminated quote: %c\n", quote);
     return -1;
   }
diff --git a/scripts/.checksrc b/scripts/.checksrc
new file mode 100644 (file)
index 0000000..84d62d2
--- /dev/null
@@ -0,0 +1 @@
+allowfunc printf
index a52581155d463a3e38fd0cc325016d1bcd4c7b77..da9b6b4b7723df0c9cba8f671896b95bebeb33ad 100644 (file)
@@ -26,7 +26,7 @@ EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl checksrc-al
   mk-ca-bundle.pl mk-unity.pl schemetable.c cd2nroff nroff2cd cdall cd2cd managen    \
   dmaketgz maketgz release-tools.sh verify-release cmakelint.sh mdlinkcheck          \
   CMakeLists.txt perlcheck.sh pythonlint.sh randdisable wcurl top-complexity         \
-  extract-unit-protos
+  extract-unit-protos .checksrc
 
 dist_bin_SCRIPTS = wcurl
 
index 017738ecdf8aa7cd83e69208bdb25f7424b454cc..5a8c80ebfe5bb8647e9528fdcdce40fef3c32b39 100755 (executable)
@@ -56,6 +56,14 @@ my %banfunc = (
     "snprintf" => 1,
     "vsprintf" => 1,
     "vsnprintf" => 1,
+    "aprintf" => 1,
+    "fprintf" => 1,
+    "msnprintf" => 1,
+    "mvsnprintf" => 1,
+    "printf" => 1,
+    "vaprintf" => 1,
+    "vfprintf" => 1,
+    "vprintf" => 1,
     "sscanf" => 1,
     "strcat" => 1,
     "strerror" => 1,
index 4a6b707084cf218ebe30b83de3bf2667f172711a..946367c4999f6f2961afc23db1d2bfb4211b2443 100644 (file)
@@ -1,9 +1 @@
 enable STDERR
-banfunc aprintf
-banfunc fprintf
-banfunc msnprintf
-banfunc mvsnprintf
-banfunc printf
-banfunc vaprintf
-banfunc vfprintf
-banfunc vprintf
index 32f8826df03efa0bbdaaa254db0263bff4110705..72450eca630bf6ad9ed5a8d460a540e80a8d9815 100644 (file)
@@ -27,6 +27,7 @@
 int main(int argc, char **argv)
 {
   (void)argc;
+  /* !checksrc! disable BANNEDFUNC 1 */
   printf("libcurl test: |%s|%s|\n", argv[0], curl_version());
   return 0;
 }
diff --git a/tests/libtest/.checksrc b/tests/libtest/.checksrc
deleted file mode 100644 (file)
index a3f8f30..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-banfunc aprintf
-banfunc fprintf
-banfunc msnprintf
-banfunc mvsnprintf
-banfunc printf
-banfunc vaprintf
-banfunc vfprintf
-banfunc vprintf
index 482e09d098a42ddd3bd488d1d22a0cf2f5b39be2..b62a359eabefbeceb28d73174c274e3f1c11e80e 100644 (file)
@@ -41,7 +41,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include        \
 # Get BUNDLE, FIRST_C, FIRST_H, UTILS_C, UTILS_H, CURLX_C, TESTS_C variables
 include Makefile.inc
 
-EXTRA_DIST = CMakeLists.txt .checksrc $(FIRST_C) $(FIRST_H) $(UTILS_C) $(UTILS_H) $(TESTS_C) \
+EXTRA_DIST = CMakeLists.txt $(FIRST_C) $(FIRST_H) $(UTILS_C) $(UTILS_H) $(TESTS_C) \
   test307.pl test610.pl test613.pl test1013.pl test1022.pl mk-lib1521.pl
 
 CFLAGS += @CURL_CFLAG_EXTRAS@
index d6506e14020acad2ef077bf32e30b3e3d5b6b3cb..d4be12473ac49e0ae10affa05452071ba570dae7 100644 (file)
@@ -1,9 +1,11 @@
 allowfunc accept
 allowfunc fclose
 allowfunc fopen
+allowfunc fprintf
 allowfunc freeaddrinfo
 allowfunc getaddrinfo
 allowfunc open
+allowfunc printf
 allowfunc recv
 allowfunc send
 allowfunc snprintf
diff --git a/tests/tunit/.checksrc b/tests/tunit/.checksrc
deleted file mode 100644 (file)
index a3f8f30..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-banfunc aprintf
-banfunc fprintf
-banfunc msnprintf
-banfunc mvsnprintf
-banfunc printf
-banfunc vaprintf
-banfunc vfprintf
-banfunc vprintf
index fea9d51152aea60f9863b2a8f557bd7ab760e92c..219b7a10579c67e173a0856680c453a34eb45699 100644 (file)
@@ -43,7 +43,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include        \
 # Get BUNDLE, FIRST_C, TESTS_C variables
 include Makefile.inc
 
-EXTRA_DIST = CMakeLists.txt .checksrc README.md $(TESTS_C)
+EXTRA_DIST = CMakeLists.txt README.md $(TESTS_C)
 
 CFLAGS += @CURL_CFLAG_EXTRAS@
 
diff --git a/tests/unit/.checksrc b/tests/unit/.checksrc
deleted file mode 100644 (file)
index a3f8f30..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-banfunc aprintf
-banfunc fprintf
-banfunc msnprintf
-banfunc mvsnprintf
-banfunc printf
-banfunc vaprintf
-banfunc vfprintf
-banfunc vprintf
index 1e9940f48a0c3679d18a92bba6882c1591a50920..32c2f3895594b495fa0c2b8f37eccdf56c6f5f03 100644 (file)
@@ -42,7 +42,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include        \
 # Get BUNDLE, FIRST_C, TESTS_C variables
 include Makefile.inc
 
-EXTRA_DIST = CMakeLists.txt .checksrc README.md $(TESTS_C)
+EXTRA_DIST = CMakeLists.txt README.md $(TESTS_C)
 
 CFLAGS += @CURL_CFLAG_EXTRAS@