]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curlx: move into to curlx/ 17253/head
authorDaniel Stenberg <daniel@haxx.se>
Wed, 7 May 2025 09:00:59 +0000 (11:00 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 7 May 2025 09:01:15 +0000 (11:01 +0200)
Move curlx_ functions into its own subdir.

The idea is to use the curlx_ prefix proper on these functions, and use
these same function names both in tool, lib and test suite source code.
Stop the previous special #define setup for curlx_ names.

The printf defines are now done for the library alone. Tests no longer
use the printf defines. The tool code sets its own defines. The printf
functions are not curlx, they are publicly available.

The strcase defines are not curlx_ functions and should not be used by
tool or server code.

dynbuf, warnless, base64, strparse, timeval, timediff are now proper
curlx functions.

When libcurl is built statically, the functions from the library can be
used as-is. The key is then that the functions must work as-is, without
having to be recompiled for use in tool/tests. This avoids symbol
collisions - when libcurl is built statically, we use those functions
directly when building the tool/tests. When libcurl is shared, we
build/link them separately for the tool/tests.

Assisted-by: Jay Satiro
Closes #17253

463 files changed:
docs/internals/DYNBUF.md
docs/internals/STRPARSE.md
include/curl/curl.h
lib/CMakeLists.txt
lib/Makefile.am
lib/Makefile.inc
lib/altsvc.c
lib/asyn-ares.c
lib/asyn-thrdd.c
lib/cf-h1-proxy.c
lib/cf-h2-proxy.c
lib/cf-haproxy.c
lib/cf-https-connect.c
lib/cf-socket.c
lib/cfilters.c
lib/cfilters.h
lib/conncache.c
lib/conncache.h
lib/connect.c
lib/connect.h
lib/cookie.c
lib/cshutdn.c
lib/cshutdn.h
lib/curl_addrinfo.c
lib/curl_get_line.c
lib/curl_get_line.h
lib/curl_ntlm_core.c
lib/curl_printf.h
lib/curl_range.c
lib/curl_rtmp.c
lib/curl_sasl.c
lib/curl_setup.h
lib/curl_sha512_256.c
lib/curl_sspi.c
lib/curl_threads.c
lib/curl_trc.c
lib/curlx/README.md [new file with mode: 0644]
lib/curlx/base64.c [moved from lib/base64.c with 93% similarity]
lib/curlx/base64.h [moved from lib/curl_base64.h with 61% similarity]
lib/curlx/curlx.h [moved from lib/curlx.h with 89% similarity]
lib/curlx/dynbuf.c [moved from lib/dynbuf.c with 84% similarity]
lib/curlx/dynbuf.h [moved from lib/dynbuf.h with 62% similarity]
lib/curlx/strparse.c [moved from lib/strparse.c with 82% similarity]
lib/curlx/strparse.h [moved from lib/strparse.h with 64% similarity]
lib/curlx/timediff.c [moved from lib/timediff.c with 100% similarity]
lib/curlx/timediff.h [moved from lib/timediff.h with 98% similarity]
lib/curlx/timeval.c [moved from lib/timeval.c with 88% similarity]
lib/curlx/timeval.h [moved from lib/timeval.h with 74% similarity]
lib/curlx/warnless.c [moved from lib/warnless.c with 99% similarity]
lib/curlx/warnless.h [moved from lib/warnless.h with 98% similarity]
lib/cw-out.c
lib/dict.c
lib/doh.c
lib/dynhds.c
lib/dynhds.h
lib/easy.c
lib/escape.c
lib/file.c
lib/fileinfo.c
lib/fileinfo.h
lib/fopen.c
lib/formdata.c
lib/ftp.c
lib/ftplistparser.c
lib/getinfo.c
lib/gopher.c
lib/hash.c
lib/hash.h
lib/headers.c
lib/hmac.c
lib/hostip.c
lib/hostip.h
lib/hsts.c
lib/http.c
lib/http1.c
lib/http2.c
lib/http_aws_sigv4.c
lib/http_chunks.c
lib/http_chunks.h
lib/http_digest.c
lib/http_negotiate.c
lib/http_ntlm.c
lib/http_proxy.c
lib/idn.c
lib/imap.c
lib/inet_pton.c
lib/krb5.c
lib/ldap.c
lib/md4.c
lib/md5.c
lib/mime.c
lib/mprintf.c
lib/mqtt.c
lib/multi.c
lib/multi_ev.c
lib/netrc.c
lib/netrc.h
lib/noproxy.c
lib/openldap.c
lib/parsedate.c
lib/pingpong.c
lib/pop3.c
lib/progress.c
lib/progress.h
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/smtp.c
lib/socketpair.c
lib/socks.c
lib/socks_gssapi.c
lib/socks_sspi.c
lib/speedcheck.c
lib/speedcheck.h
lib/splay.c
lib/splay.h
lib/strerror.c
lib/system_win32.c
lib/telnet.c
lib/tftp.c
lib/transfer.c
lib/url.c
lib/urlapi.c
lib/urldata.h
lib/vauth/cleartext.c
lib/vauth/cram.c
lib/vauth/digest.c
lib/vauth/digest_sspi.c
lib/vauth/krb5_sspi.c
lib/vauth/ntlm.c
lib/vauth/ntlm_sspi.c
lib/vauth/oauth2.c
lib/vauth/spnego_gssapi.c
lib/vauth/spnego_sspi.c
lib/version_win32.c
lib/vquic/curl_msh3.c
lib/vquic/curl_ngtcp2.c
lib/vquic/curl_osslq.c
lib/vquic/curl_quiche.c
lib/vquic/vquic.c
lib/vssh/curl_path.c
lib/vssh/libssh.c
lib/vssh/libssh2.c
lib/vssh/wolfssh.c
lib/vtls/gtls.c
lib/vtls/gtls.h
lib/vtls/openssl.c
lib/vtls/rustls.c
lib/vtls/schannel.c
lib/vtls/sectransp.c
lib/vtls/vtls.c
lib/vtls/vtls.h
lib/vtls/vtls_scache.c
lib/vtls/vtls_spack.c
lib/vtls/wolfssl.c
lib/vtls/x509asn1.c
lib/ws.c
projects/Windows/VC10/lib/libcurl.tmpl
projects/Windows/VC10/src/curl.tmpl
projects/Windows/VC11/lib/libcurl.tmpl
projects/Windows/VC11/src/curl.tmpl
projects/Windows/VC12/lib/libcurl.tmpl
projects/Windows/VC12/src/curl.tmpl
projects/generate.bat
src/CMakeLists.txt
src/Makefile.am
src/Makefile.inc
src/terminal.c
src/tool_cb_dbg.c
src/tool_cb_hdr.c
src/tool_cb_prg.c
src/tool_cb_rea.c
src/tool_cb_see.c
src/tool_cb_wrt.c
src/tool_cfgable.c
src/tool_cfgable.h
src/tool_dirhie.c
src/tool_doswin.c
src/tool_easysrc.c
src/tool_filetime.c
src/tool_findfile.c
src/tool_formparse.c
src/tool_getparam.c
src/tool_help.c
src/tool_helpers.c
src/tool_ipfs.c
src/tool_libinfo.c
src/tool_main.c
src/tool_msgs.c
src/tool_operate.c
src/tool_operhlp.c
src/tool_paramhlp.c
src/tool_parsecfg.c
src/tool_parsecfg.h
src/tool_progress.c
src/tool_setopt.c
src/tool_ssls.c
src/tool_urlglob.c
src/tool_util.c
src/tool_vms.c
src/tool_writeout.c
src/tool_writeout_json.c
src/tool_writeout_json.h
src/var.c
src/var.h
tests/data/test1664
tests/libtest/CMakeLists.txt
tests/libtest/Makefile.am
tests/libtest/Makefile.inc
tests/libtest/first.c
tests/libtest/lib1156.c
tests/libtest/lib1485.c
tests/libtest/lib1500.c
tests/libtest/lib1501.c
tests/libtest/lib1502.c
tests/libtest/lib1506.c
tests/libtest/lib1507.c
tests/libtest/lib1508.c
tests/libtest/lib1509.c
tests/libtest/lib1510.c
tests/libtest/lib1512.c
tests/libtest/lib1513.c
tests/libtest/lib1515.c
tests/libtest/lib1517.c
tests/libtest/lib1518.c
tests/libtest/lib1520.c
tests/libtest/lib1522.c
tests/libtest/lib1523.c
tests/libtest/lib1525.c
tests/libtest/lib1526.c
tests/libtest/lib1527.c
tests/libtest/lib1528.c
tests/libtest/lib1529.c
tests/libtest/lib1530.c
tests/libtest/lib1531.c
tests/libtest/lib1532.c
tests/libtest/lib1533.c
tests/libtest/lib1534.c
tests/libtest/lib1535.c
tests/libtest/lib1536.c
tests/libtest/lib1537.c
tests/libtest/lib1538.c
tests/libtest/lib1540.c
tests/libtest/lib1541.c
tests/libtest/lib1551.c
tests/libtest/lib1552.c
tests/libtest/lib1553.c
tests/libtest/lib1554.c
tests/libtest/lib1555.c
tests/libtest/lib1556.c
tests/libtest/lib1558.c
tests/libtest/lib1559.c
tests/libtest/lib1560.c
tests/libtest/lib1564.c
tests/libtest/lib1565.c
tests/libtest/lib1567.c
tests/libtest/lib1571.c
tests/libtest/lib1576.c
tests/libtest/lib1591.c
tests/libtest/lib1592.c
tests/libtest/lib1594.c
tests/libtest/lib1597.c
tests/libtest/lib1598.c
tests/libtest/lib1906.c
tests/libtest/lib1907.c
tests/libtest/lib1911.c
tests/libtest/lib1912.c
tests/libtest/lib1915.c
tests/libtest/lib1916.c
tests/libtest/lib1918.c
tests/libtest/lib1933.c
tests/libtest/lib1934.c
tests/libtest/lib1935.c
tests/libtest/lib1936.c
tests/libtest/lib1937.c
tests/libtest/lib1938.c
tests/libtest/lib1939.c
tests/libtest/lib1940.c
tests/libtest/lib1945.c
tests/libtest/lib1947.c
tests/libtest/lib1955.c
tests/libtest/lib1956.c
tests/libtest/lib1957.c
tests/libtest/lib1958.c
tests/libtest/lib1959.c
tests/libtest/lib1960.c
tests/libtest/lib1970.c
tests/libtest/lib1971.c
tests/libtest/lib1972.c
tests/libtest/lib1973.c
tests/libtest/lib1974.c
tests/libtest/lib1975.c
tests/libtest/lib1977.c
tests/libtest/lib1978.c
tests/libtest/lib2301.c
tests/libtest/lib2302.c
tests/libtest/lib2304.c
tests/libtest/lib2305.c
tests/libtest/lib2308.c
tests/libtest/lib2309.c
tests/libtest/lib2310.c
tests/libtest/lib2311.c
tests/libtest/lib2312.c
tests/libtest/lib2402.c
tests/libtest/lib2404.c
tests/libtest/lib2405.c
tests/libtest/lib2502.c
tests/libtest/lib3010.c
tests/libtest/lib3025.c
tests/libtest/lib3026.c
tests/libtest/lib3100.c
tests/libtest/lib3101.c
tests/libtest/lib3102.c
tests/libtest/lib3103.c
tests/libtest/lib3104.c
tests/libtest/lib3105.c
tests/libtest/lib3207.c
tests/libtest/lib3208.c
tests/libtest/lib500.c
tests/libtest/lib501.c
tests/libtest/lib504.c
tests/libtest/lib505.c
tests/libtest/lib506.c
tests/libtest/lib508.c
tests/libtest/lib509.c
tests/libtest/lib510.c
tests/libtest/lib511.c
tests/libtest/lib513.c
tests/libtest/lib514.c
tests/libtest/lib515.c
tests/libtest/lib516.c
tests/libtest/lib517.c
tests/libtest/lib518.c
tests/libtest/lib519.c
tests/libtest/lib520.c
tests/libtest/lib521.c
tests/libtest/lib523.c
tests/libtest/lib524.c
tests/libtest/lib525.c
tests/libtest/lib526.c
tests/libtest/lib530.c
tests/libtest/lib533.c
tests/libtest/lib536.c
tests/libtest/lib537.c
tests/libtest/lib539.c
tests/libtest/lib540.c
tests/libtest/lib541.c
tests/libtest/lib542.c
tests/libtest/lib543.c
tests/libtest/lib544.c
tests/libtest/lib547.c
tests/libtest/lib549.c
tests/libtest/lib552.c
tests/libtest/lib553.c
tests/libtest/lib554.c
tests/libtest/lib555.c
tests/libtest/lib556.c
tests/libtest/lib557.c
tests/libtest/lib558.c
tests/libtest/lib559.c
tests/libtest/lib562.c
tests/libtest/lib564.c
tests/libtest/lib566.c
tests/libtest/lib567.c
tests/libtest/lib568.c
tests/libtest/lib569.c
tests/libtest/lib570.c
tests/libtest/lib571.c
tests/libtest/lib572.c
tests/libtest/lib573.c
tests/libtest/lib574.c
tests/libtest/lib576.c
tests/libtest/lib578.c
tests/libtest/lib579.c
tests/libtest/lib582.c
tests/libtest/lib583.c
tests/libtest/lib586.c
tests/libtest/lib589.c
tests/libtest/lib590.c
tests/libtest/lib591.c
tests/libtest/lib598.c
tests/libtest/lib599.c
tests/libtest/lib643.c
tests/libtest/lib650.c
tests/libtest/lib651.c
tests/libtest/lib652.c
tests/libtest/lib654.c
tests/libtest/lib655.c
tests/libtest/lib658.c
tests/libtest/lib659.c
tests/libtest/lib661.c
tests/libtest/lib666.c
tests/libtest/lib667.c
tests/libtest/lib668.c
tests/libtest/lib670.c
tests/libtest/lib674.c
tests/libtest/lib676.c
tests/libtest/lib677.c
tests/libtest/lib678.c
tests/libtest/lib694.c
tests/libtest/lib695.c
tests/libtest/libauthretry.c
tests/libtest/libntlmconnect.c
tests/libtest/libprereq.c
tests/libtest/memptr.c [new file with mode: 0644]
tests/libtest/test.h
tests/libtest/testtrace.c
tests/server/CMakeLists.txt
tests/server/Makefile.am
tests/server/Makefile.inc
tests/server/dnsd.c
tests/server/getpart.c
tests/server/mqttd.c
tests/server/rtspd.c
tests/server/sockfilt.c
tests/server/socksd.c
tests/server/sws.c
tests/server/tftpd.c
tests/server/util.c
tests/server/util.h
tests/tunit/CMakeLists.txt
tests/tunit/Makefile.am
tests/unit/CMakeLists.txt
tests/unit/Makefile.am
tests/unit/curlcheck.h
tests/unit/unit1302.c
tests/unit/unit1305.c
tests/unit/unit1309.c
tests/unit/unit1323.c
tests/unit/unit1395.c
tests/unit/unit1397.c
tests/unit/unit1399.c
tests/unit/unit1602.c
tests/unit/unit1603.c
tests/unit/unit1607.c
tests/unit/unit1609.c
tests/unit/unit1614.c
tests/unit/unit1616.c
tests/unit/unit1650.c
tests/unit/unit1651.c
tests/unit/unit1652.c
tests/unit/unit1653.c
tests/unit/unit1654.c
tests/unit/unit1656.c
tests/unit/unit1657.c
tests/unit/unit1658.c
tests/unit/unit1660.c
tests/unit/unit1664.c
tests/unit/unit2600.c
tests/unit/unit2601.c
tests/unit/unit2602.c
tests/unit/unit2603.c
tests/unit/unit3200.c
tests/unit/unit3205.c
tests/unit/unit3211.c
tests/unit/unit3213.c
winbuild/MakefileBuild.vc

index 610ec577de5c43e99d010d817bcf282a7cd20d2e..1ae7131f977ef36761c3a2147ff7058f6a837f1b 100644 (file)
@@ -15,10 +15,10 @@ The `struct dynbuf` is used to hold data for each instance of a dynamic
 buffer. The members of that struct **MUST NOT** be accessed or modified
 without using the dedicated dynbuf API.
 
-## `Curl_dyn_init`
+## `curlx_dyn_init`
 
 ```c
-void Curl_dyn_init(struct dynbuf *s, size_t toobig);
+void curlx_dyn_init(struct dynbuf *s, size_t toobig);
 ```
 
 This initializes a struct to use for dynbuf and it cannot fail. The `toobig`
@@ -26,117 +26,117 @@ value **must** be set to the maximum size we allow this buffer instance to
 grow to. The functions below return `CURLE_OUT_OF_MEMORY` when hitting this
 limit.
 
-## `Curl_dyn_free`
+## `curlx_dyn_free`
 
 ```c
-void Curl_dyn_free(struct dynbuf *s);
+void curlx_dyn_free(struct dynbuf *s);
 ```
 
 Free the associated memory and clean up. After a free, the `dynbuf` struct can
 be reused to start appending new data to.
 
-## `Curl_dyn_addn`
+## `curlx_dyn_addn`
 
 ```c
-CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len);
+CURLcode curlx_dyn_addn(struct dynbuf *s, const void *mem, size_t len);
 ```
 
 Append arbitrary data of a given length to the end of the buffer.
 
-If this function fails it calls `Curl_dyn_free` on `dynbuf`.
+If this function fails it calls `curlx_dyn_free` on `dynbuf`.
 
-## `Curl_dyn_add`
+## `curlx_dyn_add`
 
 ```c
-CURLcode Curl_dyn_add(struct dynbuf *s, const char *str);
+CURLcode curlx_dyn_add(struct dynbuf *s, const char *str);
 ```
 
 Append a C string to the end of the buffer.
 
-If this function fails it calls `Curl_dyn_free` on `dynbuf`.
+If this function fails it calls `curlx_dyn_free` on `dynbuf`.
 
-## `Curl_dyn_addf`
+## `curlx_dyn_addf`
 
 ```c
-CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...);
+CURLcode curlx_dyn_addf(struct dynbuf *s, const char *fmt, ...);
 ```
 
 Append a `printf()`-style string to the end of the buffer.
 
-If this function fails it calls `Curl_dyn_free` on `dynbuf`.
+If this function fails it calls `curlx_dyn_free` on `dynbuf`.
 
-## `Curl_dyn_vaddf`
+## `curlx_dyn_vaddf`
 
 ```c
-CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap);
+CURLcode curlx_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap);
 ```
 
 Append a `vprintf()`-style string to the end of the buffer.
 
-If this function fails it calls `Curl_dyn_free` on `dynbuf`.
+If this function fails it calls `curlx_dyn_free` on `dynbuf`.
 
-## `Curl_dyn_reset`
+## `curlx_dyn_reset`
 
 ```c
-void Curl_dyn_reset(struct dynbuf *s);
+void curlx_dyn_reset(struct dynbuf *s);
 ```
 
 Reset the buffer length, but leave the allocation.
 
-## `Curl_dyn_tail`
+## `curlx_dyn_tail`
 
 ```c
-CURLcode Curl_dyn_tail(struct dynbuf *s, size_t length);
+CURLcode curlx_dyn_tail(struct dynbuf *s, size_t length);
 ```
 
 Keep `length` bytes of the buffer tail (the last `length` bytes of the
 buffer). The rest of the buffer is dropped. The specified `length` must not be
 larger than the buffer length. To instead keep the leading part, see
-`Curl_dyn_setlen()`.
+`curlx_dyn_setlen()`.
 
-## `Curl_dyn_ptr`
+## `curlx_dyn_ptr`
 
 ```c
-char *Curl_dyn_ptr(const struct dynbuf *s);
+char *curlx_dyn_ptr(const struct dynbuf *s);
 ```
 
 Returns a `char *` to the buffer if it has a length, otherwise may return
 NULL. Since the buffer may be reallocated, this pointer should not be trusted
 or used anymore after the next buffer manipulation call.
 
-## `Curl_dyn_uptr`
+## `curlx_dyn_uptr`
 
 ```c
-unsigned char *Curl_dyn_uptr(const struct dynbuf *s);
+unsigned char *curlx_dyn_uptr(const struct dynbuf *s);
 ```
 
 Returns an `unsigned char *` to the buffer if it has a length, otherwise may
 return NULL. Since the buffer may be reallocated, this pointer should not be
 trusted or used anymore after the next buffer manipulation call.
 
-## `Curl_dyn_len`
+## `curlx_dyn_len`
 
 ```c
-size_t Curl_dyn_len(const struct dynbuf *s);
+size_t curlx_dyn_len(const struct dynbuf *s);
 ```
 
 Returns the length of the buffer in bytes. Does not include the terminating
 zero byte.
 
-## `Curl_dyn_setlen`
+## `curlx_dyn_setlen`
 
 ```c
-CURLcode Curl_dyn_setlen(struct dynbuf *s, size_t len);
+CURLcode curlx_dyn_setlen(struct dynbuf *s, size_t len);
 ```
 
 Sets the new shorter length of the buffer in number of bytes. Keeps the
 leftmost set number of bytes, discards the rest. To instead keep the tail part
-of the buffer, see `Curl_dyn_tail()`.
+of the buffer, see `curlx_dyn_tail()`.
 
-## `Curl_dyn_take`
+## `curlx_dyn_take`
 
 ```c
-char *Curl_dyn_take(struct dynbuf *s, size_t *plen);
+char *curlx_dyn_take(struct dynbuf *s, size_t *plen);
 ```
 
 Transfers ownership of the internal buffer to the caller. The dynbuf
index b01a2e5f2c53eaddda39b6f890755146189606ff..2a167191909e21fef33c04af6e794aa96367c6f3 100644 (file)
@@ -12,9 +12,9 @@ functions to advance the pointer on success which then by extension allows
 second word:
 
 ~~~c
-if(Curl_str_word(&line, &word1, MAX) ||
-   Curl_str_singlespace(&line) ||
-   Curl_str_word(&line, &word2, MAX))
+if(curlx_str_word(&line, &word1, MAX) ||
+   curlx_str_singlespace(&line) ||
+   curlx_str_word(&line, &word2, MAX))
   fprintf(stderr, "ERROR\n");
 ~~~
 
@@ -33,31 +33,31 @@ struct Curl_str {
 };
 ~~~
 
-Access the struct fields with `Curl_str()` for the pointer and `Curl_strlen()`
+Access the struct fields with `curlx_str()` for the pointer and `curlx_strlen()`
 for the length rather than using the struct fields directly.
 
-## `Curl_str_init`
+## `curlx_str_init`
 
 ~~~c
-void Curl_str_init(struct Curl_str *out)
+void curlx_str_init(struct Curl_str *out)
 ~~~
 
 This initiates a string struct. The parser functions that store info in
 strings always init the string themselves, so this stand-alone use is often
 not necessary.
 
-## `Curl_str_assign`
+## `curlx_str_assign`
 
 ~~~c
-void Curl_str_assign(struct Curl_str *out, const char *str, size_t len)
+void curlx_str_assign(struct Curl_str *out, const char *str, size_t len)
 ~~~
 
 Set a pointer and associated length in the string struct.
 
-## `Curl_str_word`
+## `curlx_str_word`
 
 ~~~c
-int Curl_str_word(char **linep, struct Curl_str *out, const size_t max);
+int curlx_str_word(char **linep, struct Curl_str *out, const size_t max);
 ~~~
 
 Get a sequence of bytes until the first space or the end of the string. Return
@@ -70,14 +70,14 @@ error.
 On a successful return, `linep` is updated to point to the byte immediately
 following the parsed word.
 
-## `Curl_str_until`
+## `curlx_str_until`
 
 ~~~c
-int Curl_str_until(char **linep, struct Curl_str *out, const size_t max,
+int curlx_str_until(char **linep, struct Curl_str *out, const size_t max,
                    char delim);
 ~~~
 
-Like `Curl_str_word` but instead of parsing to space, it parses to a given
+Like `curlx_str_word` but instead of parsing to space, it parses to a given
 custom delimiter non-zero byte `delim`.
 
 `max` is the longest accepted word, or it returns error.
@@ -85,13 +85,13 @@ custom delimiter non-zero byte `delim`.
 The parsed word must be at least one byte, otherwise it is considered an
 error.
 
-## `Curl_str_untilnl`
+## `curlx_str_untilnl`
 
 ~~~c
-int Curl_str_untilnl(char **linep, struct Curl_str *out, const size_t max);
+int curlx_str_untilnl(char **linep, struct Curl_str *out, const size_t max);
 ~~~
 
-Like `Curl_str_untilnl` but instead parses until it finds a "newline byte".
+Like `curlx_str_untilnl` but instead parses until it finds a "newline byte".
 That means either a CR (ASCII 13) or an LF (ASCII 10) octet.
 
 `max` is the longest accepted word, or it returns error.
@@ -99,19 +99,19 @@ That means either a CR (ASCII 13) or an LF (ASCII 10) octet.
 The parsed word must be at least one byte, otherwise it is considered an
 error.
 
-## `Curl_str_cspn`
+## `curlx_str_cspn`
 
 ~~~c
-int Curl_str_cspn(const char **linep, struct Curl_str *out, const char *cspn);
+int curlx_str_cspn(const char **linep, struct Curl_str *out, const char *cspn);
 ~~~
 
 Get a sequence of characters until one of the bytes in the `cspn` string
 matches. Similar to the `strcspn` function.
 
-## `Curl_str_quotedword`
+## `curlx_str_quotedword`
 
 ~~~c
-int Curl_str_quotedword(char **linep, struct Curl_str *out, const size_t max);
+int curlx_str_quotedword(char **linep, struct Curl_str *out, const size_t max);
 ~~~
 
 Get a "quoted" word. This means everything that is provided within a leading
@@ -122,108 +122,108 @@ and an ending double quote character. No escaping possible.
 The parsed word must be at least one byte, otherwise it is considered an
 error.
 
-## `Curl_str_single`
+## `curlx_str_single`
 
 ~~~c
-int Curl_str_single(char **linep, char byte);
+int curlx_str_single(char **linep, char byte);
 ~~~
 
 Advance over a single character provided in `byte`. Return non-zero on error.
 
-## `Curl_str_singlespace`
+## `curlx_str_singlespace`
 
 ~~~c
-int Curl_str_singlespace(char **linep);
+int curlx_str_singlespace(char **linep);
 ~~~
 
 Advance over a single ASCII space. Return non-zero on error.
 
-## `Curl_str_passblanks`
+## `curlx_str_passblanks`
 
 ~~~c
-void Curl_str_passblanks(char **linep);
+void curlx_str_passblanks(char **linep);
 ~~~
 
 Advance over all spaces and tabs.
 
-## `Curl_str_trimblanks`
+## `curlx_str_trimblanks`
 
 ~~~c
-void Curl_str_trimblanks(struct Curl_str *out);
+void curlx_str_trimblanks(struct Curl_str *out);
 ~~~
 
 Trim off blanks (spaces and tabs) from the start and the end of the given
 string.
 
-## `Curl_str_number`
+## `curlx_str_number`
 
 ~~~c
-int Curl_str_number(char **linep, curl_size_t *nump, size_t max);
+int curlx_str_number(char **linep, curl_size_t *nump, size_t max);
 ~~~
 
 Get an unsigned decimal number not larger than `max`. Leading zeroes are just
 swallowed. Return non-zero on error. Returns error if there was not a single
 digit.
 
-## `Curl_str_numblanks`
+## `curlx_str_numblanks`
 
 ~~~c
-int Curl_str_numblanks(char **linep, curl_size_t *nump);
+int curlx_str_numblanks(char **linep, curl_size_t *nump);
 ~~~
 
 Get an unsigned 63-bit decimal number. Leading blanks and zeroes are skipped.
 Returns non-zero on error. Returns error if there was not a single digit.
 
-## `Curl_str_hex`
+## `curlx_str_hex`
 
 ~~~c
-int Curl_str_hex(char **linep, curl_size_t *nump, size_t max);
+int curlx_str_hex(char **linep, curl_size_t *nump, size_t max);
 ~~~
 
 Get an unsigned hexadecimal number not larger than `max`. Leading zeroes are
 just swallowed. Return non-zero on error. Returns error if there was not a
 single digit. Does *not* handled `0x` prefix.
 
-## `Curl_str_octal`
+## `curlx_str_octal`
 
 ~~~c
-int Curl_str_octal(char **linep, curl_size_t *nump, size_t max);
+int curlx_str_octal(char **linep, curl_size_t *nump, size_t max);
 ~~~
 
 Get an unsigned octal number not larger than `max`. Leading zeroes are just
 swallowed. Return non-zero on error. Returns error if there was not a single
 digit.
 
-## `Curl_str_newline`
+## `curlx_str_newline`
 
 ~~~c
-int Curl_str_newline(char **linep);
+int curlx_str_newline(char **linep);
 ~~~
 
 Check for a single CR or LF. Return non-zero on error */
 
-## `Curl_str_casecompare`
+## `curlx_str_casecompare`
 
 ~~~c
-int Curl_str_casecompare(struct Curl_str *str, const char *check);
+int curlx_str_casecompare(struct Curl_str *str, const char *check);
 ~~~
 
 Returns true if the provided string in the `str` argument matches the `check`
 string case insensitively.
 
-## `Curl_str_cmp`
+## `curlx_str_cmp`
 
 ~~~c
-int Curl_str_cmp(struct Curl_str *str, const char *check);
+int curlx_str_cmp(struct Curl_str *str, const char *check);
 ~~~
 
 Returns true if the provided string in the `str` argument matches the `check`
 string case sensitively. This is *not* the same return code as `strcmp`.
 
-## `Curl_str_nudge`
+## `curlx_str_nudge`
 
 ~~~c
-int Curl_str_nudge(struct Curl_str *str, size_t num);
+int curlx_str_nudge(struct Curl_str *str, size_t num);
 ~~~
 
 Removes `num` bytes from the beginning (left) of the string kept in `str`. If
index 4f103d94f6f7105894c45261337d46d9dc1e9488..128d1d3d00d86d8040dd47fc620bd26ea420ab86 100644 (file)
@@ -3326,9 +3326,7 @@ CURL_EXTERN CURLcode curl_easy_ssls_export(CURL *handle,
 #include "options.h"
 #include "header.h"
 #include "websockets.h"
-#ifndef CURL_SKIP_INCLUDE_MPRINTF
 #include "mprintf.h"
-#endif
 
 /* the typechecker does not work in C++ (yet) */
 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
index 61a679c0182ac83a3ae26248760f0d1bb8c36a95..12840952b38f3973ff39223e3150eae7dd6053b7 100644 (file)
@@ -37,7 +37,9 @@ list(APPEND HHEADERS "${CMAKE_CURRENT_BINARY_DIR}/curl_config.h")
 
 # The rest of the build
 
-set_property(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES "${PROJECT_BINARY_DIR}/lib")  # for "curl_config.h"
+set_property(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES
+  "${PROJECT_BINARY_DIR}/lib"        # for "curl_config.h"
+)
 
 if(USE_ARES)
   include_directories(SYSTEM ${CARES_INCLUDE_DIRS})
index 9ce95eaee82aa624a0e97583853e8618e397a4cb..477cbe688c60717905868d53cf10de5f5097b138 100644 (file)
@@ -30,7 +30,8 @@ CHECKSRC_DIST = .checksrc vauth/.checksrc vquic/.checksrc vssh/.checksrc \
 
 EXTRA_DIST = config-mac.h config-os400.h config-plan9.h config-riscos.h \
  config-win32.h curl_config.h.in libcurl.rc libcurl.def                 \
- $(CMAKE_DIST) Makefile.soname optiontable.pl $(CHECKSRC_DIST)
+ $(CMAKE_DIST) Makefile.soname optiontable.pl $(CHECKSRC_DIST)  \
+ curlx/README.md
 
 lib_LTLIBRARIES = libcurl.la
 
@@ -51,7 +52,7 @@ CFLAGS += @CURL_CFLAG_EXTRAS@
 # $(top_srcdir)/include is for libcurl's external include files
 # $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
 
-AM_CPPFLAGS = -I$(top_srcdir)/include        \
+AM_CPPFLAGS = -I$(top_srcdir)/include   \
               -I$(top_builddir)/lib
 
 # Prevent LIBS from being used for all link targets
@@ -83,7 +84,7 @@ endif
 if USE_UNITY
 # Keep these separate to avoid duplicate definitions when linking libtests
 # in static mode.
-curl_EXCLUDE = curl_threads.c timediff.c warnless.c
+curl_EXCLUDE = curl_threads.c curlx/timediff.c curlx/warnless.c
 if CURLDEBUG
 # We must compile this source separately to avoid memdebug.h redefinitions
 # applying to it.
index 87e6f8c43b24861f32b59d25726f2a302fae61e0..1b1483e53f385c9600bbeff769759f46237ed364 100644 (file)
 #
 ###########################################################################
 
+LIB_CURLX_CFILES = \
+  curlx/base64.c   \
+  curlx/dynbuf.c   \
+  curlx/strparse.c \
+  curlx/timediff.c \
+  curlx/timeval.c  \
+  curlx/warnless.c
+
+LIB_CURLX_HFILES = \
+  curlx/base64.h   \
+  curlx/curlx.h    \
+  curlx/dynbuf.h   \
+  curlx/strparse.h \
+  curlx/timediff.h \
+  curlx/timeval.h  \
+  curlx/warnless.h
+
 LIB_VAUTH_CFILES =      \
   vauth/cleartext.c     \
   vauth/cram.c          \
@@ -113,7 +130,6 @@ LIB_CFILES =         \
   asyn-ares.c        \
   asyn-base.c        \
   asyn-thrdd.c       \
-  base64.c           \
   bufq.c             \
   bufref.c           \
   cf-h1-proxy.c      \
@@ -148,7 +164,6 @@ LIB_CFILES =         \
   cw-pause.c         \
   dict.c             \
   doh.c              \
-  dynbuf.c           \
   dynhds.c           \
   easy.c             \
   easygetopt.c       \
@@ -229,12 +244,9 @@ LIB_CFILES =         \
   strdup.c           \
   strequal.c         \
   strerror.c         \
-  strparse.c         \
   system_win32.c     \
   telnet.c           \
   tftp.c             \
-  timediff.c         \
-  timeval.c          \
   transfer.c         \
   uint-bset.c        \
   uint-hash.c        \
@@ -244,7 +256,6 @@ LIB_CFILES =         \
   urlapi.c           \
   version.c          \
   version_win32.c    \
-  warnless.c         \
   ws.c
 
 LIB_HFILES =         \
@@ -266,7 +277,6 @@ LIB_HFILES =         \
   content_encoding.h \
   cookie.h           \
   curl_addrinfo.h    \
-  curl_base64.h      \
   curl_ctype.h       \
   curl_des.h         \
   curl_endian.h      \
@@ -294,12 +304,10 @@ LIB_HFILES =         \
   curl_sspi.h        \
   curl_threads.h     \
   curl_trc.h         \
-  curlx.h            \
   cw-out.h           \
   cw-pause.h         \
   dict.h             \
   doh.h              \
-  dynbuf.h           \
   dynhds.h           \
   easy_lock.h        \
   easyif.h           \
@@ -373,12 +381,9 @@ LIB_HFILES =         \
   strcase.h          \
   strdup.h           \
   strerror.h         \
-  strparse.h         \
   system_win32.h     \
   telnet.h           \
   tftp.h             \
-  timediff.h         \
-  timeval.h          \
   transfer.h         \
   uint-bset.h        \
   uint-hash.h        \
@@ -388,12 +393,11 @@ LIB_HFILES =         \
   urlapi-int.h       \
   urldata.h          \
   version_win32.h    \
-  warnless.h         \
   ws.h
 
 LIB_RCFILES = libcurl.rc
 
 CSOURCES = $(LIB_CFILES) $(LIB_VAUTH_CFILES) $(LIB_VTLS_CFILES) \
-  $(LIB_VQUIC_CFILES) $(LIB_VSSH_CFILES)
+  $(LIB_VQUIC_CFILES) $(LIB_VSSH_CFILES) $(LIB_CURLX_CFILES)
 HHEADERS = $(LIB_HFILES) $(LIB_VAUTH_HFILES) $(LIB_VTLS_HFILES) \
-  $(LIB_VQUIC_HFILES) $(LIB_VSSH_HFILES)
+  $(LIB_VQUIC_HFILES) $(LIB_VSSH_HFILES) $(LIB_CURLX_HFILES)
index 77bbbdb88ed90021257bb94961cf2bc7fa2e4011..ad37af4db8fd84e9db3f5c784ba47d93ab96287b 100644 (file)
 #include "strcase.h"
 #include "parsedate.h"
 #include "sendf.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "fopen.h"
 #include "rename.h"
 #include "strdup.h"
 #include "inet_pton.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 #include "connect.h"
 
 /* The last 3 #include files should be in this order */
@@ -139,13 +139,13 @@ static struct altsvc *altsvc_create(struct Curl_str *srchost,
                                     size_t dstport)
 {
   enum alpnid dstalpnid =
-    Curl_alpn2alpnid(Curl_str(dstalpn), Curl_strlen(dstalpn));
+    Curl_alpn2alpnid(curlx_str(dstalpn), curlx_strlen(dstalpn));
   enum alpnid srcalpnid =
-    Curl_alpn2alpnid(Curl_str(srcalpn), Curl_strlen(srcalpn));
+    Curl_alpn2alpnid(curlx_str(srcalpn), curlx_strlen(srcalpn));
   if(!srcalpnid || !dstalpnid)
     return NULL;
-  return altsvc_createid(Curl_str(srchost), Curl_strlen(srchost),
-                         Curl_str(dsthost), Curl_strlen(dsthost),
+  return altsvc_createid(curlx_str(srchost), curlx_strlen(srchost),
+                         curlx_str(dsthost), curlx_strlen(dsthost),
                          srcalpnid, dstalpnid,
                          srcport, dstport);
 }
@@ -166,24 +166,24 @@ static CURLcode altsvc_add(struct altsvcinfo *asi, const char *line)
   curl_off_t persist;
   curl_off_t prio;
 
-  if(Curl_str_word(&line, &srcalpn, MAX_ALTSVC_ALPNLEN) ||
-     Curl_str_singlespace(&line) ||
-     Curl_str_word(&line, &srchost, MAX_ALTSVC_HOSTLEN) ||
-     Curl_str_singlespace(&line) ||
-     Curl_str_number(&line, &srcport, 65535) ||
-     Curl_str_singlespace(&line) ||
-     Curl_str_word(&line, &dstalpn, MAX_ALTSVC_ALPNLEN) ||
-     Curl_str_singlespace(&line) ||
-     Curl_str_word(&line, &dsthost, MAX_ALTSVC_HOSTLEN) ||
-     Curl_str_singlespace(&line) ||
-     Curl_str_number(&line, &dstport, 65535) ||
-     Curl_str_singlespace(&line) ||
-     Curl_str_quotedword(&line, &date, MAX_ALTSVC_DATELEN) ||
-     Curl_str_singlespace(&line) ||
-     Curl_str_number(&line, &persist, 1) ||
-     Curl_str_singlespace(&line) ||
-     Curl_str_number(&line, &prio, 0) ||
-     Curl_str_newline(&line))
+  if(curlx_str_word(&line, &srcalpn, MAX_ALTSVC_ALPNLEN) ||
+     curlx_str_singlespace(&line) ||
+     curlx_str_word(&line, &srchost, MAX_ALTSVC_HOSTLEN) ||
+     curlx_str_singlespace(&line) ||
+     curlx_str_number(&line, &srcport, 65535) ||
+     curlx_str_singlespace(&line) ||
+     curlx_str_word(&line, &dstalpn, MAX_ALTSVC_ALPNLEN) ||
+     curlx_str_singlespace(&line) ||
+     curlx_str_word(&line, &dsthost, MAX_ALTSVC_HOSTLEN) ||
+     curlx_str_singlespace(&line) ||
+     curlx_str_number(&line, &dstport, 65535) ||
+     curlx_str_singlespace(&line) ||
+     curlx_str_quotedword(&line, &date, MAX_ALTSVC_DATELEN) ||
+     curlx_str_singlespace(&line) ||
+     curlx_str_number(&line, &persist, 1) ||
+     curlx_str_singlespace(&line) ||
+     curlx_str_number(&line, &prio, 0) ||
+     curlx_str_newline(&line))
     ;
   else {
     struct altsvc *as;
@@ -191,9 +191,9 @@ static CURLcode altsvc_add(struct altsvcinfo *asi, const char *line)
     time_t expires;
 
     /* The date parser works on a null terminated string. The maximum length
-       is upheld by Curl_str_quotedword(). */
-    memcpy(dbuf, Curl_str(&date), Curl_strlen(&date));
-    dbuf[Curl_strlen(&date)] = 0;
+       is upheld by curlx_str_quotedword(). */
+    memcpy(dbuf, curlx_str(&date), curlx_strlen(&date));
+    dbuf[curlx_strlen(&date)] = 0;
     expires = Curl_getdate_capped(dbuf);
     as = altsvc_create(&srchost, &dsthost, &srcalpn, &dstalpn,
                        (size_t)srcport, (size_t)dstport);
@@ -231,14 +231,14 @@ static CURLcode altsvc_load(struct altsvcinfo *asi, const char *file)
   fp = fopen(file, FOPEN_READTEXT);
   if(fp) {
     struct dynbuf buf;
-    Curl_dyn_init(&buf, MAX_ALTSVC_LINE);
+    curlx_dyn_init(&buf, MAX_ALTSVC_LINE);
     while(Curl_get_line(&buf, fp)) {
-      const char *lineptr = Curl_dyn_ptr(&buf);
-      Curl_str_passblanks(&lineptr);
-      if(Curl_str_single(&lineptr, '#'))
+      const char *lineptr = curlx_dyn_ptr(&buf);
+      curlx_str_passblanks(&lineptr);
+      if(curlx_str_single(&lineptr, '#'))
         altsvc_add(asi, lineptr);
     }
-    Curl_dyn_free(&buf); /* free the line buffer */
+    curlx_dyn_free(&buf); /* free the line buffer */
     fclose(fp);
   }
   return result;
@@ -447,7 +447,7 @@ static time_t altsvc_debugtime(void *unused)
   (void)unused;
   if(timestr) {
     curl_off_t val;
-    Curl_str_number(&timestr, &val, TIME_T_MAX);
+    curlx_str_number(&timestr, &val, TIME_T_MAX);
     return (time_t)val;
   }
   return time(NULL);
@@ -487,11 +487,11 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
   DEBUGASSERT(asi);
 
   /* initial check for "clear" */
-  if(!Curl_str_until(&p, &alpn, MAX_ALTSVC_LINE, ';') &&
-     !Curl_str_single(&p, ';')) {
-    Curl_str_trimblanks(&alpn);
+  if(!curlx_str_until(&p, &alpn, MAX_ALTSVC_LINE, ';') &&
+     !curlx_str_single(&p, ';')) {
+    curlx_str_trimblanks(&alpn);
     /* "clear" is a magic keyword */
-    if(Curl_str_casecompare(&alpn, "clear")) {
+    if(curlx_str_casecompare(&alpn, "clear")) {
       /* Flush cached alternatives for this source origin */
       altsvc_flush(asi, srcalpnid, srchost, srcport);
       return CURLE_OK;
@@ -500,10 +500,10 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
 
   p = value;
 
-  if(Curl_str_until(&p, &alpn, MAX_ALTSVC_LINE, '='))
+  if(curlx_str_until(&p, &alpn, MAX_ALTSVC_LINE, '='))
     return CURLE_OK; /* strange line */
 
-  Curl_str_trimblanks(&alpn);
+  curlx_str_trimblanks(&alpn);
 
   /* Handle the optional 'ma' and 'persist' flags once first, as they need to
      be known for each alternative service. Unknown flags are skipped. */
@@ -517,69 +517,69 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
       curl_off_t num;
       bool quoted;
       /* allow some extra whitespaces around name and value */
-      if(Curl_str_until(&sp, &name, 20, '=') ||
-         Curl_str_single(&sp, '=') ||
-         Curl_str_until(&sp, &val, 80, ';'))
+      if(curlx_str_until(&sp, &name, 20, '=') ||
+         curlx_str_single(&sp, '=') ||
+         curlx_str_until(&sp, &val, 80, ';'))
         break;
-      Curl_str_trimblanks(&name);
-      Curl_str_trimblanks(&val);
+      curlx_str_trimblanks(&name);
+      curlx_str_trimblanks(&val);
       /* the value might be quoted */
-      vp = Curl_str(&val);
+      vp = curlx_str(&val);
       quoted = (*vp == '\"');
       if(quoted)
         vp++;
-      if(!Curl_str_number(&vp, &num, TIME_T_MAX)) {
-        if(Curl_str_casecompare(&name, "ma"))
+      if(!curlx_str_number(&vp, &num, TIME_T_MAX)) {
+        if(curlx_str_casecompare(&name, "ma"))
           maxage = (time_t)num;
-        else if(Curl_str_casecompare(&name, "persist") && (num == 1))
+        else if(curlx_str_casecompare(&name, "persist") && (num == 1))
           persist = TRUE;
       }
-      if(quoted && Curl_str_single(&sp, '\"'))
+      if(quoted && curlx_str_single(&sp, '\"'))
         break;
-      if(Curl_str_single(&sp, ';'))
+      if(curlx_str_single(&sp, ';'))
         break;
     }
   }
 
   do {
-    if(!Curl_str_single(&p, '=')) {
+    if(!curlx_str_single(&p, '=')) {
       /* [protocol]="[host][:port], [protocol]="[host][:port]" */
       enum alpnid dstalpnid =
-        Curl_alpn2alpnid(Curl_str(&alpn), Curl_strlen(&alpn));
-      if(!Curl_str_single(&p, '\"')) {
+        Curl_alpn2alpnid(curlx_str(&alpn), curlx_strlen(&alpn));
+      if(!curlx_str_single(&p, '\"')) {
         struct Curl_str dsthost;
         curl_off_t port = 0;
-        if(Curl_str_single(&p, ':')) {
+        if(curlx_str_single(&p, ':')) {
           /* hostname starts here */
-          if(Curl_str_single(&p, '[')) {
-            if(Curl_str_until(&p, &dsthost, MAX_ALTSVC_HOSTLEN, ':')) {
+          if(curlx_str_single(&p, '[')) {
+            if(curlx_str_until(&p, &dsthost, MAX_ALTSVC_HOSTLEN, ':')) {
               infof(data, "Bad alt-svc hostname, ignoring.");
               break;
             }
           }
           else {
             /* IPv6 host name */
-            if(Curl_str_until(&p, &dsthost, MAX_IPADR_LEN, ']') ||
-               Curl_str_single(&p, ']')) {
+            if(curlx_str_until(&p, &dsthost, MAX_IPADR_LEN, ']') ||
+               curlx_str_single(&p, ']')) {
               infof(data, "Bad alt-svc IPv6 hostname, ignoring.");
               break;
             }
           }
-          if(Curl_str_single(&p, ':'))
+          if(curlx_str_single(&p, ':'))
             break;
         }
         else
           /* no destination name, use source host */
-          Curl_str_assign(&dsthost, srchost, strlen(srchost));
+          curlx_str_assign(&dsthost, srchost, strlen(srchost));
 
-        if(Curl_str_number(&p, &port, 0xffff)) {
+        if(curlx_str_number(&p, &port, 0xffff)) {
           infof(data, "Unknown alt-svc port number, ignoring.");
           break;
         }
 
         dstport = (unsigned short)port;
 
-        if(Curl_str_single(&p, '\"'))
+        if(curlx_str_single(&p, '\"'))
           break;
 
         if(dstalpnid) {
@@ -589,8 +589,8 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
             altsvc_flush(asi, srcalpnid, srchost, srcport);
 
           as = altsvc_createid(srchost, strlen(srchost),
-                               Curl_str(&dsthost),
-                               Curl_strlen(&dsthost),
+                               curlx_str(&dsthost),
+                               curlx_strlen(&dsthost),
                                srcalpnid, dstalpnid,
                                srcport, dstport);
           if(as) {
@@ -604,7 +604,7 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
             as->persist = persist;
             Curl_llist_append(&asi->list, as, &as->node);
             infof(data, "Added alt-svc: %.*s:%d over %s",
-                  (int)Curl_strlen(&dsthost), Curl_str(&dsthost),
+                  (int)curlx_strlen(&dsthost), curlx_str(&dsthost),
                   dstport, Curl_alpnid2str(dstalpnid));
           }
         }
@@ -614,13 +614,13 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
 
       /* after the double quote there can be a comma if there is another
          string or a semicolon if no more */
-      if(Curl_str_single(&p, ','))
+      if(curlx_str_single(&p, ','))
         break;
 
       /* comma means another alternative is present */
-      if(Curl_str_until(&p, &alpn, MAX_ALTSVC_LINE, '='))
+      if(curlx_str_until(&p, &alpn, MAX_ALTSVC_LINE, '='))
         break;
-      Curl_str_trimblanks(&alpn);
+      curlx_str_trimblanks(&alpn);
     }
     else
       break;
index 63dca25033014a15d71e7276644e4aadc2645d12..4f576c5cb04a24b9d70b7bb3f837530bf471e60e 100644 (file)
@@ -58,7 +58,7 @@
 #include "connect.h"
 #include "select.h"
 #include "progress.h"
-#include "timediff.h"
+#include "curlx/timediff.h"
 #include "httpsrr.h"
 #include "strdup.h"
 
@@ -315,7 +315,7 @@ CURLcode Curl_async_is_resolved(struct Curl_easy *data,
      /* This is only set to non-zero if the timer was started. */
      && (ares->happy_eyeballs_dns_time.tv_sec
          || ares->happy_eyeballs_dns_time.tv_usec)
-     && (Curl_timediff(Curl_now(), ares->happy_eyeballs_dns_time)
+     && (curlx_timediff(curlx_now(), ares->happy_eyeballs_dns_time)
          >= HAPPY_EYEBALLS_DNS_TIMEOUT)) {
     /* Remember that the EXPIRE_HAPPY_EYEBALLS_DNS timer is no longer
        running. */
@@ -385,7 +385,7 @@ CURLcode Curl_async_await(struct Curl_easy *data,
   struct async_ares_ctx *ares = &data->state.async.ares;
   CURLcode result = CURLE_OK;
   timediff_t timeout;
-  struct curltime now = Curl_now();
+  struct curltime now = curlx_now();
 
   DEBUGASSERT(entry);
   *entry = NULL; /* clear on entry */
@@ -434,8 +434,8 @@ CURLcode Curl_async_await(struct Curl_easy *data,
     if(Curl_pgrsUpdate(data))
       result = CURLE_ABORTED_BY_CALLBACK;
     else {
-      struct curltime now2 = Curl_now();
-      timediff_t timediff = Curl_timediff(now2, now); /* spent time */
+      struct curltime now2 = curlx_now();
+      timediff_t timediff = curlx_timediff(now2, now); /* spent time */
       if(timediff <= 0)
         timeout -= 1; /* always deduct at least 1 */
       else if(timediff > timeout)
@@ -581,7 +581,7 @@ static void async_ares_hostbyname_cb(void *user_data,
        timeout to prevent it. After all, we do not even know where in the
        c-ares retry cycle each request is.
     */
-    ares->happy_eyeballs_dns_time = Curl_now();
+    ares->happy_eyeballs_dns_time = curlx_now();
     Curl_expire(data, HAPPY_EYEBALLS_DNS_TIMEOUT,
                 EXPIRE_HAPPY_EYEBALLS_DNS);
   }
index b11cf066d40933e5bd70b444c4f2d0c5017710fc..3e705425f8a6659e0ff37104ad42429cfaa46185 100644 (file)
@@ -431,7 +431,7 @@ static bool async_thrdd_init(struct Curl_easy *data,
   Curl_mutex_acquire(&addr_ctx->mutx);
   DEBUGASSERT(addr_ctx->ref_count == 1);
   /* passing addr_ctx to the thread adds a reference */
-  addr_ctx->start = Curl_now();
+  addr_ctx->start = curlx_now();
   ++addr_ctx->ref_count;
 #ifdef HAVE_GETADDRINFO
   addr_ctx->thread_hnd = Curl_thread_create(getaddrinfo_thread, addr_ctx);
@@ -616,7 +616,7 @@ CURLcode Curl_async_is_resolved(struct Curl_easy *data,
   else {
     /* poll for name lookup done with exponential backoff up to 250ms */
     /* should be fine even if this converts to 32-bit */
-    timediff_t elapsed = Curl_timediff(Curl_now(),
+    timediff_t elapsed = curlx_timediff(curlx_now(),
                                        data->progress.t_startsingle);
     if(elapsed < 0)
       elapsed = 0;
@@ -669,7 +669,7 @@ int Curl_async_getsock(struct Curl_easy *data, curl_socket_t *socks)
 #endif
   {
     timediff_t milli;
-    timediff_t ms = Curl_timediff(Curl_now(), thrdd->addr->start);
+    timediff_t ms = curlx_timediff(curlx_now(), thrdd->addr->start);
     if(ms < 3)
       milli = 0;
     else if(ms <= 50)
index 3be85cd253bf029d63769247cf8c58be9a56f9f8..df6f575454a27f8babce4392cd8d85211ccecd4d 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <curl/curl.h>
 #include "urldata.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 #include "sendf.h"
 #include "http.h"
 #include "http1.h"
 #include "cf-h1-proxy.h"
 #include "connect.h"
 #include "curl_trc.h"
-#include "curlx.h"
+#include "strcase.h"
 #include "vtls/vtls.h"
 #include "transfer.h"
 #include "multiif.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -97,8 +97,8 @@ static CURLcode tunnel_reinit(struct Curl_cfilter *cf,
   (void)data;
   (void)cf;
   DEBUGASSERT(ts);
-  Curl_dyn_reset(&ts->rcvbuf);
-  Curl_dyn_reset(&ts->request_data);
+  curlx_dyn_reset(&ts->rcvbuf);
+  curlx_dyn_reset(&ts->request_data);
   ts->tunnel_state = H1_TUNNEL_INIT;
   ts->keepon = KEEPON_CONNECT;
   ts->cl = 0;
@@ -123,8 +123,8 @@ static CURLcode tunnel_init(struct Curl_cfilter *cf,
 
   infof(data, "allocate connect buffer");
 
-  Curl_dyn_init(&ts->rcvbuf, DYN_PROXY_CONNECT_HEADERS);
-  Curl_dyn_init(&ts->request_data, DYN_HTTP_REQUEST);
+  curlx_dyn_init(&ts->rcvbuf, DYN_PROXY_CONNECT_HEADERS);
+  curlx_dyn_init(&ts->request_data, DYN_HTTP_REQUEST);
   Curl_httpchunk_init(data, &ts->ch, TRUE);
 
   *pts =  ts;
@@ -150,7 +150,7 @@ static void h1_tunnel_go_state(struct Curl_cfilter *cf,
     CURL_TRC_CF(data, cf, "new tunnel state 'connect'");
     ts->tunnel_state = H1_TUNNEL_CONNECT;
     ts->keepon = KEEPON_CONNECT;
-    Curl_dyn_reset(&ts->rcvbuf);
+    curlx_dyn_reset(&ts->rcvbuf);
     break;
 
   case H1_TUNNEL_RECEIVE:
@@ -173,8 +173,8 @@ static void h1_tunnel_go_state(struct Curl_cfilter *cf,
     if(new_state == H1_TUNNEL_FAILED)
       CURL_TRC_CF(data, cf, "new tunnel state 'failed'");
     ts->tunnel_state = new_state;
-    Curl_dyn_reset(&ts->rcvbuf);
-    Curl_dyn_reset(&ts->request_data);
+    curlx_dyn_reset(&ts->rcvbuf);
+    curlx_dyn_reset(&ts->request_data);
     /* restore the protocol pointer */
     data->info.httpcode = 0; /* clear it as it might've been used for the
                                 proxy */
@@ -193,8 +193,8 @@ static void tunnel_free(struct Curl_cfilter *cf,
     struct h1_tunnel_state *ts = cf->ctx;
     if(ts) {
       h1_tunnel_go_state(cf, ts, H1_TUNNEL_FAILED, data);
-      Curl_dyn_free(&ts->rcvbuf);
-      Curl_dyn_free(&ts->request_data);
+      curlx_dyn_free(&ts->rcvbuf);
+      curlx_dyn_free(&ts->request_data);
       Curl_httpchunk_free(data, &ts->ch);
       free(ts);
       cf->ctx = NULL;
@@ -226,7 +226,7 @@ static CURLcode start_CONNECT(struct Curl_cfilter *cf,
 
   infof(data, "Establish HTTP proxy tunnel to %s", req->authority);
 
-  Curl_dyn_reset(&ts->request_data);
+  curlx_dyn_reset(&ts->request_data);
   ts->nsent = 0;
   ts->headerlines = 0;
   http_minor = (cf->conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0) ? 0 : 1;
@@ -248,8 +248,8 @@ static CURLcode send_CONNECT(struct Curl_cfilter *cf,
                              struct h1_tunnel_state *ts,
                              bool *done)
 {
-  char *buf = Curl_dyn_ptr(&ts->request_data);
-  size_t request_len = Curl_dyn_len(&ts->request_data);
+  char *buf = curlx_dyn_ptr(&ts->request_data);
+  size_t request_len = curlx_dyn_len(&ts->request_data);
   size_t blen = request_len;
   CURLcode result = CURLE_OK;
   ssize_t nwritten;
@@ -316,7 +316,7 @@ static CURLcode on_resp_header(struct Curl_cfilter *cf,
     }
     else {
       const char *p = header + strlen("Content-Length:");
-      if(Curl_str_numblanks(&p, &ts->cl)) {
+      if(curlx_str_numblanks(&p, &ts->cl)) {
         failf(data, "Unsupported Content-Length value");
         return CURLE_WEIRD_SERVER_REPLY;
       }
@@ -444,7 +444,7 @@ static CURLcode recv_CONNECT_resp(struct Curl_cfilter *cf,
       continue;
     }
 
-    if(Curl_dyn_addn(&ts->rcvbuf, &byte, 1)) {
+    if(curlx_dyn_addn(&ts->rcvbuf, &byte, 1)) {
       failf(data, "CONNECT response too large");
       return CURLE_RECV_ERROR;
     }
@@ -454,8 +454,8 @@ static CURLcode recv_CONNECT_resp(struct Curl_cfilter *cf,
       continue;
 
     ts->headerlines++;
-    linep = Curl_dyn_ptr(&ts->rcvbuf);
-    line_len = Curl_dyn_len(&ts->rcvbuf); /* amount of bytes in this line */
+    linep = curlx_dyn_ptr(&ts->rcvbuf);
+    line_len = curlx_dyn_len(&ts->rcvbuf); /* amount of bytes in this line */
 
     /* output debug if that is requested */
     Curl_debug(data, CURLINFO_HEADER_IN, linep, line_len);
@@ -512,7 +512,7 @@ static CURLcode recv_CONNECT_resp(struct Curl_cfilter *cf,
     if(result)
       return result;
 
-    Curl_dyn_reset(&ts->rcvbuf);
+    curlx_dyn_reset(&ts->rcvbuf);
   } /* while there is buffer left and loop is requested */
 
   if(error)
index fbff37992e089b7f73df6aec4e0c36848f1c03fa..d3bc4b07680e47961f86f127c608653f07edeeae 100644 (file)
@@ -32,7 +32,7 @@
 #include "connect.h"
 #include "curl_trc.h"
 #include "bufq.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 #include "dynhds.h"
 #include "http1.h"
 #include "http2.h"
index 10d54f44561936940b29bd4c5a209f8f6ae7dadc..7bc12dbbb15e1f483277f8a348845e3a7478babc 100644 (file)
@@ -54,13 +54,13 @@ static void cf_haproxy_ctx_reset(struct cf_haproxy_ctx *ctx)
 {
   DEBUGASSERT(ctx);
   ctx->state = HAPROXY_INIT;
-  Curl_dyn_reset(&ctx->data_out);
+  curlx_dyn_reset(&ctx->data_out);
 }
 
 static void cf_haproxy_ctx_free(struct cf_haproxy_ctx *ctx)
 {
   if(ctx) {
-    Curl_dyn_free(&ctx->data_out);
+    curlx_dyn_free(&ctx->data_out);
     free(ctx);
   }
 }
@@ -79,7 +79,7 @@ static CURLcode cf_haproxy_date_out_set(struct Curl_cfilter*cf,
 #ifdef USE_UNIX_SOCKETS
   if(cf->conn->unix_domain_socket)
     /* the buffer is large enough to hold this! */
-    result = Curl_dyn_addn(&ctx->data_out, STRCONST("PROXY UNKNOWN\r\n"));
+    result = curlx_dyn_addn(&ctx->data_out, STRCONST("PROXY UNKNOWN\r\n"));
   else {
 #endif /* USE_UNIX_SOCKETS */
   result = Curl_conn_cf_get_ip_info(cf->next, data, &is_ipv6, &ipquad);
@@ -92,10 +92,10 @@ static CURLcode cf_haproxy_date_out_set(struct Curl_cfilter*cf,
   else
     client_ip = ipquad.local_ip;
 
-  result = Curl_dyn_addf(&ctx->data_out, "PROXY %s %s %s %i %i\r\n",
-                         is_ipv6 ? "TCP6" : "TCP4",
-                         client_ip, ipquad.remote_ip,
-                         ipquad.local_port, ipquad.remote_port);
+  result = curlx_dyn_addf(&ctx->data_out, "PROXY %s %s %s %i %i\r\n",
+                          is_ipv6 ? "TCP6" : "TCP4",
+                          client_ip, ipquad.remote_ip,
+                          ipquad.local_port, ipquad.remote_port);
 
 #ifdef USE_UNIX_SOCKETS
   }
@@ -129,11 +129,11 @@ static CURLcode cf_haproxy_connect(struct Curl_cfilter *cf,
     ctx->state = HAPROXY_SEND;
     FALLTHROUGH();
   case HAPROXY_SEND:
-    len = Curl_dyn_len(&ctx->data_out);
+    len = curlx_dyn_len(&ctx->data_out);
     if(len > 0) {
       ssize_t nwritten;
       nwritten = Curl_conn_cf_send(cf->next, data,
-                                   Curl_dyn_ptr(&ctx->data_out), len, FALSE,
+                                   curlx_dyn_ptr(&ctx->data_out), len, FALSE,
                                    &result);
       if(nwritten < 0) {
         if(result != CURLE_AGAIN)
@@ -141,8 +141,8 @@ static CURLcode cf_haproxy_connect(struct Curl_cfilter *cf,
         result = CURLE_OK;
         nwritten = 0;
       }
-      Curl_dyn_tail(&ctx->data_out, len - (size_t)nwritten);
-      if(Curl_dyn_len(&ctx->data_out) > 0) {
+      curlx_dyn_tail(&ctx->data_out, len - (size_t)nwritten);
+      if(curlx_dyn_len(&ctx->data_out) > 0) {
         result = CURLE_OK;
         goto out;
       }
@@ -150,7 +150,7 @@ static CURLcode cf_haproxy_connect(struct Curl_cfilter *cf,
     ctx->state = HAPROXY_DONE;
     FALLTHROUGH();
   default:
-    Curl_dyn_free(&ctx->data_out);
+    curlx_dyn_free(&ctx->data_out);
     break;
   }
 
@@ -222,7 +222,7 @@ static CURLcode cf_haproxy_create(struct Curl_cfilter **pcf,
     goto out;
   }
   ctx->state = HAPROXY_INIT;
-  Curl_dyn_init(&ctx->data_out, DYN_HAXPROXY);
+  curlx_dyn_init(&ctx->data_out, DYN_HAXPROXY);
 
   result = Curl_cf_create(&cf, &Curl_cft_haproxy, ctx);
   if(result)
index 77507bcc4cb5684e232f236c9b2d487853d09a29..53dae9900d559d6062e8d2fa7ca069818e3509e3 100644 (file)
@@ -151,7 +151,7 @@ static void cf_hc_baller_init(struct cf_hc_baller *b,
   struct Curl_cfilter *save = cf->next;
 
   cf->next = NULL;
-  b->started = Curl_now();
+  b->started = curlx_now();
   switch(b->alpn_id) {
   case ALPN_h3:
     transport = TRNSPRT_QUIC;
@@ -213,11 +213,12 @@ static CURLcode baller_connected(struct Curl_cfilter *cf,
   reply_ms = cf_hc_baller_reply_ms(winner, data);
   if(reply_ms >= 0)
     CURL_TRC_CF(data, cf, "connect+handshake %s: %dms, 1st data: %dms",
-                winner->name, (int)Curl_timediff(Curl_now(), winner->started),
-                reply_ms);
+                winner->name, (int)curlx_timediff(curlx_now(),
+                                                  winner->started), reply_ms);
   else
     CURL_TRC_CF(data, cf, "deferred handshake %s: %dms",
-                winner->name, (int)Curl_timediff(Curl_now(), winner->started));
+                winner->name, (int)curlx_timediff(curlx_now(),
+                                                  winner->started));
 
   cf->next = winner->cf;
   winner->cf = NULL;
@@ -267,7 +268,7 @@ static bool time_to_start_next(struct Curl_cfilter *cf,
                 ctx->ballers[idx].name);
     return TRUE;
   }
-  elapsed_ms = Curl_timediff(now, ctx->started);
+  elapsed_ms = curlx_timediff(now, ctx->started);
   if(elapsed_ms >= ctx->hard_eyeballs_timeout_ms) {
     CURL_TRC_CF(data, cf, "hard timeout of %dms reached, starting %s",
                 ctx->hard_eyeballs_timeout_ms, ctx->ballers[idx].name);
@@ -304,7 +305,7 @@ static CURLcode cf_hc_connect(struct Curl_cfilter *cf,
   }
 
   *done = FALSE;
-  now = Curl_now();
+  now = curlx_now();
   switch(ctx->state) {
   case CF_HC_INIT:
     DEBUGASSERT(!cf->next);
@@ -469,7 +470,7 @@ static struct curltime cf_get_max_baller_time(struct Curl_cfilter *cf,
     struct Curl_cfilter *cfb = ctx->ballers[i].cf;
     memset(&t, 0, sizeof(t));
     if(cfb && !cfb->cft->query(cfb, data, query, NULL, &t)) {
-      if((t.tv_sec || t.tv_usec) && Curl_timediff_us(t, tmax) > 0)
+      if((t.tv_sec || t.tv_usec) && curlx_timediff_us(t, tmax) > 0)
         tmax = t;
     }
   }
index 43a80ee448acdbd98033300619ba3cc02550d478..67f182f3b9fdc46d2f1b7e0ecff071d2471d027c 100644 (file)
@@ -76,7 +76,7 @@
 #include "inet_ntop.h"
 #include "inet_pton.h"
 #include "progress.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "conncache.h"
 #include "multihandle.h"
 #include "rand.h"
@@ -84,7 +84,7 @@
 #include "strdup.h"
 #include "system_win32.h"
 #include "version_win32.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -724,7 +724,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
                IDs and the former returns none at all. So the scope ID, if
                present, is known to be numeric */
             curl_off_t scope_id;
-            if(Curl_str_number((const char **)CURL_UNCONST(&scope_ptr),
+            if(curlx_str_number((const char **)CURL_UNCONST(&scope_ptr),
                                &scope_id, UINT_MAX))
               return CURLE_UNSUPPORTED_PROTOCOL;
             si6->sin6_scope_id = (unsigned int)scope_id;
@@ -959,25 +959,25 @@ static CURLcode cf_socket_ctx_init(struct cf_socket_ctx *ctx,
     const char *p = getenv("CURL_DBG_SOCK_WBLOCK");
     if(p) {
       curl_off_t l;
-      if(!Curl_str_number(&p, &l, 100))
+      if(!curlx_str_number(&p, &l, 100))
         ctx->wblock_percent = (int)l;
     }
     p = getenv("CURL_DBG_SOCK_WPARTIAL");
     if(p) {
       curl_off_t l;
-      if(!Curl_str_number(&p, &l, 100))
+      if(!curlx_str_number(&p, &l, 100))
         ctx->wpartial_percent = (int)l;
     }
     p = getenv("CURL_DBG_SOCK_RBLOCK");
     if(p) {
       curl_off_t l;
-      if(!Curl_str_number(&p, &l, 100))
+      if(!curlx_str_number(&p, &l, 100))
         ctx->rblock_percent = (int)l;
     }
     p = getenv("CURL_DBG_SOCK_RMAX");
     if(p) {
       curl_off_t l;
-      if(!Curl_str_number(&p, &l, CURL_OFF_T_MAX))
+      if(!curlx_str_number(&p, &l, CURL_OFF_T_MAX))
         ctx->recv_max = (size_t)l;
     }
   }
@@ -1105,7 +1105,7 @@ static CURLcode cf_socket_open(struct Curl_cfilter *cf,
 
   (void)data;
   DEBUGASSERT(ctx->sock == CURL_SOCKET_BAD);
-  ctx->started_at = Curl_now();
+  ctx->started_at = curlx_now();
 #ifdef SOCK_NONBLOCK
   /* Do not tuck SOCK_NONBLOCK into socktype when opensocket callback is set
    * because we would not know how socketype is about to be used in the
@@ -1221,7 +1221,7 @@ out:
   }
   else if(isconnected) {
     set_local_ip(cf, data);
-    ctx->connected_at = Curl_now();
+    ctx->connected_at = curlx_now();
     cf->connected = TRUE;
   }
   CURL_TRC_CF(data, cf, "cf_socket_open() -> %d, fd=%" FMT_SOCKET_T,
@@ -1340,7 +1340,7 @@ static CURLcode cf_tcp_connect(struct Curl_cfilter *cf,
   else if(rc == CURL_CSELECT_OUT || cf->conn->bits.tcp_fastopen) {
     if(verifyconnect(ctx->sock, &ctx->error)) {
       /* we are connected with TCP, awesome! */
-      ctx->connected_at = Curl_now();
+      ctx->connected_at = curlx_now();
       set_local_ip(cf, data);
       *done = TRUE;
       cf->connected = TRUE;
@@ -1441,9 +1441,9 @@ static void win_update_sndbuf_size(struct cf_socket_ctx *ctx)
 {
   ULONG ideal;
   DWORD ideallen;
-  struct curltime n = Curl_now();
+  struct curltime n = curlx_now();
 
-  if(Curl_timediff(n, ctx->last_sndbuf_query_at) > 1000) {
+  if(curlx_timediff(n, ctx->last_sndbuf_query_at) > 1000) {
     if(!WSAIoctl(ctx->sock, SIO_IDEAL_SEND_BACKLOG_QUERY, 0, 0,
                   &ideal, sizeof(ideal), &ideallen, 0, 0) &&
        ideal != ctx->sndbuf_size &&
@@ -1604,7 +1604,7 @@ static ssize_t cf_socket_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
   CURL_TRC_CF(data, cf, "recv(len=%zu) -> %d, err=%d", len, (int)nread,
               *err);
   if(nread > 0 && !ctx->got_first_byte) {
-    ctx->first_byte_at = Curl_now();
+    ctx->first_byte_at = curlx_now();
     ctx->got_first_byte = TRUE;
   }
   return nread;
@@ -1715,7 +1715,7 @@ static CURLcode cf_socket_query(struct Curl_cfilter *cf,
     return CURLE_OK;
   case CF_QUERY_CONNECT_REPLY_MS:
     if(ctx->got_first_byte) {
-      timediff_t ms = Curl_timediff(ctx->first_byte_at, ctx->started_at);
+      timediff_t ms = curlx_timediff(ctx->first_byte_at, ctx->started_at);
       *pres1 = (ms < INT_MAX) ? (int)ms : INT_MAX;
     }
     else
@@ -2032,7 +2032,7 @@ static timediff_t cf_tcp_accept_timeleft(struct Curl_cfilter *cf,
     timeout_ms = data->set.accepttimeout;
 #endif
 
-  now = Curl_now();
+  now = curlx_now();
   /* check if the generic timeout possibly is set shorter */
   other = Curl_timeleft(data, &now, FALSE);
   if(other && (other < timeout_ms))
@@ -2041,7 +2041,7 @@ static timediff_t cf_tcp_accept_timeleft(struct Curl_cfilter *cf,
     timeout_ms = other;
   else {
     /* subtract elapsed time */
-    timeout_ms -= Curl_timediff(now, ctx->started_at);
+    timeout_ms -= curlx_timediff(now, ctx->started_at);
     if(!timeout_ms)
       /* avoid returning 0 as that means no timeout! */
       timeout_ms = -1;
@@ -2164,7 +2164,7 @@ static CURLcode cf_tcp_accept_connect(struct Curl_cfilter *cf,
   cf_tcp_set_accepted_remote_ip(cf, data);
   set_local_ip(cf, data);
   ctx->active = TRUE;
-  ctx->connected_at = Curl_now();
+  ctx->connected_at = curlx_now();
   cf->connected = TRUE;
   CURL_TRC_CF(data, cf, "accepted_set(sock=%" FMT_SOCKET_T
               ", remote=%s port=%d)",
@@ -2231,7 +2231,7 @@ CURLcode Curl_conn_tcp_listen_set(struct Curl_easy *data,
     goto out;
   Curl_conn_cf_add(data, conn, sockindex, cf);
 
-  ctx->started_at = Curl_now();
+  ctx->started_at = curlx_now();
   conn->sock[sockindex] = ctx->sock;
   set_local_ip(cf, data);
   CURL_TRC_CF(data, cf, "set filter for listen socket fd=%" FMT_SOCKET_T
index 291bdfa4d9f5dc63df8640375aea43e6a7d4245d..a9de86a462610ef4166359402470867e8e0c9897 100644 (file)
@@ -34,8 +34,8 @@
 #include "multiif.h"
 #include "progress.h"
 #include "select.h"
-#include "warnless.h"
-#include "strparse.h"
+#include "curlx/warnless.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -198,7 +198,7 @@ CURLcode Curl_conn_shutdown(struct Curl_easy *data, int sockindex, bool *done)
   }
 
   *done = FALSE;
-  now = Curl_now();
+  now = curlx_now();
   if(!Curl_shutdown_started(data, sockindex)) {
     CURL_TRC_M(data, "shutdown start on%s connection",
                sockindex ? " secondary" : "");
@@ -442,7 +442,7 @@ CURLcode Curl_conn_connect(struct Curl_easy *data,
        * socket and ip related information. */
       cf_cntrl_update_info(data, data->conn);
       conn_report_connect_stats(data, data->conn);
-      data->conn->keepalive = Curl_now();
+      data->conn->keepalive = curlx_now();
       Curl_verboseconnect(data, data->conn, sockindex);
       goto out;
     }
@@ -941,7 +941,7 @@ CURLcode Curl_conn_send(struct Curl_easy *data, int sockindex,
     const char *p = getenv("CURL_SMALLSENDS");
     if(p) {
       curl_off_t altsize;
-      if(!Curl_str_number(&p, &altsize, write_len))
+      if(!curlx_str_number(&p, &altsize, write_len))
         write_len = (size_t)altsize;
     }
   }
index 86b2a383f4a4e05a5a357fa9299e6eee63a904ef..646aabf37d0bfaba743c2db7af85843d646b3d99 100644 (file)
@@ -24,7 +24,7 @@
  *
  ***************************************************************************/
 
-#include "timediff.h"
+#include "curlx/timediff.h"
 
 struct Curl_cfilter;
 struct Curl_easy;
index d2b4dbccc643b369ef5f7197236a7f2a40fcecf0..f5e2ea8725264aafec74d68e3144814a6ea935e4 100644 (file)
@@ -43,7 +43,7 @@
 #include "connect.h"
 #include "select.h"
 #include "strcase.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 #include "uint-table.h"
 
 /* The last 3 #include files should be in this order */
@@ -139,7 +139,7 @@ void Curl_cpool_init(struct cpool *cpool,
                      size_t size)
 {
   Curl_hash_init(&cpool->dest2bundle, size, Curl_hash_str,
-                 Curl_str_key_compare, cpool_bundle_free_entry);
+                 curlx_str_key_compare, cpool_bundle_free_entry);
 
   DEBUGASSERT(idata);
 
@@ -294,14 +294,14 @@ cpool_bundle_get_oldest_idle(struct cpool_bundle *bundle)
   struct connectdata *oldest_idle = NULL;
   struct connectdata *conn;
 
-  now = Curl_now();
+  now = curlx_now();
   curr = Curl_llist_head(&bundle->conns);
   while(curr) {
     conn = Curl_node_elem(curr);
 
     if(!CONN_INUSE(conn)) {
       /* Set higher score for the age passed since the connection was used */
-      score = Curl_timediff(now, conn->lastused);
+      score = curlx_timediff(now, conn->lastused);
 
       if(score > highscore) {
         highscore = score;
@@ -324,7 +324,7 @@ static struct connectdata *cpool_get_oldest_idle(struct cpool *cpool)
   timediff_t highscore =- 1;
   timediff_t score;
 
-  now = Curl_now();
+  now = curlx_now();
   Curl_hash_start_iterate(&cpool->dest2bundle, &iter);
 
   for(he = Curl_hash_next_element(&iter); he;
@@ -338,7 +338,7 @@ static struct connectdata *cpool_get_oldest_idle(struct cpool *cpool)
       if(CONN_INUSE(conn) || conn->bits.close || conn->connect_only)
         continue;
       /* Set higher score for the age passed since the connection was used */
-      score = Curl_timediff(now, conn->lastused);
+      score = curlx_timediff(now, conn->lastused);
       if(score > highscore) {
         highscore = score;
         oldest_idle = conn;
@@ -539,7 +539,7 @@ bool Curl_cpool_conn_now_idle(struct Curl_easy *data,
   struct cpool *cpool = cpool_get_instance(data);
   bool kept = TRUE;
 
-  conn->lastused = Curl_now(); /* it was used up until now */
+  conn->lastused = curlx_now(); /* it was used up until now */
   if(cpool && maxconnects) {
     /* may be called form a callback already under lock */
     bool do_lock = !CPOOL_IS_LOCKED(cpool);
@@ -734,9 +734,9 @@ void Curl_cpool_prune_dead(struct Curl_easy *data)
   if(!cpool)
     return;
 
-  rctx.now = Curl_now();
+  rctx.now = curlx_now();
   CPOOL_LOCK(cpool, data);
-  elapsed = Curl_timediff(rctx.now, cpool->last_cleanup);
+  elapsed = curlx_timediff(rctx.now, cpool->last_cleanup);
 
   if(elapsed >= 1000L) {
     while(cpool_foreach(data, cpool, &rctx, cpool_reap_dead_cb))
@@ -758,7 +758,7 @@ static int conn_upkeep(struct Curl_easy *data,
 CURLcode Curl_cpool_upkeep(void *data)
 {
   struct cpool *cpool = cpool_get_instance(data);
-  struct curltime now = Curl_now();
+  struct curltime now = curlx_now();
 
   if(!cpool)
     return CURLE_OK;
index bafcc58165e965c840778fff114819cafd1802c8..1314b65c60763c0a9061242dd435063b74445e32 100644 (file)
@@ -26,7 +26,7 @@
  ***************************************************************************/
 
 #include <curl/curl.h>
-#include "timeval.h"
+#include "curlx/timeval.h"
 
 struct connectdata;
 struct Curl_easy;
index a257b656a8695273fa3217be9c7c50b43eb3643e..deb3cdf0dbdcda44979b049d1029e2be03a507e3 100644 (file)
@@ -70,7 +70,7 @@
 #include "inet_pton.h"
 #include "vtls/vtls.h" /* for vtsl cfilters */
 #include "progress.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "conncache.h"
 #include "multihandle.h"
 #include "share.h"
@@ -112,7 +112,7 @@ enum alpnid Curl_alpn2alpnid(const char *name, size_t len)
  * infinite time left). If the value is negative, the timeout time has already
  * elapsed.
  * @param data the transfer to check on
- * @param nowp timestamp to use for calculation, NULL to use Curl_now()
+ * @param nowp timestamp to use for calculation, NULL to use curlx_now()
  * @param duringconnect TRUE iff connect timeout is also taken into account.
  * @unittest: 1303
  */
@@ -133,13 +133,13 @@ timediff_t Curl_timeleft(struct Curl_easy *data,
     return 0; /* no timeout in place or checked, return "no limit" */
 
   if(!nowp) {
-    now = Curl_now();
+    now = curlx_now();
     nowp = &now;
   }
 
   if(data->set.timeout > 0) {
     timeleft_ms = data->set.timeout -
-                  Curl_timediff(*nowp, data->progress.t_startop);
+                  curlx_timediff(*nowp, data->progress.t_startop);
     if(!timeleft_ms)
       timeleft_ms = -1; /* 0 is "no limit", fake 1 ms expiry */
     if(!duringconnect)
@@ -150,7 +150,7 @@ timediff_t Curl_timeleft(struct Curl_easy *data,
     timediff_t ctimeout_ms = (data->set.connecttimeout > 0) ?
       data->set.connecttimeout : DEFAULT_CONNECT_TIMEOUT;
     ctimeleft_ms = ctimeout_ms -
-                   Curl_timediff(*nowp, data->progress.t_startsingle);
+                   curlx_timediff(*nowp, data->progress.t_startsingle);
     if(!ctimeleft_ms)
       ctimeleft_ms = -1; /* 0 is "no limit", fake 1 ms expiry */
     if(!timeleft_ms)
@@ -167,7 +167,7 @@ void Curl_shutdown_start(struct Curl_easy *data, int sockindex,
 
   DEBUGASSERT(data->conn);
   if(!nowp) {
-    now = Curl_now();
+    now = curlx_now();
     nowp = &now;
   }
   data->conn->shutdown.start[sockindex] = *nowp;
@@ -191,11 +191,11 @@ timediff_t Curl_shutdown_timeleft(struct connectdata *conn, int sockindex,
     return 0; /* not started or no limits */
 
   if(!nowp) {
-    now = Curl_now();
+    now = curlx_now();
     nowp = &now;
   }
   left_ms = conn->shutdown.timeout_ms -
-            Curl_timediff(*nowp, conn->shutdown.start[sockindex]);
+            curlx_timediff(*nowp, conn->shutdown.start[sockindex]);
   return left_ms ? left_ms : -1;
 }
 
@@ -210,7 +210,7 @@ timediff_t Curl_conn_shutdown_timeleft(struct connectdata *conn,
     if(!conn->shutdown.start[i].tv_sec)
       continue;
     if(!nowp) {
-      now = Curl_now();
+      now = curlx_now();
       nowp = &now;
     }
     ms = Curl_shutdown_timeleft(conn, i, nowp);
@@ -547,7 +547,7 @@ static CURLcode baller_start(struct Curl_cfilter *cf,
   baller->has_started = TRUE;
 
   while(baller->addr) {
-    baller->started = Curl_now();
+    baller->started = curlx_now();
     baller->timeoutms = addr_next_match(baller->addr, baller->ai_family) ?
       USETIME(timeoutms) : timeoutms;
     baller_initiate(cf, data, baller);
@@ -606,7 +606,7 @@ static CURLcode baller_connect(struct Curl_cfilter *cf,
         baller->connected = TRUE;
         baller->is_done = TRUE;
       }
-      else if(Curl_timediff(*now, baller->started) >= baller->timeoutms) {
+      else if(curlx_timediff(*now, baller->started) >= baller->timeoutms) {
         infof(data, "%s connect timeout after %" FMT_TIMEDIFF_T
               "ms, move on!", baller->name, baller->timeoutms);
 #ifdef SOCKETIMEDOUT
@@ -644,7 +644,7 @@ static CURLcode is_connected(struct Curl_cfilter *cf,
    * cot ballers in a QUIC appropriate way. */
 evaluate:
   *connected = FALSE; /* a negative world view is best */
-  now = Curl_now();
+  now = curlx_now();
   ongoing = not_started = 0;
   for(i = 0; i < CURL_ARRAYSIZE(ctx->baller); i++) {
     struct eyeballer *baller = ctx->baller[i];
@@ -699,7 +699,7 @@ evaluate:
    * start new ballers or return ok. */
   if((ongoing || not_started) && Curl_timeleft(data, &now, TRUE) < 0) {
     failf(data, "Connection timeout after %" FMT_OFF_T " ms",
-          Curl_timediff(now, data->progress.t_startsingle));
+          curlx_timediff(now, data->progress.t_startsingle));
     return CURLE_OPERATION_TIMEDOUT;
   }
 
@@ -715,7 +715,7 @@ evaluate:
       /* We start its primary baller has failed to connect or if
        * its start delay_ms have expired */
       if((baller->primary && baller->primary->is_done) ||
-          Curl_timediff(now, ctx->started) >= baller->delay_ms) {
+          curlx_timediff(now, ctx->started) >= baller->delay_ms) {
         baller_start(cf, data, baller, Curl_timeleft(data, &now, TRUE));
         if(baller->is_done) {
           CURL_TRC_CF(data, cf, "%s done", baller->name);
@@ -768,7 +768,7 @@ evaluate:
   failf(data, "Failed to connect to %s port %u after "
         "%" FMT_TIMEDIFF_T " ms: %s",
         hostname, conn->primary.remote_port,
-        Curl_timediff(now, data->progress.t_startsingle),
+        curlx_timediff(now, data->progress.t_startsingle),
         curl_easy_strerror(result));
 
 #ifdef SOCKETIMEDOUT
@@ -800,7 +800,7 @@ static CURLcode start_connect(struct Curl_cfilter *cf,
     return CURLE_OPERATION_TIMEDOUT;
   }
 
-  ctx->started = Curl_now();
+  ctx->started = curlx_now();
 
   /* remotehost->addr is the list of addresses from the resolver, each
    * with an address family. The list has at least one entry, possibly
@@ -1060,7 +1060,7 @@ static struct curltime get_max_baller_time(struct Curl_cfilter *cf,
     memset(&t, 0, sizeof(t));
     if(baller && baller->cf &&
        !baller->cf->cft->query(baller->cf, data, query, NULL, &t)) {
-      if((t.tv_sec || t.tv_usec) && Curl_timediff_us(t, tmax) > 0)
+      if((t.tv_sec || t.tv_usec) && curlx_timediff_us(t, tmax) > 0)
         tmax = t;
     }
   }
index 6a6d6d50df667ff7d187bcb51bb22940218a9664..0e4886809a0dd89832fc8d1bba7e8b0c9406a7a2 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "nonblock.h" /* for curlx_nonblock(), formerly Curl_nonblock() */
 #include "sockaddr.h"
-#include "timeval.h"
+#include "curlx/timeval.h"
 
 struct Curl_dns_entry;
 struct ip_quadruple;
index 519b52a8d3bed999f82c99fc2bf2d09e1fee9b64..1a8426ca27f14a1f9f1bc51a83ae7a6eabf1bdc8 100644 (file)
@@ -87,7 +87,7 @@ Example set of cookies:
 #include "fopen.h"
 #include "strdup.h"
 #include "llist.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -497,25 +497,25 @@ parse_cookie_header(struct Curl_easy *data,
     struct Curl_str val;
 
     /* we have a <name>=<value> pair or a stand-alone word here */
-    if(!Curl_str_cspn(&ptr, &name, ";\t\r\n=")) {
+    if(!curlx_str_cspn(&ptr, &name, ";\t\r\n=")) {
       bool done = FALSE;
       bool sep = FALSE;
-      Curl_str_trimblanks(&name);
+      curlx_str_trimblanks(&name);
 
-      if(!Curl_str_single(&ptr, '=')) {
+      if(!curlx_str_single(&ptr, '=')) {
         sep = TRUE; /* a '=' was used */
-        if(!Curl_str_cspn(&ptr, &val, ";\r\n")) {
-          Curl_str_trimblanks(&val);
+        if(!curlx_str_cspn(&ptr, &val, ";\r\n")) {
+          curlx_str_trimblanks(&val);
 
           /* Reject cookies with a TAB inside the value */
-          if(memchr(Curl_str(&val), '\t', Curl_strlen(&val))) {
+          if(memchr(curlx_str(&val), '\t', curlx_strlen(&val))) {
             infof(data, "cookie contains TAB, dropping");
             return CERR_TAB;
           }
         }
       }
       else {
-        Curl_str_init(&val);
+        curlx_str_init(&val);
       }
 
       /*
@@ -523,11 +523,11 @@ parse_cookie_header(struct Curl_easy *data,
        * combination of name + contents. Chrome and Firefox support 4095 or
        * 4096 bytes combo
        */
-      if(Curl_strlen(&name) >= (MAX_NAME-1) ||
-         Curl_strlen(&val) >= (MAX_NAME-1) ||
-         ((Curl_strlen(&name) + Curl_strlen(&val)) > MAX_NAME)) {
+      if(curlx_strlen(&name) >= (MAX_NAME-1) ||
+         curlx_strlen(&val) >= (MAX_NAME-1) ||
+         ((curlx_strlen(&name) + curlx_strlen(&val)) > MAX_NAME)) {
         infof(data, "oversized cookie dropped, name/val %zu + %zu bytes",
-              Curl_strlen(&name), Curl_strlen(&val));
+              curlx_strlen(&name), curlx_strlen(&val));
         return CERR_TOO_BIG;
       }
 
@@ -537,9 +537,9 @@ parse_cookie_header(struct Curl_easy *data,
        * "the rest". Prefixes must start with '__' and end with a '-', so
        * only test for names where that can possibly be true.
        */
-      if(!strncmp("__Secure-", Curl_str(&name), 9))
+      if(!strncmp("__Secure-", curlx_str(&name), 9))
         co->prefix_secure = TRUE;
-      else if(!strncmp("__Host-", Curl_str(&name), 7))
+      else if(!strncmp("__Host-", curlx_str(&name), 7))
         co->prefix_host = TRUE;
 
       /*
@@ -554,8 +554,8 @@ parse_cookie_header(struct Curl_easy *data,
           /* Bad name/value pair. */
           return CERR_NO_SEP;
 
-        strstore(&co->name, Curl_str(&name), Curl_strlen(&name));
-        strstore(&co->value, Curl_str(&val), Curl_strlen(&val));
+        strstore(&co->name, curlx_str(&name), curlx_strlen(&name));
+        strstore(&co->value, curlx_str(&val), curlx_strlen(&val));
         done = TRUE;
         if(!co->name || !co->value)
           return CERR_NO_NAME_VALUE;
@@ -565,7 +565,7 @@ parse_cookie_header(struct Curl_easy *data,
           return CERR_INVALID_OCTET;
         }
       }
-      else if(!Curl_strlen(&val)) {
+      else if(!curlx_strlen(&val)) {
         /*
          * this was a "<name>=" with no content, and we must allow
          * 'secure' and 'httponly' specified this weirdly
@@ -576,7 +576,7 @@ parse_cookie_header(struct Curl_easy *data,
          * using a secure protocol, or when the cookie is being set by
          * reading from file
          */
-        if(Curl_str_casecompare(&name, "secure")) {
+        if(curlx_str_casecompare(&name, "secure")) {
           if(secure || !ci->running) {
             co->secure = TRUE;
           }
@@ -584,7 +584,7 @@ parse_cookie_header(struct Curl_easy *data,
             return CERR_BAD_SECURE;
           }
         }
-        else if(Curl_str_casecompare(&name, "httponly"))
+        else if(curlx_str_casecompare(&name, "httponly"))
           co->httponly = TRUE;
         else if(sep)
           /* there was a '=' so we are not done parsing this field */
@@ -592,8 +592,8 @@ parse_cookie_header(struct Curl_easy *data,
       }
       if(done)
         ;
-      else if(Curl_str_casecompare(&name, "path")) {
-        strstore(&co->path, Curl_str(&val), Curl_strlen(&val));
+      else if(curlx_str_casecompare(&name, "path")) {
+        strstore(&co->path, curlx_str(&val), curlx_strlen(&val));
         if(!co->path)
           return CERR_OUT_OF_MEMORY;
         free(co->spath); /* if this is set again */
@@ -601,16 +601,16 @@ parse_cookie_header(struct Curl_easy *data,
         if(!co->spath)
           return CERR_OUT_OF_MEMORY;
       }
-      else if(Curl_str_casecompare(&name, "domain") && Curl_strlen(&val)) {
+      else if(curlx_str_casecompare(&name, "domain") && curlx_strlen(&val)) {
         bool is_ip;
-        const char *v = Curl_str(&val);
+        const char *v = curlx_str(&val);
         /*
          * Now, we make sure that our host is within the given domain, or
          * the given domain is not valid and thus cannot be set.
          */
 
         if('.' == *v)
-          Curl_str_nudge(&val, 1);
+          curlx_str_nudge(&val, 1);
 
 #ifndef USE_LIBPSL
         /*
@@ -618,18 +618,19 @@ parse_cookie_header(struct Curl_easy *data,
          * TLD or otherwise "protected" suffix. To reduce risk, we require a
          * dot OR the exact hostname being "localhost".
          */
-        if(bad_domain(Curl_str(&val), Curl_strlen(&val)))
+        if(bad_domain(curlx_str(&val), curlx_strlen(&val)))
           domain = ":";
 #endif
 
-        is_ip = Curl_host_is_ipnum(domain ? domain : Curl_str(&val));
+        is_ip = Curl_host_is_ipnum(domain ? domain : curlx_str(&val));
 
         if(!domain
-           || (is_ip && !strncmp(Curl_str(&val), domain, Curl_strlen(&val)) &&
-               (Curl_strlen(&val) == strlen(domain)))
-           || (!is_ip && cookie_tailmatch(Curl_str(&val),
-                                          Curl_strlen(&val), domain))) {
-          strstore(&co->domain, Curl_str(&val), Curl_strlen(&val));
+           || (is_ip && !strncmp(curlx_str(&val), domain,
+                                 curlx_strlen(&val)) &&
+               (curlx_strlen(&val) == strlen(domain)))
+           || (!is_ip && cookie_tailmatch(curlx_str(&val),
+                                          curlx_strlen(&val), domain))) {
+          strstore(&co->domain, curlx_str(&val), curlx_strlen(&val));
           if(!co->domain)
             return CERR_OUT_OF_MEMORY;
 
@@ -643,14 +644,14 @@ parse_cookie_header(struct Curl_easy *data,
            * not a domain to which the current host belongs. Mark as bad.
            */
           infof(data, "skipped cookie with bad tailmatch domain: %s",
-                Curl_str(&val));
+                curlx_str(&val));
           return CERR_NO_TAILMATCH;
         }
       }
-      else if(Curl_str_casecompare(&name, "version")) {
+      else if(curlx_str_casecompare(&name, "version")) {
         /* just ignore */
       }
-      else if(Curl_str_casecompare(&name, "max-age") && Curl_strlen(&val)) {
+      else if(curlx_str_casecompare(&name, "max-age") && curlx_strlen(&val)) {
         /*
          * Defined in RFC2109:
          *
@@ -661,10 +662,10 @@ parse_cookie_header(struct Curl_easy *data,
          * cookie should be discarded immediately.
          */
         int rc;
-        const char *maxage = Curl_str(&val);
+        const char *maxage = curlx_str(&val);
         if(*maxage == '\"')
           maxage++;
-        rc = Curl_str_number(&maxage, &co->expires, CURL_OFF_T_MAX);
+        rc = curlx_str_number(&maxage, &co->expires, CURL_OFF_T_MAX);
 
         switch(rc) {
         case STRE_OVERFLOW:
@@ -688,8 +689,8 @@ parse_cookie_header(struct Curl_easy *data,
         }
         cap_expires(now, co);
       }
-      else if(Curl_str_casecompare(&name, "expires") && Curl_strlen(&val)) {
-        if(!co->expires && (Curl_strlen(&val) < MAX_DATE_LENGTH)) {
+      else if(curlx_str_casecompare(&name, "expires") && curlx_strlen(&val)) {
+        if(!co->expires && (curlx_strlen(&val) < MAX_DATE_LENGTH)) {
           /*
            * Let max-age have priority.
            *
@@ -697,8 +698,8 @@ parse_cookie_header(struct Curl_easy *data,
            * will be treated as a session cookie
            */
           char dbuf[MAX_DATE_LENGTH + 1];
-          memcpy(dbuf, Curl_str(&val), Curl_strlen(&val));
-          dbuf[Curl_strlen(&val)] = 0;
+          memcpy(dbuf, curlx_str(&val), curlx_strlen(&val));
+          dbuf[curlx_strlen(&val)] = 0;
           co->expires = Curl_getdate_capped(dbuf);
 
           /*
@@ -719,7 +720,7 @@ parse_cookie_header(struct Curl_easy *data,
        */
     }
 
-    if(Curl_str_single(&ptr, ';'))
+    if(curlx_str_single(&ptr, ';'))
       break;
   } while(1);
 
@@ -849,7 +850,7 @@ parse_netscape(struct Cookie *co,
       }
       break;
     case 4:
-      if(Curl_str_number(&ptr, &co->expires, CURL_OFF_T_MAX))
+      if(curlx_str_number(&ptr, &co->expires, CURL_OFF_T_MAX))
         return CERR_RANGE;
       break;
     case 5:
@@ -1209,20 +1210,20 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
     ci->running = FALSE; /* this is not running, this is init */
     if(fp) {
       struct dynbuf buf;
-      Curl_dyn_init(&buf, MAX_COOKIE_LINE);
+      curlx_dyn_init(&buf, MAX_COOKIE_LINE);
       while(Curl_get_line(&buf, fp)) {
-        const char *lineptr = Curl_dyn_ptr(&buf);
+        const char *lineptr = curlx_dyn_ptr(&buf);
         bool headerline = FALSE;
         if(checkprefix("Set-Cookie:", lineptr)) {
           /* This is a cookie line, get it! */
           lineptr += 11;
           headerline = TRUE;
-          Curl_str_passblanks(&lineptr);
+          curlx_str_passblanks(&lineptr);
         }
 
         Curl_cookie_add(data, ci, headerline, TRUE, lineptr, NULL, NULL, TRUE);
       }
-      Curl_dyn_free(&buf); /* free the line buffer */
+      curlx_dyn_free(&buf); /* free the line buffer */
 
       /*
        * Remove expired cookies from the hash. We must make sure to run this
index f013405b2594fea01fc72b9bd6068e82af7d296f..46c93689f64b8722db6b11538a26b1df11083c4c 100644 (file)
@@ -41,7 +41,7 @@
 #include "connect.h"
 #include "select.h"
 #include "strcase.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -270,7 +270,7 @@ static void cshutdn_perform(struct cshutdn *cshutdn,
       /* idata has one timer list, but maybe more than one connection.
        * Set EXPIRE_SHUTDOWN to the smallest time left for all. */
       if(!nowp) {
-        now = Curl_now();
+        now = curlx_now();
         nowp = &now;
       }
       ms = Curl_conn_shutdown_timeleft(conn, nowp);
@@ -289,7 +289,7 @@ static void cshutdn_terminate_all(struct cshutdn *cshutdn,
                                   struct Curl_easy *data,
                                   int timeout_ms)
 {
-  struct curltime started = Curl_now();
+  struct curltime started = curlx_now();
   struct Curl_llist_node *e;
   SIGPIPE_VARIABLE(pipe_st);
 
@@ -312,7 +312,7 @@ static void cshutdn_terminate_all(struct cshutdn *cshutdn,
     }
 
     /* wait for activity, timeout or "nothing" */
-    timespent = Curl_timediff(Curl_now(), started);
+    timespent = curlx_timediff(curlx_now(), started);
     if(timespent >= (timediff_t)timeout_ms) {
       CURL_TRC_M(data, "[SHUTDOWN] shutdown finished, %s",
                 (timeout_ms > 0) ? "timeout" : "best effort done");
@@ -362,7 +362,7 @@ void Curl_cshutdn_destroy(struct cshutdn *cshutdn,
       const char *p = getenv("CURL_GRACEFUL_SHUTDOWN");
       if(p) {
         curl_off_t l;
-        if(!Curl_str_number(&p, &l, INT_MAX))
+        if(!curlx_str_number(&p, &l, INT_MAX))
           timeout_ms = (int)l;
       }
     }
index 7b95144479b17099dc3066d68941154f79fedd6a..510d5bf50613c7303dd7805ea19b24c71fc68ff6 100644 (file)
@@ -26,7 +26,7 @@
  ***************************************************************************/
 
 #include <curl/curl.h>
-#include "timeval.h"
+#include "curlx/timeval.h"
 
 struct connectdata;
 struct Curl_easy;
index a984508b6e3557bb3be6112372b804ec46884b67..d858515a08652ae309fd7930d7ef26e83a9bac20 100644 (file)
@@ -52,7 +52,7 @@
 #include "curl_addrinfo.h"
 #include "fake_addrinfo.h"
 #include "inet_pton.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
 #include "curl_memory.h"
index 9ed1f05e245fd0b91f9f3adfa78ff7c2415e19f1..2bb57492b306fbe2b578c850c3dcb5903e476877 100644 (file)
@@ -28,9 +28,7 @@
   !defined(CURL_DISABLE_HSTS) || !defined(CURL_DISABLE_NETRC)
 
 #include "curl_get_line.h"
-#ifdef BUILDING_LIBCURL
 #include "curl_memory.h"
-#endif
 /* The last #include file should be: */
 #include "memdebug.h"
 
@@ -42,7 +40,7 @@ int Curl_get_line(struct dynbuf *buf, FILE *input)
 {
   CURLcode result;
   char buffer[128];
-  Curl_dyn_reset(buf);
+  curlx_dyn_reset(buf);
   while(1) {
     char *b = fgets(buffer, sizeof(buffer), input);
 
@@ -52,7 +50,7 @@ int Curl_get_line(struct dynbuf *buf, FILE *input)
       if(!rlen)
         break;
 
-      result = Curl_dyn_addn(buf, b, rlen);
+      result = curlx_dyn_addn(buf, b, rlen);
       if(result)
         /* too long line or out of memory */
         return 0; /* error */
@@ -63,14 +61,14 @@ int Curl_get_line(struct dynbuf *buf, FILE *input)
 
       else if(feof(input)) {
         /* append a newline */
-        result = Curl_dyn_addn(buf, "\n", 1);
+        result = curlx_dyn_addn(buf, "\n", 1);
         if(result)
           /* too long line or out of memory */
           return 0; /* error */
         return 1; /* all good */
       }
     }
-    else if(Curl_dyn_len(buf))
+    else if(curlx_dyn_len(buf))
       return 1; /* all good */
     else
       break;
index 1e3b0f0357c78f0ac0a8b7e63ff908380ab82cda..d4877123f26169dbb9a0438a071b8e8ee4279926 100644 (file)
  *
  ***************************************************************************/
 
-#include "dynbuf.h"
-
-#ifndef BUILDING_LIBCURL
-/* this renames functions so that the tool code can use the same code
-   without getting symbol collisions */
-#define Curl_get_line(a,b) curlx_get_line(a,b)
-#endif
+#include "curlx/dynbuf.h"
 
 /* Curl_get_line() returns complete lines that end with a newline. */
 int Curl_get_line(struct dynbuf *buf, FILE *input);
index 3b0c10b602a411959a5e37c8eafaba10c98ca52c..d6cd44d963ebe82e5bc494d2d7875835a7c3e8ac 100644 (file)
 #include "curl_ntlm_core.h"
 #include "curl_md5.h"
 #include "curl_hmac.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "curl_endian.h"
 #include "curl_des.h"
 #include "curl_md4.h"
index e851b14a5076901f1e853bf1cdc05a3922450946..4a5fe489a52d5164c20e2e6517e375c237735099 100644 (file)
  *
  ***************************************************************************/
 
-/*
- * This header should be included by ALL code in libcurl that uses any
- * *rintf() functions.
- */
-
-#ifndef CURL_TEMP_PRINTF
-#error "CURL_TEMP_PRINTF must be set before including curl/mprintf.h"
-#endif
-
 #include <curl/mprintf.h>
 
 #define MERR_OK        0
 #define MERR_MEM       1
 #define MERR_TOO_LARGE 2
 
+#ifdef BUILDING_LIBCURL
+
+/*
+ * This header should be included by ALL code in libcurl that uses any
+ * *rintf() functions.
+ */
+
 # undef printf
 # undef fprintf
 # undef msnprintf
@@ -55,4 +53,6 @@
 # define mvsnprintf curl_mvsnprintf
 # define aprintf curl_maprintf
 # define vaprintf curl_mvaprintf
+
+#endif /* BUILDING_LIBCURL */
 #endif /* HEADER_CURL_PRINTF_H */
index 868c1e054be19e8f6ea42b43fe936a40265d306b..e9620a29b5353dee30ace8ca59c4e51672d532b7 100644 (file)
@@ -26,7 +26,7 @@
 #include <curl/curl.h>
 #include "curl_range.h"
 #include "sendf.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* Only include this function if one or more of FTP, FILE are enabled. */
 #if !defined(CURL_DISABLE_FTP) || !defined(CURL_DISABLE_FILE)
@@ -41,14 +41,14 @@ CURLcode Curl_range(struct Curl_easy *data)
     curl_off_t from, to;
     bool first_num = TRUE;
     const char *p = data->state.range;
-    if(Curl_str_number(&p, &from, CURL_OFF_T_MAX))
+    if(curlx_str_number(&p, &from, CURL_OFF_T_MAX))
       first_num = FALSE;
 
-    if(Curl_str_single(&p, '-'))
+    if(curlx_str_single(&p, '-'))
       /* no leading dash or after the first number is an error */
       return CURLE_RANGE_ERROR;
 
-    if(Curl_str_number(&p, &to, CURL_OFF_T_MAX)) {
+    if(curlx_str_number(&p, &to, CURL_OFF_T_MAX)) {
       /* no second number */
       /* X - */
       data->state.resume_from = from;
index 33ca7cc87c5594b03b60f45165c60ea49f2ac122..562315bb0f5ed49316326af529442b0e5059ba35 100644 (file)
@@ -33,7 +33,7 @@
 #include "nonblock.h" /* for curlx_nonblock */
 #include "progress.h" /* for Curl_pgrsSetUploadSize */
 #include "transfer.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include <curl/curl.h>
 #include <librtmp/rtmp.h>
 
index 7fe1c326a935d087d1e3baa83487ee5a3adadb14..7943925bed09d33ac5c6fd986d01c515e03845d9 100644 (file)
 #include <curl/curl.h>
 #include "urldata.h"
 
-#include "curl_base64.h"
+#include "curlx/base64.h"
 #include "curl_md5.h"
 #include "vauth/vauth.h"
 #include "cfilters.h"
 #include "vtls/vtls.h"
 #include "curl_hmac.h"
 #include "curl_sasl.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "sendf.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -283,7 +283,7 @@ static CURLcode get_server_message(struct SASL *sasl, struct Curl_easy *data,
     if(!*serverdata || *serverdata == '=')
       Curl_bufref_set(out, NULL, 0, NULL);
     else {
-      result = Curl_base64_decode(serverdata, &msg, &msglen);
+      result = curlx_base64_decode(serverdata, &msg, &msglen);
       if(!result)
         Curl_bufref_set(out, msg, msglen, curl_free);
     }
@@ -306,8 +306,8 @@ static CURLcode build_message(struct SASL *sasl, struct bufref *msg)
       char *base64;
       size_t base64len;
 
-      result = Curl_base64_encode((const char *) Curl_bufref_ptr(msg),
-                                  Curl_bufref_len(msg), &base64, &base64len);
+      result = curlx_base64_encode((const char *) Curl_bufref_ptr(msg),
+                                   Curl_bufref_len(msg), &base64, &base64len);
       if(!result)
         Curl_bufref_set(msg, base64, base64len, curl_free);
     }
index c5433c02a456d75c81301378c5fe6940412d2c52..29061659d2ab4316f2c38aff8d84277d447e7564 100644 (file)
@@ -28,9 +28,6 @@
 #define CURL_NO_OLDIES
 #endif
 
-/* Tell "curl/curl.h" not to include "curl/mprintf.h" */
-#define CURL_SKIP_INCLUDE_MPRINTF
-
 /* Set default _WIN32_WINNT */
 #ifdef __MINGW32__
 #include <_mingw.h>
index bde8c0770e01b8016ff5d05431f2226dcbe112d2..2d8a23f19a7c20301c7528a03566bc241029849c 100644 (file)
@@ -27,7 +27,7 @@
 #if !defined(CURL_DISABLE_DIGEST_AUTH) && !defined(CURL_DISABLE_SHA512_256)
 
 #include "curl_sha512_256.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 
 /* The recommended order of the TLS backends:
  * * OpenSSL
index dbd386f1687676876dd097300c61917c7629cf08..0de3fd6939c5d9e04ff23bc0c5203f0e09c57f43 100644 (file)
@@ -31,7 +31,7 @@
 #include "curl_multibyte.h"
 #include "system_win32.h"
 #include "version_win32.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 
 /* The last #include files should be: */
 #include "curl_memory.h"
index 36ae32c11a57b80cf93c72f9c6530ffab0314e40..eae7544016185b686c207cb557d25ff13b323efc 100644 (file)
@@ -35,9 +35,7 @@
 #endif
 
 #include "curl_threads.h"
-#ifdef BUILDING_LIBCURL
 #include "curl_memory.h"
-#endif
 /* The last #include file should be: */
 #include "memdebug.h"
 
index 385770a356a2941d2be7948cb76ad8a121575676..566cdc533e2749c28136ab1a5875d8f14121b379 100644 (file)
@@ -43,7 +43,7 @@
 #include "cf-haproxy.h"
 #include "cf-https-connect.h"
 #include "socks.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 #include "vtls/vtls.h"
 #include "vquic/vquic.h"
 
@@ -497,13 +497,13 @@ static void trc_apply_level_by_name(struct Curl_str *token, int lvl)
   size_t i;
 
   for(i = 0; i < CURL_ARRAYSIZE(trc_cfts); ++i) {
-    if(Curl_str_casecompare(token, trc_cfts[i].cft->name)) {
+    if(curlx_str_casecompare(token, trc_cfts[i].cft->name)) {
       trc_cfts[i].cft->log_level = lvl;
       break;
     }
   }
   for(i = 0; i < CURL_ARRAYSIZE(trc_feats); ++i) {
-    if(Curl_str_casecompare(token, trc_feats[i].feat->name)) {
+    if(curlx_str_casecompare(token, trc_feats[i].feat->name)) {
       trc_feats[i].feat->log_level = lvl;
       break;
     }
@@ -527,33 +527,33 @@ static void trc_apply_level_by_category(int category, int lvl)
 static CURLcode trc_opt(const char *config)
 {
   struct Curl_str out;
-  while(!Curl_str_until(&config, &out, 32, ',')) {
+  while(!curlx_str_until(&config, &out, 32, ',')) {
     int lvl = CURL_LOG_LVL_INFO;
-    const char *token = Curl_str(&out);
+    const char *token = curlx_str(&out);
 
     if(*token == '-') {
       lvl = CURL_LOG_LVL_NONE;
-      Curl_str_nudge(&out, 1);
+      curlx_str_nudge(&out, 1);
     }
     else if(*token == '+')
-      Curl_str_nudge(&out, 1);
+      curlx_str_nudge(&out, 1);
 
-    if(Curl_str_casecompare(&out, "all"))
+    if(curlx_str_casecompare(&out, "all"))
       trc_apply_level_by_category(TRC_CT_NONE, lvl);
-    else if(Curl_str_casecompare(&out, "protocol"))
+    else if(curlx_str_casecompare(&out, "protocol"))
       trc_apply_level_by_category(TRC_CT_PROTOCOL, lvl);
-    else if(Curl_str_casecompare(&out, "network"))
+    else if(curlx_str_casecompare(&out, "network"))
       trc_apply_level_by_category(TRC_CT_NETWORK, lvl);
-    else if(Curl_str_casecompare(&out, "proxy"))
+    else if(curlx_str_casecompare(&out, "proxy"))
       trc_apply_level_by_category(TRC_CT_PROXY, lvl);
-    else if(Curl_str_casecompare(&out, "doh")) {
+    else if(curlx_str_casecompare(&out, "doh")) {
       struct Curl_str dns = { "dns", 3 };
       trc_apply_level_by_name(&dns, lvl);
     }
     else
       trc_apply_level_by_name(&out, lvl);
 
-    if(Curl_str_single(&config, ','))
+    if(curlx_str_single(&config, ','))
       break;
   }
   return CURLE_OK;
diff --git a/lib/curlx/README.md b/lib/curlx/README.md
new file mode 100644 (file)
index 0000000..2d47d7b
--- /dev/null
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+
+SPDX-License-Identifier: curl
+-->
+
+# `curlx`
+
+Functions that are prefixed with `curlx_` are internal global functions that
+are written in a way to allow them to be "borrowed" and used outside of the
+library: in the curl tool and in the curl test suite.
+
+The `curlx` functions are not part of the libcurl API, but are stand-alone
+functions whose sources can be built and used outside of libcurl. There are
+not API or ABI guarantees. The functions are not written or meant to be used
+outside of the curl project.
+
+Only functions actually used by the library are provided here.
+
+## Ways to success
+
+- Do not use `struct Curl_easy` in these files
+- Do not use the printf defines in these files
+- Make them as stand-alone as possible
similarity index 93%
rename from lib/base64.c
rename to lib/curlx/base64.c
index 3e819d23260bcfcb1af5510488512fce2918ac32..ad7269ce4f434651fcb841c4d5c4753d787d2f10 100644 (file)
@@ -24,7 +24,7 @@
 
 /* Base64 encoding/decoding */
 
-#include "curl_setup.h"
+#include "../curl_setup.h"
 
 #if !defined(CURL_DISABLE_HTTP_AUTH) || defined(USE_SSH) || \
   !defined(CURL_DISABLE_LDAP) || \
   !defined(CURL_DISABLE_IMAP) || \
   !defined(CURL_DISABLE_DIGEST_AUTH) || \
   !defined(CURL_DISABLE_DOH) || defined(USE_SSL) || !defined(BUILDING_LIBCURL)
-#include "curl/curl.h"
+#include <curl/curl.h>
 #include "warnless.h"
-#include "curl_base64.h"
+#include "base64.h"
 
 /* The last 2 #include files should be in this order */
 #ifdef BUILDING_LIBCURL
-#include "curl_memory.h"
+#include "../curl_memory.h"
 #endif
-#include "memdebug.h"
+#include "../memdebug.h"
 
 /* ---- Base64 Encoding/Decoding Table --- */
 /* Padding character string starts at offset 64. */
@@ -60,7 +60,7 @@ static const unsigned char decodetable[] =
   29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
   48, 49, 50, 51 };
 /*
- * Curl_base64_decode()
+ * curlx_base64_decode()
  *
  * Given a base64 NUL-terminated string at src, decode it and return a
  * pointer in *outptr to a newly allocated memory area holding decoded
@@ -73,8 +73,8 @@ static const unsigned char decodetable[] =
  *
  * @unittest: 1302
  */
-CURLcode Curl_base64_decode(const char *src,
-                            unsigned char **outptr, size_t *outlen)
+CURLcode curlx_base64_decode(const char *src,
+                             unsigned char **outptr, size_t *outlen)
 {
   size_t srclen = 0;
   size_t padding = 0;
@@ -249,7 +249,7 @@ static CURLcode base64_encode(const char *table64,
 }
 
 /*
- * Curl_base64_encode()
+ * curlx_base64_encode()
  *
  * Given a pointer to an input buffer and an input size, encode it and
  * return a pointer in *outptr to a newly allocated memory area holding
@@ -263,14 +263,14 @@ static CURLcode base64_encode(const char *table64,
  *
  * @unittest: 1302
  */
-CURLcode Curl_base64_encode(const char *inputbuff, size_t insize,
-                            char **outptr, size_t *outlen)
+CURLcode curlx_base64_encode(const char *inputbuff, size_t insize,
+                             char **outptr, size_t *outlen)
 {
   return base64_encode(base64encdec, inputbuff, insize, outptr, outlen);
 }
 
 /*
- * Curl_base64url_encode()
+ * curlx_base64url_encode()
  *
  * Given a pointer to an input buffer and an input size, encode it and
  * return a pointer in *outptr to a newly allocated memory area holding
@@ -284,8 +284,8 @@ CURLcode Curl_base64_encode(const char *inputbuff, size_t insize,
  *
  * @unittest: 1302
  */
-CURLcode Curl_base64url_encode(const char *inputbuff, size_t insize,
-                               char **outptr, size_t *outlen)
+CURLcode curlx_base64url_encode(const char *inputbuff, size_t insize,
+                                char **outptr, size_t *outlen)
 {
   return base64_encode(base64url, inputbuff, insize, outptr, outlen);
 }
similarity index 61%
rename from lib/curl_base64.h
rename to lib/curlx/base64.h
index 7f7cd1d98a8474a4764c699becf4d6f651b14909..faa7f71d21fb5ae5ce2e2b8bad1cf4e91c3a2718 100644 (file)
  *
  ***************************************************************************/
 
-#ifndef BUILDING_LIBCURL
-/* this renames functions so that the tool code can use the same code
-   without getting symbol collisions */
-#define Curl_base64_encode(a,b,c,d) curlx_base64_encode(a,b,c,d)
-#define Curl_base64url_encode(a,b,c,d) curlx_base64url_encode(a,b,c,d)
-#define Curl_base64_decode(a,b,c) curlx_base64_decode(a,b,c)
-#endif
-
-CURLcode Curl_base64_encode(const char *inputbuff, size_t insize,
-                            char **outptr, size_t *outlen);
-CURLcode Curl_base64url_encode(const char *inputbuff, size_t insize,
-                               char **outptr, size_t *outlen);
-CURLcode Curl_base64_decode(const char *src,
-                            unsigned char **outptr, size_t *outlen);
+CURLcode curlx_base64_encode(const char *inputbuff, size_t insize,
+                             char **outptr, size_t *outlen);
+CURLcode curlx_base64url_encode(const char *inputbuff, size_t insize,
+                                char **outptr, size_t *outlen);
+CURLcode curlx_base64_decode(const char *src,
+                             unsigned char **outptr, size_t *outlen);
 #endif /* HEADER_CURL_BASE64_H */
similarity index 89%
rename from lib/curlx.h
rename to lib/curlx/curlx.h
index 06a34fefc1bcf233c25001b67a57d4734ee53ec6..73ea05a0feea3fe601b790fd9745f19f6fe466e8 100644 (file)
  * be.
  */
 
-/* map standard printf functions to curl implementations */
-#include "curl_printf.h"
-
-#include "strcase.h"
-/* "strcase.h" provides the strcasecompare protos */
-
-#include "nonblock.h"
+#include "../nonblock.h"
 /* "nonblock.h" provides curlx_nonblock() */
 
 #include "warnless.h"
@@ -48,7 +42,7 @@
   curlx_uztosi()
 */
 
-#include "curl_multibyte.h"
+#include "../curl_multibyte.h"
 /* "curl_multibyte.h" provides these functions and macros:
 
   curlx_convert_UTF8_to_wchar()
   curlx_unicodefree()
 */
 
-#include "version_win32.h"
+#include "../version_win32.h"
 /* "version_win32.h" provides curlx_verify_windows_version() */
 
 #include "strparse.h"
 /* The curlx_str_* parsing functions */
 
+#include "dynbuf.h"
+/* The curlx_dyn_* functions */
+
+#include "base64.h"
+#include "timeval.h"
+#include "timediff.h"
+
+#include "../curl_get_line.h"
+
 #define curlx_safefree(x) Curl_safefree(x)
 
 #endif /* HEADER_CURL_CURLX_H */
similarity index 84%
rename from lib/dynbuf.c
rename to lib/curlx/dynbuf.c
index bdfe6a681d415c84073e957ad0cc294464d62300..0b8dfe8e34f5ab78ea7930f11c361155966409b6 100644 (file)
  *
  ***************************************************************************/
 
-#include "curl_setup.h"
+#include "../curl_setup.h"
 #include "dynbuf.h"
-#include "curl_printf.h"
+#include "../curl_printf.h"
 #ifdef BUILDING_LIBCURL
-#include "curl_memory.h"
+#include "../curl_memory.h"
 #endif
-#include "memdebug.h"
+#include "../memdebug.h"
 
 #define MIN_FIRST_ALLOC 32
 
@@ -39,7 +39,7 @@
 /*
  * Init a dynbuf struct.
  */
-void Curl_dyn_init(struct dynbuf *s, size_t toobig)
+void curlx_dyn_init(struct dynbuf *s, size_t toobig)
 {
   DEBUGASSERT(s);
   DEBUGASSERT(toobig);
@@ -57,7 +57,7 @@ void Curl_dyn_init(struct dynbuf *s, size_t toobig)
  * free the buffer and re-init the necessary fields. It does not touch the
  * 'init' field and thus this buffer can be reused to add data to again.
  */
-void Curl_dyn_free(struct dynbuf *s)
+void curlx_dyn_free(struct dynbuf *s)
 {
   DEBUGASSERT(s);
   DEBUGASSERT(s->init == DYNINIT);
@@ -84,7 +84,7 @@ static CURLcode dyn_nappend(struct dynbuf *s,
   DEBUGASSERT(!len || mem);
 
   if(fit > s->toobig) {
-    Curl_dyn_free(s);
+    curlx_dyn_free(s);
     return CURLE_TOO_LARGE;
   }
   else if(!a) {
@@ -110,7 +110,7 @@ static CURLcode dyn_nappend(struct dynbuf *s,
        include that as well when it uses this code */
     void *p = realloc(s->bufr, a);
     if(!p) {
-      Curl_dyn_free(s);
+      curlx_dyn_free(s);
       return CURLE_OUT_OF_MEMORY;
     }
     s->bufr = p;
@@ -128,7 +128,7 @@ static CURLcode dyn_nappend(struct dynbuf *s,
  * Clears the string, keeps the allocation. This can also be called on a
  * buffer that already was freed.
  */
-void Curl_dyn_reset(struct dynbuf *s)
+void curlx_dyn_reset(struct dynbuf *s)
 {
   DEBUGASSERT(s);
   DEBUGASSERT(s->init == DYNINIT);
@@ -142,7 +142,7 @@ void Curl_dyn_reset(struct dynbuf *s)
  * Specify the size of the tail to keep (number of bytes from the end of the
  * buffer). The rest will be dropped.
  */
-CURLcode Curl_dyn_tail(struct dynbuf *s, size_t trail)
+CURLcode curlx_dyn_tail(struct dynbuf *s, size_t trail)
 {
   DEBUGASSERT(s);
   DEBUGASSERT(s->init == DYNINIT);
@@ -152,7 +152,7 @@ CURLcode Curl_dyn_tail(struct dynbuf *s, size_t trail)
   else if(trail == s->leng)
     return CURLE_OK;
   else if(!trail) {
-    Curl_dyn_reset(s);
+    curlx_dyn_reset(s);
   }
   else {
     memmove(&s->bufr[0], &s->bufr[s->leng - trail], trail);
@@ -166,7 +166,7 @@ CURLcode Curl_dyn_tail(struct dynbuf *s, size_t trail)
 /*
  * Appends a buffer with length.
  */
-CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len)
+CURLcode curlx_dyn_addn(struct dynbuf *s, const void *mem, size_t len)
 {
   DEBUGASSERT(s);
   DEBUGASSERT(s->init == DYNINIT);
@@ -177,7 +177,7 @@ CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len)
 /*
  * Append a null-terminated string at the end.
  */
-CURLcode Curl_dyn_add(struct dynbuf *s, const char *str)
+CURLcode curlx_dyn_add(struct dynbuf *s, const char *str)
 {
   size_t n;
   DEBUGASSERT(str);
@@ -191,7 +191,7 @@ CURLcode Curl_dyn_add(struct dynbuf *s, const char *str)
 /*
  * Append a string vprintf()-style
  */
-CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
+CURLcode curlx_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
 {
 #ifdef BUILDING_LIBCURL
   int rc;
@@ -199,7 +199,7 @@ CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
   DEBUGASSERT(s->init == DYNINIT);
   DEBUGASSERT(!s->leng || s->bufr);
   DEBUGASSERT(fmt);
-  rc = Curl_dyn_vprintf(s, fmt, ap);
+  rc = curlx_dyn_vprintf(s, fmt, ap);
 
   if(!rc)
     return CURLE_OK;
@@ -208,7 +208,7 @@ CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
   return CURLE_OUT_OF_MEMORY;
 #else
   char *str;
-  str = vaprintf(fmt, ap); /* this allocs a new string to append */
+  str = curl_mvaprintf(fmt, ap); /* this allocs a new string to append */
 
   if(str) {
     CURLcode result = dyn_nappend(s, (const unsigned char *)str, strlen(str));
@@ -216,7 +216,7 @@ CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
     return result;
   }
   /* If we failed, we cleanup the whole buffer and return error */
-  Curl_dyn_free(s);
+  curlx_dyn_free(s);
   return CURLE_OUT_OF_MEMORY;
 #endif
 }
@@ -224,7 +224,7 @@ CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
 /*
  * Append a string printf()-style
  */
-CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...)
+CURLcode curlx_dyn_addf(struct dynbuf *s, const char *fmt, ...)
 {
   CURLcode result;
   va_list ap;
@@ -232,7 +232,7 @@ CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...)
   DEBUGASSERT(s->init == DYNINIT);
   DEBUGASSERT(!s->leng || s->bufr);
   va_start(ap, fmt);
-  result = Curl_dyn_vaddf(s, fmt, ap);
+  result = curlx_dyn_vaddf(s, fmt, ap);
   va_end(ap);
   return result;
 }
@@ -240,7 +240,7 @@ CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...)
 /*
  * Returns a pointer to the buffer.
  */
-char *Curl_dyn_ptr(const struct dynbuf *s)
+char *curlx_dyn_ptr(const struct dynbuf *s)
 {
   DEBUGASSERT(s);
   DEBUGASSERT(s->init == DYNINIT);
@@ -248,7 +248,7 @@ char *Curl_dyn_ptr(const struct dynbuf *s)
   return s->bufr;
 }
 
-char *Curl_dyn_take(struct dynbuf *s, size_t *plen)
+char *curlx_dyn_take(struct dynbuf *s, size_t *plen)
 {
   char *ptr = s->bufr;
   DEBUGASSERT(s);
@@ -263,7 +263,7 @@ char *Curl_dyn_take(struct dynbuf *s, size_t *plen)
 /*
  * Returns an unsigned pointer to the buffer.
  */
-unsigned char *Curl_dyn_uptr(const struct dynbuf *s)
+unsigned char *curlx_dyn_uptr(const struct dynbuf *s)
 {
   DEBUGASSERT(s);
   DEBUGASSERT(s->init == DYNINIT);
@@ -274,7 +274,7 @@ unsigned char *Curl_dyn_uptr(const struct dynbuf *s)
 /*
  * Returns the length of the buffer.
  */
-size_t Curl_dyn_len(const struct dynbuf *s)
+size_t curlx_dyn_len(const struct dynbuf *s)
 {
   DEBUGASSERT(s);
   DEBUGASSERT(s->init == DYNINIT);
@@ -285,7 +285,7 @@ size_t Curl_dyn_len(const struct dynbuf *s)
 /*
  * Set a new (smaller) length.
  */
-CURLcode Curl_dyn_setlen(struct dynbuf *s, size_t set)
+CURLcode curlx_dyn_setlen(struct dynbuf *s, size_t set)
 {
   DEBUGASSERT(s);
   DEBUGASSERT(s->init == DYNINIT);
similarity index 62%
rename from lib/dynbuf.h
rename to lib/curlx/dynbuf.h
index 72471bc104c1dfc55ff0d4e809e8f2634809fb2e..27335a6fbf4a146029f363008e740632edfdbc11 100644 (file)
 
 #include <curl/curl.h>
 
-#ifndef BUILDING_LIBCURL
-/* this renames the functions so that the tool code can use the same code
-   without getting symbol collisions */
-#define Curl_dyn_init(a,b) curlx_dyn_init(a,b)
-#define Curl_dyn_add(a,b) curlx_dyn_add(a,b)
-#define Curl_dyn_addn(a,b,c) curlx_dyn_addn(a,b,c)
-#define Curl_dyn_addf curlx_dyn_addf
-#define Curl_dyn_vaddf curlx_dyn_vaddf
-#define Curl_dyn_free(a) curlx_dyn_free(a)
-#define Curl_dyn_ptr(a) curlx_dyn_ptr(a)
-#define Curl_dyn_uptr(a) curlx_dyn_uptr(a)
-#define Curl_dyn_len(a) curlx_dyn_len(a)
-#define Curl_dyn_reset(a) curlx_dyn_reset(a)
-#define Curl_dyn_take(a,b) curlx_dyn_take(a,b)
-#define Curl_dyn_tail(a,b) curlx_dyn_tail(a,b)
-#define Curl_dyn_setlen(a,b) curlx_dyn_setlen(a,b)
-#define curlx_dynbuf dynbuf /* for the struct name */
-#endif
-
 struct dynbuf {
   char *bufr;    /* point to a null-terminated allocated buffer */
   size_t leng;   /* number of bytes *EXCLUDING* the null-terminator */
@@ -55,30 +36,30 @@ struct dynbuf {
 #endif
 };
 
-void Curl_dyn_init(struct dynbuf *s, size_t toobig);
-void Curl_dyn_free(struct dynbuf *s);
-CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len)
+void curlx_dyn_init(struct dynbuf *s, size_t toobig);
+void curlx_dyn_free(struct dynbuf *s);
+CURLcode curlx_dyn_addn(struct dynbuf *s, const void *mem, size_t len)
   WARN_UNUSED_RESULT;
-CURLcode Curl_dyn_add(struct dynbuf *s, const char *str)
+CURLcode curlx_dyn_add(struct dynbuf *s, const char *str)
   WARN_UNUSED_RESULT;
-CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...)
+CURLcode curlx_dyn_addf(struct dynbuf *s, const char *fmt, ...)
   WARN_UNUSED_RESULT CURL_PRINTF(2, 3);
-CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
+CURLcode curlx_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
   WARN_UNUSED_RESULT CURL_PRINTF(2, 0);
-void Curl_dyn_reset(struct dynbuf *s);
-CURLcode Curl_dyn_tail(struct dynbuf *s, size_t trail);
-CURLcode Curl_dyn_setlen(struct dynbuf *s, size_t set);
-char *Curl_dyn_ptr(const struct dynbuf *s);
-unsigned char *Curl_dyn_uptr(const struct dynbuf *s);
-size_t Curl_dyn_len(const struct dynbuf *s);
+void curlx_dyn_reset(struct dynbuf *s);
+CURLcode curlx_dyn_tail(struct dynbuf *s, size_t trail);
+CURLcode curlx_dyn_setlen(struct dynbuf *s, size_t set);
+char *curlx_dyn_ptr(const struct dynbuf *s);
+unsigned char *curlx_dyn_uptr(const struct dynbuf *s);
+size_t curlx_dyn_len(const struct dynbuf *s);
 
 /* returns 0 on success, -1 on error */
 /* The implementation of this function exists in mprintf.c */
-int Curl_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save);
+int curlx_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save);
 
 /* Take the buffer out of the dynbuf. Caller has ownership and
  * dynbuf resets to initial state. */
-char *Curl_dyn_take(struct dynbuf *s, size_t *plen);
+char *curlx_dyn_take(struct dynbuf *s, size_t *plen);
 
 /* Dynamic buffer max sizes */
 #define MAX_DYNBUF_SIZE (SIZE_T_MAX/2)
similarity index 82%
rename from lib/strparse.c
rename to lib/curlx/strparse.c
index ebe352f15bba57f57e6638853cef5e194bd62022..d501d56d575014d963dd73179a445bc2273dafbf 100644 (file)
  ***************************************************************************/
 
 #include "strparse.h"
-#include "strcase.h"
+#include "../strcase.h"
 
-void Curl_str_init(struct Curl_str *out)
+void curlx_str_init(struct Curl_str *out)
 {
   out->str = NULL;
   out->len = 0;
 }
 
-void Curl_str_assign(struct Curl_str *out, const char *str, size_t len)
+void curlx_str_assign(struct Curl_str *out, const char *str, size_t len)
 {
   out->str = str;
   out->len = len;
@@ -39,14 +39,14 @@ void Curl_str_assign(struct Curl_str *out, const char *str, size_t len)
 
 /* Get a word until the first DELIM or end of string. At least one byte long.
    return non-zero on error */
-int Curl_str_until(const char **linep, struct Curl_str *out,
+int curlx_str_until(const char **linep, struct Curl_str *out,
                    const size_t max, char delim)
 {
   const char *s = *linep;
   size_t len = 0;
   DEBUGASSERT(linep && *linep && out && max && delim);
 
-  Curl_str_init(out);
+  curlx_str_init(out);
   while(*s && (*s != delim)) {
     s++;
     if(++len > max) {
@@ -63,22 +63,22 @@ int Curl_str_until(const char **linep, struct Curl_str *out,
 
 /* Get a word until the first space or end of string. At least one byte long.
    return non-zero on error */
-int Curl_str_word(const char **linep, struct Curl_str *out,
+int curlx_str_word(const char **linep, struct Curl_str *out,
                   const size_t max)
 {
-  return Curl_str_until(linep, out, max, ' ');
+  return curlx_str_until(linep, out, max, ' ');
 }
 
 /* Get a word until a newline byte or end of string. At least one byte long.
    return non-zero on error */
-int Curl_str_untilnl(const char **linep, struct Curl_str *out,
+int curlx_str_untilnl(const char **linep, struct Curl_str *out,
                      const size_t max)
 {
   const char *s = *linep;
   size_t len = 0;
   DEBUGASSERT(linep && *linep && out && max);
 
-  Curl_str_init(out);
+  curlx_str_init(out);
   while(*s && !ISNEWLINE(*s)) {
     s++;
     if(++len > max)
@@ -95,14 +95,14 @@ int Curl_str_untilnl(const char **linep, struct Curl_str *out,
 
 /* Get a "quoted" word. No escaping possible.
    return non-zero on error */
-int Curl_str_quotedword(const char **linep, struct Curl_str *out,
+int curlx_str_quotedword(const char **linep, struct Curl_str *out,
                         const size_t max)
 {
   const char *s = *linep;
   size_t len = 0;
   DEBUGASSERT(linep && *linep && out && max);
 
-  Curl_str_init(out);
+  curlx_str_init(out);
   if(*s != '\"')
     return STRE_BEGQUOTE;
   s++;
@@ -121,7 +121,7 @@ int Curl_str_quotedword(const char **linep, struct Curl_str *out,
 
 /* Advance over a single character.
    return non-zero on error */
-int Curl_str_single(const char **linep, char byte)
+int curlx_str_single(const char **linep, char byte)
 {
   DEBUGASSERT(linep && *linep);
   if(**linep != byte)
@@ -132,9 +132,9 @@ int Curl_str_single(const char **linep, char byte)
 
 /* Advance over a single space.
    return non-zero on error */
-int Curl_str_singlespace(const char **linep)
+int curlx_str_singlespace(const char **linep)
 {
-  return Curl_str_single(linep, ' ');
+  return curlx_str_single(linep, ' ');
 }
 
 /* given an ASCII character and max ascii, return TRUE if valid */
@@ -191,21 +191,21 @@ static int str_num_base(const char **linep, curl_off_t *nump, curl_off_t max,
 
 /* Get an unsigned decimal number with no leading space or minus. Leading
    zeroes are accepted. return non-zero on error */
-int Curl_str_number(const char **linep, curl_off_t *nump, curl_off_t max)
+int curlx_str_number(const char **linep, curl_off_t *nump, curl_off_t max)
 {
   return str_num_base(linep, nump, max, 10);
 }
 
 /* Get an unsigned hexadecimal number with no leading space or minus and no
    "0x" support. Leading zeroes are accepted. return non-zero on error */
-int Curl_str_hex(const char **linep, curl_off_t *nump, curl_off_t max)
+int curlx_str_hex(const char **linep, curl_off_t *nump, curl_off_t max)
 {
   return str_num_base(linep, nump, max, 16);
 }
 
 /* Get an unsigned octal number with no leading space or minus and no "0"
    prefix support. Leading zeroes are accepted. return non-zero on error */
-int Curl_str_octal(const char **linep, curl_off_t *nump, curl_off_t max)
+int curlx_str_octal(const char **linep, curl_off_t *nump, curl_off_t max)
 {
   return str_num_base(linep, nump, max, 8);
 }
@@ -214,15 +214,15 @@ int Curl_str_octal(const char **linep, curl_off_t *nump, curl_off_t max)
  * Parse a positive number up to 63-bit number written in ASCII. Skip leading
  * blanks. No support for prefixes.
  */
-int Curl_str_numblanks(const char **str, curl_off_t *num)
+int curlx_str_numblanks(const char **str, curl_off_t *num)
 {
-  Curl_str_passblanks(str);
-  return Curl_str_number(str, num, CURL_OFF_T_MAX);
+  curlx_str_passblanks(str);
+  return curlx_str_number(str, num, CURL_OFF_T_MAX);
 }
 
 /* CR or LF
    return non-zero on error */
-int Curl_str_newline(const char **linep)
+int curlx_str_newline(const char **linep)
 {
   DEBUGASSERT(linep && *linep);
   if(ISNEWLINE(**linep)) {
@@ -234,14 +234,14 @@ int Curl_str_newline(const char **linep)
 
 /* case insensitive compare that the parsed string matches the
    given string. Returns non-zero on match. */
-int Curl_str_casecompare(struct Curl_str *str, const char *check)
+int curlx_str_casecompare(struct Curl_str *str, const char *check)
 {
   size_t clen = check ? strlen(check) : 0;
   return ((str->len == clen) && strncasecompare(str->str, check, clen));
 }
 
 /* case sensitive string compare. Returns non-zero on match. */
-int Curl_str_cmp(struct Curl_str *str, const char *check)
+int curlx_str_cmp(struct Curl_str *str, const char *check)
 {
   if(check) {
     size_t clen = strlen(check);
@@ -252,7 +252,7 @@ int Curl_str_cmp(struct Curl_str *str, const char *check)
 
 /* Trim off 'num' number of bytes from the beginning (left side) of the
    string. If 'num' is larger than the string, return error. */
-int Curl_str_nudge(struct Curl_str *str, size_t num)
+int curlx_str_nudge(struct Curl_str *str, size_t num)
 {
   if(num <= str->len) {
     str->str += num;
@@ -264,7 +264,8 @@ int Curl_str_nudge(struct Curl_str *str, size_t num)
 
 /* Get the following character sequence that consists only of bytes not
    present in the 'reject' string. Like strcspn(). */
-int Curl_str_cspn(const char **linep, struct Curl_str *out, const char *reject)
+int curlx_str_cspn(const char **linep, struct Curl_str *out,
+                   const char *reject)
 {
   const char *s = *linep;
   size_t len;
@@ -277,15 +278,15 @@ int Curl_str_cspn(const char **linep, struct Curl_str *out, const char *reject)
     *linep = &s[len];
     return STRE_OK;
   }
-  Curl_str_init(out);
+  curlx_str_init(out);
   return STRE_SHORT;
 }
 
 /* remove ISBLANK()s from both ends of the string */
-void Curl_str_trimblanks(struct Curl_str *out)
+void curlx_str_trimblanks(struct Curl_str *out)
 {
   while(out->len && ISBLANK(*out->str))
-    Curl_str_nudge(out, 1);
+    curlx_str_nudge(out, 1);
 
   /* trim trailing spaces and tabs */
   while(out->len && ISBLANK(out->str[out->len - 1]))
@@ -293,7 +294,7 @@ void Curl_str_trimblanks(struct Curl_str *out)
 }
 
 /* increase the pointer until it has moved over all blanks */
-void Curl_str_passblanks(const char **linep)
+void curlx_str_passblanks(const char **linep)
 {
   while(ISBLANK(**linep))
     (*linep)++; /* move over it */
similarity index 64%
rename from lib/strparse.h
rename to lib/curlx/strparse.h
index 6168bf9ca336aabfd1e3188faaa3c7ad41487d82..17bfdb80710c74fa0af3bdc457e0320356117080 100644 (file)
@@ -23,7 +23,7 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "curl_setup.h"
+#include "../curl_setup.h"
 
 #define STRE_OK       0
 #define STRE_BIG      1
@@ -42,65 +42,65 @@ struct Curl_str {
   size_t len;
 };
 
-void Curl_str_init(struct Curl_str *out);
-void Curl_str_assign(struct Curl_str *out, const char *str, size_t len);
+void curlx_str_init(struct Curl_str *out);
+void curlx_str_assign(struct Curl_str *out, const char *str, size_t len);
 
-#define Curl_str(x) ((x)->str)
-#define Curl_strlen(x) ((x)->len)
+#define curlx_str(x) ((x)->str)
+#define curlx_strlen(x) ((x)->len)
 
 /* Get a word until the first space
    return non-zero on error */
-int Curl_str_word(const char **linep, struct Curl_str *out, const size_t max);
+int curlx_str_word(const char **linep, struct Curl_str *out, const size_t max);
 
 /* Get a word until the first DELIM or end of string
    return non-zero on error */
-int Curl_str_until(const char **linep, struct Curl_str *out, const size_t max,
+int curlx_str_until(const char **linep, struct Curl_str *out, const size_t max,
                    char delim);
 
 /* Get a word until a newline byte or end of string. At least one byte long.
    return non-zero on error */
-int Curl_str_untilnl(const char **linep, struct Curl_str *out,
+int curlx_str_untilnl(const char **linep, struct Curl_str *out,
                      const size_t max);
 
 /* Get a "quoted" word. No escaping possible.
    return non-zero on error */
-int Curl_str_quotedword(const char **linep, struct Curl_str *out,
+int curlx_str_quotedword(const char **linep, struct Curl_str *out,
                         const size_t max);
 
 /* Advance over a single character.
    return non-zero on error */
-int Curl_str_single(const char **linep, char byte);
+int curlx_str_single(const char **linep, char byte);
 
 /* Advance over a single space.
    return non-zero on error */
-int Curl_str_singlespace(const char **linep);
+int curlx_str_singlespace(const char **linep);
 
 /* Get an unsigned decimal number. Return non-zero on error */
-int Curl_str_number(const char **linep, curl_off_t *nump, curl_off_t max);
+int curlx_str_number(const char **linep, curl_off_t *nump, curl_off_t max);
 
 /* As above with CURL_OFF_T_MAX but also pass leading blanks */
-int Curl_str_numblanks(const char **str, curl_off_t *num);
+int curlx_str_numblanks(const char **str, curl_off_t *num);
 
 /* Get an unsigned hexadecimal number. Return non-zero on error */
-int Curl_str_hex(const char **linep, curl_off_t *nump, curl_off_t max);
+int curlx_str_hex(const char **linep, curl_off_t *nump, curl_off_t max);
 
 /* Get an unsigned octal number. Return non-zero on error */
-int Curl_str_octal(const char **linep, curl_off_t *nump, curl_off_t max);
+int curlx_str_octal(const char **linep, curl_off_t *nump, curl_off_t max);
 
 /* Check for CR or LF
    return non-zero on error */
-int Curl_str_newline(const char **linep);
+int curlx_str_newline(const char **linep);
 
 /* case insensitive compare that the parsed string matches the
    given string. */
-int Curl_str_casecompare(struct Curl_str *str, const char *check);
-int Curl_str_cmp(struct Curl_str *str, const char *check);
+int curlx_str_casecompare(struct Curl_str *str, const char *check);
+int curlx_str_cmp(struct Curl_str *str, const char *check);
 
-int Curl_str_nudge(struct Curl_str *str, size_t num);
+int curlx_str_nudge(struct Curl_str *str, size_t num);
 
-int Curl_str_cspn(const char **linep, struct Curl_str *out, const char *cspn);
-void Curl_str_trimblanks(struct Curl_str *out);
-void Curl_str_passblanks(const char **linep);
+int curlx_str_cspn(const char **linep, struct Curl_str *out, const char *cspn);
+void curlx_str_trimblanks(struct Curl_str *out);
+void curlx_str_passblanks(const char **linep);
 
 /* given a hexadecimal letter, return the binary value. '0' returns 0, 'a'
    returns 10. THIS ONLY WORKS ON VALID HEXADECIMAL LETTER INPUT. Verify
@@ -109,10 +109,4 @@ void Curl_str_passblanks(const char **linep);
 extern const unsigned char Curl_hexasciitable[];
 #define Curl_hexval(x) (unsigned char)(Curl_hexasciitable[(x) - '0'] & 0x0f)
 
-#define curlx_str_number(x,y,z) Curl_str_number(x,y,z)
-#define curlx_str_octal(x,y,z) Curl_str_octal(x,y,z)
-#define curlx_str_single(x,y) Curl_str_single(x,y)
-#define curlx_str_passblanks(x) Curl_str_passblanks(x)
-#define curlx_str_numblanks(x,y) Curl_str_numblanks(x,y)
-
 #endif /* HEADER_CURL_STRPARSE_H */
similarity index 100%
rename from lib/timediff.c
rename to lib/curlx/timediff.c
similarity index 98%
rename from lib/timediff.h
rename to lib/curlx/timediff.h
index 75f996c55cf956140b2d3d2cc86f70e7ff5fdd9a..aa224381dd931771d6264cd79af6f0769d167689 100644 (file)
@@ -24,7 +24,7 @@
  *
  ***************************************************************************/
 
-#include "curl_setup.h"
+#include "../curl_setup.h"
 
 /* Use a larger type even for 32-bit time_t systems so that we can keep
    microsecond accuracy in it */
similarity index 88%
rename from lib/timeval.c
rename to lib/curlx/timeval.c
index c93ecd9d33e0ff7df45197d3ea0c06061445ce81..238a2bf4bde1a6c1b3a1fcdc26f4b16d250a0c91 100644 (file)
 #ifdef _WIN32
 
 #include <curl/curl.h>
-#ifdef BUILDING_LIBCURL
-#include "system_win32.h"
-#else
-#include "version_win32.h"
+#include "../version_win32.h"
+#include "../system_win32.h"
 
-static LARGE_INTEGER s_freq;
-static bool s_isVistaOrGreater;
+LARGE_INTEGER Curl_freq;
+bool Curl_isVistaOrGreater;
 
-/* For tool or tests, we must initialize before calling Curl_now() */
+/* For tool or tests, we must initialize before calling curlx_now().
+   Providing this function here is wrong. */
 void curlx_now_init(void)
 {
   if(curlx_verify_windows_version(6, 0, 0, PLATFORM_WINNT,
                                   VERSION_GREATER_THAN_EQUAL))
-    s_isVistaOrGreater = true;
+    Curl_isVistaOrGreater = true;
   else
-    s_isVistaOrGreater = false;
+    Curl_isVistaOrGreater = false;
 
-  QueryPerformanceFrequency(&s_freq);
+  QueryPerformanceFrequency(&Curl_freq);
 }
-#endif
 
 /* In case of bug fix this function has a counterpart in tool_util.c */
-struct curltime Curl_now(void)
+struct curltime curlx_now(void)
 {
   struct curltime now;
   bool isVistaOrGreater;
-#ifdef BUILDING_LIBCURL
   isVistaOrGreater = Curl_isVistaOrGreater;
-#else
-  isVistaOrGreater = s_isVistaOrGreater;
-#endif
   if(isVistaOrGreater) { /* QPC timer might have issues pre-Vista */
     LARGE_INTEGER count;
     LARGE_INTEGER freq;
-#ifdef BUILDING_LIBCURL
     freq = Curl_freq;
-#else
-    freq = s_freq;
-#endif
     DEBUGASSERT(freq.QuadPart);
     QueryPerformanceCounter(&count);
     now.tv_sec = (time_t)(count.QuadPart / freq.QuadPart);
@@ -92,7 +82,7 @@ struct curltime Curl_now(void)
 #elif defined(HAVE_CLOCK_GETTIME_MONOTONIC) ||  \
   defined(HAVE_CLOCK_GETTIME_MONOTONIC_RAW)
 
-struct curltime Curl_now(void)
+struct curltime curlx_now(void)
 {
   /*
   ** clock_gettime() is granted to be increased monotonically when the
@@ -166,7 +156,7 @@ struct curltime Curl_now(void)
 #include <stdint.h>
 #include <mach/mach_time.h>
 
-struct curltime Curl_now(void)
+struct curltime curlx_now(void)
 {
   /*
   ** Monotonic timer on macOS is provided by mach_absolute_time(), which
@@ -194,7 +184,7 @@ struct curltime Curl_now(void)
 
 #elif defined(HAVE_GETTIMEOFDAY)
 
-struct curltime Curl_now(void)
+struct curltime curlx_now(void)
 {
   /*
   ** gettimeofday() is not granted to be increased monotonically, due to
@@ -211,7 +201,7 @@ struct curltime Curl_now(void)
 
 #else
 
-struct curltime Curl_now(void)
+struct curltime curlx_now(void)
 {
   /*
   ** time() returns the value of time in seconds since the Epoch.
@@ -230,7 +220,7 @@ struct curltime Curl_now(void)
  *
  * @unittest: 1323
  */
-timediff_t Curl_timediff(struct curltime newer, struct curltime older)
+timediff_t curlx_timediff(struct curltime newer, struct curltime older)
 {
   timediff_t diff = (timediff_t)newer.tv_sec-older.tv_sec;
   if(diff >= (TIMEDIFF_T_MAX/1000))
@@ -244,7 +234,7 @@ timediff_t Curl_timediff(struct curltime newer, struct curltime older)
  * Returns: time difference in number of milliseconds, rounded up.
  * For too large diffs it returns max value.
  */
-timediff_t Curl_timediff_ceil(struct curltime newer, struct curltime older)
+timediff_t curlx_timediff_ceil(struct curltime newer, struct curltime older)
 {
   timediff_t diff = (timediff_t)newer.tv_sec-older.tv_sec;
   if(diff >= (TIMEDIFF_T_MAX/1000))
@@ -258,7 +248,7 @@ timediff_t Curl_timediff_ceil(struct curltime newer, struct curltime older)
  * Returns: time difference in number of microseconds. For too large diffs it
  * returns max value.
  */
-timediff_t Curl_timediff_us(struct curltime newer, struct curltime older)
+timediff_t curlx_timediff_us(struct curltime newer, struct curltime older)
 {
   timediff_t diff = (timediff_t)newer.tv_sec-older.tv_sec;
   if(diff >= (TIMEDIFF_T_MAX/1000000))
similarity index 74%
rename from lib/timeval.h
rename to lib/curlx/timeval.h
index 5f3d79c36d0ffc09c41674259df0e1d2374384a2..1f8fe5e8ad1efc1b0b4b968064787694bbba444d 100644 (file)
  *
  ***************************************************************************/
 
-#include "curl_setup.h"
+#include "../curl_setup.h"
 
 #include "timediff.h"
 
-#ifndef BUILDING_LIBCURL
-/* this renames the functions so that the tool code can use the same code
-   without getting symbol collisions */
-#define Curl_now curlx_now
-#define Curl_timediff(a,b) curlx_timediff(a,b)
-#define Curl_timediff_ceil(a,b) curlx_timediff_ceil(a,b)
-#define Curl_timediff_us(a,b) curlx_timediff_us(a,b)
-
-/* For tool or tests, we must initialize before calling Curl_now() */
-void curlx_now_init(void);
-#endif
-
 struct curltime {
   time_t tv_sec; /* seconds */
   int tv_usec;   /* microseconds */
 };
 
-struct curltime Curl_now(void);
+#ifdef _WIN32
+/* For tool or tests, we must initialize before calling curlx_now() */
+void curlx_now_init(void);
+#endif
+
+struct curltime curlx_now(void);
 
 /*
  * Make sure that the first argument (newer) is the more recent time and older
@@ -53,7 +46,7 @@ struct curltime Curl_now(void);
  *
  * Returns: the time difference in number of milliseconds.
  */
-timediff_t Curl_timediff(struct curltime newer, struct curltime older);
+timediff_t curlx_timediff(struct curltime newer, struct curltime older);
 
 /*
  * Make sure that the first argument (newer) is the more recent time and older
@@ -61,7 +54,7 @@ timediff_t Curl_timediff(struct curltime newer, struct curltime older);
  *
  * Returns: the time difference in number of milliseconds, rounded up.
  */
-timediff_t Curl_timediff_ceil(struct curltime newer, struct curltime older);
+timediff_t curlx_timediff_ceil(struct curltime newer, struct curltime older);
 
 /*
  * Make sure that the first argument (newer) is the more recent time and older
@@ -69,6 +62,6 @@ timediff_t Curl_timediff_ceil(struct curltime newer, struct curltime older);
  *
  * Returns: the time difference in number of microseconds.
  */
-timediff_t Curl_timediff_us(struct curltime newer, struct curltime older);
+timediff_t curlx_timediff_us(struct curltime newer, struct curltime older);
 
 #endif /* HEADER_CURL_TIMEVAL_H */
similarity index 99%
rename from lib/warnless.c
rename to lib/curlx/warnless.c
index 218e518fd7a8f1c03cc767329493c69e3b4dc1b2..5ca92450d8935d46d8525a250c5cc731848ccc94 100644 (file)
@@ -22,7 +22,7 @@
  *
  ***************************************************************************/
 
-#include "curl_setup.h"
+#include "warnless.h"
 
 #if defined(__INTEL_COMPILER) && defined(__unix__)
 
@@ -35,8 +35,6 @@
 
 #endif /* __INTEL_COMPILER && __unix__ */
 
-#include "warnless.h"
-
 #ifdef _WIN32
 #undef read
 #undef write
similarity index 98%
rename from lib/warnless.h
rename to lib/curlx/warnless.h
index 11c5e8b0b83d570e9b1d93f2e2ee87a6ed3037c4..c78b61169bf8d5d6d33bff09d6fd2c92c48efc4c 100644 (file)
@@ -24,7 +24,7 @@
  *
  ***************************************************************************/
 
-#include "curl_setup.h"
+#include "../curl_setup.h"
 
 #ifdef USE_WINSOCK
 #include <curl/curl.h> /* for curl_socket_t */
index af8f1b9e5c1baf544de4c3c0457e0236b32ef1b6..097ef85e8b4c60cd3c1e82751f47ecf11577a4a9 100644 (file)
@@ -87,7 +87,7 @@ static struct cw_out_buf *cw_out_buf_create(cw_out_type otype)
   struct cw_out_buf *cwbuf = calloc(1, sizeof(*cwbuf));
   if(cwbuf) {
     cwbuf->type = otype;
-    Curl_dyn_init(&cwbuf->b, DYN_PAUSE_BUFFER);
+    curlx_dyn_init(&cwbuf->b, DYN_PAUSE_BUFFER);
   }
   return cwbuf;
 }
@@ -95,7 +95,7 @@ static struct cw_out_buf *cw_out_buf_create(cw_out_type otype)
 static void cw_out_buf_free(struct cw_out_buf *cwbuf)
 {
   if(cwbuf) {
-    Curl_dyn_free(&cwbuf->b);
+    curlx_dyn_free(&cwbuf->b);
     free(cwbuf);
   }
 }
@@ -146,7 +146,7 @@ static size_t cw_out_bufs_len(struct cw_out_ctx *ctx)
   struct cw_out_buf *cwbuf = ctx->buf;
   size_t len = 0;
   while(cwbuf) {
-    len += Curl_dyn_len(&cwbuf->b);
+    len += curlx_dyn_len(&cwbuf->b);
     cwbuf = cwbuf->next;
   }
   return len;
@@ -263,23 +263,24 @@ static CURLcode cw_out_buf_flush(struct cw_out_ctx *ctx,
 {
   CURLcode result = CURLE_OK;
 
-  if(Curl_dyn_len(&cwbuf->b)) {
+  if(curlx_dyn_len(&cwbuf->b)) {
     size_t consumed;
 
     result = cw_out_ptr_flush(ctx, data, cwbuf->type, flush_all,
-                              Curl_dyn_ptr(&cwbuf->b),
-                              Curl_dyn_len(&cwbuf->b),
+                              curlx_dyn_ptr(&cwbuf->b),
+                              curlx_dyn_len(&cwbuf->b),
                               &consumed);
     if(result)
       return result;
 
     if(consumed) {
-      if(consumed == Curl_dyn_len(&cwbuf->b)) {
-        Curl_dyn_free(&cwbuf->b);
+      if(consumed == curlx_dyn_len(&cwbuf->b)) {
+        curlx_dyn_free(&cwbuf->b);
       }
       else {
-        DEBUGASSERT(consumed < Curl_dyn_len(&cwbuf->b));
-        result = Curl_dyn_tail(&cwbuf->b, Curl_dyn_len(&cwbuf->b) - consumed);
+        DEBUGASSERT(consumed < curlx_dyn_len(&cwbuf->b));
+        result = curlx_dyn_tail(&cwbuf->b,
+                                curlx_dyn_len(&cwbuf->b) - consumed);
         if(result)
           return result;
       }
@@ -319,7 +320,7 @@ static CURLcode cw_out_flush_chain(struct cw_out_ctx *ctx,
   result = cw_out_buf_flush(ctx, data, cwbuf, flush_all);
   if(result)
     return result;
-  if(!Curl_dyn_len(&cwbuf->b)) {
+  if(!curlx_dyn_len(&cwbuf->b)) {
     cw_out_buf_free(cwbuf);
     *pcwbuf = NULL;
   }
@@ -349,7 +350,7 @@ static CURLcode cw_out_append(struct cw_out_ctx *ctx,
     ctx->buf = cwbuf;
   }
   DEBUGASSERT(ctx->buf && (ctx->buf->type == otype));
-  return Curl_dyn_addn(&ctx->buf->b, buf, blen);
+  return curlx_dyn_addn(&ctx->buf->b, buf, blen);
 }
 
 static CURLcode cw_out_do_write(struct cw_out_ctx *ctx,
index b24fbb22cf0a018b51693c8fdf06cc240f5c9980..637f349e7007344b533ce25883cd3aef4538829a 100644 (file)
@@ -115,7 +115,7 @@ static char *unescape_word(const char *input)
   struct dynbuf out;
   const char *ptr;
   CURLcode result = CURLE_OK;
-  Curl_dyn_init(&out, DYN_DICT_WORD);
+  curlx_dyn_init(&out, DYN_DICT_WORD);
 
   /* According to RFC2229 section 2.2, these letters need to be escaped with
      \[letter] */
@@ -123,13 +123,13 @@ static char *unescape_word(const char *input)
     char ch = *ptr;
     if((ch <= 32) || (ch == 127) ||
        (ch == '\'') || (ch == '\"') || (ch == '\\'))
-      result = Curl_dyn_addn(&out, "\\", 1);
+      result = curlx_dyn_addn(&out, "\\", 1);
     if(!result)
-      result = Curl_dyn_addn(&out, ptr, 1);
+      result = curlx_dyn_addn(&out, ptr, 1);
     if(result)
       return NULL;
   }
-  return Curl_dyn_ptr(&out);
+  return curlx_dyn_ptr(&out);
 }
 
 /* sendf() sends formatted data to the server */
index 672842ba8353a05541da9af3a1b14b07a423a777..fc20e9599ed4552980d261f83c66ad14db133924 100644 (file)
--- a/lib/doh.c
+++ b/lib/doh.c
 #include "multiif.h"
 #include "url.h"
 #include "share.h"
-#include "curl_base64.h"
+#include "curlx/base64.h"
 #include "connect.h"
 #include "strdup.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 #include "escape.h"
 #include "urlapi-int.h"
 
@@ -183,7 +183,7 @@ doh_probe_write_cb(char *contents, size_t size, size_t nmemb, void *userp)
   if(!doh_req)
     return CURL_WRITEFUNC_ERROR;
 
-  if(Curl_dyn_addn(&doh_req->resp_body, contents, realsize))
+  if(curlx_dyn_addn(&doh_req->resp_body, contents, realsize))
     return 0;
 
   return realsize;
@@ -244,10 +244,10 @@ static void doh_probe_done(struct Curl_easy *data,
     if(doh_req) {
       if(!result) {
         dohp->probe_resp[i].dnstype = doh_req->dnstype;
-        result = Curl_dyn_addn(&dohp->probe_resp[i].body,
-                               Curl_dyn_ptr(&doh_req->resp_body),
-                               Curl_dyn_len(&doh_req->resp_body));
-        Curl_dyn_free(&doh_req->resp_body);
+        result = curlx_dyn_addn(&dohp->probe_resp[i].body,
+                                curlx_dyn_ptr(&doh_req->resp_body),
+                                curlx_dyn_len(&doh_req->resp_body));
+        curlx_dyn_free(&doh_req->resp_body);
       }
       Curl_meta_remove(doh, CURL_EZM_DOH_PROBE);
     }
@@ -269,7 +269,7 @@ static void doh_probe_dtor(void *key, size_t klen, void *e)
   if(e) {
     struct doh_request *doh_req = e;
     curl_slist_free_all(doh_req->req_hds);
-    Curl_dyn_free(&doh_req->resp_body);
+    curlx_dyn_free(&doh_req->resp_body);
     free(e);
   }
 }
@@ -301,7 +301,7 @@ static CURLcode doh_probe_run(struct Curl_easy *data,
   if(!doh_req)
     return CURLE_OUT_OF_MEMORY;
   doh_req->dnstype = dnstype;
-  Curl_dyn_init(&doh_req->resp_body, DYN_DOH_RESPONSE);
+  curlx_dyn_init(&doh_req->resp_body, DYN_DOH_RESPONSE);
 
   d = doh_req_encode(host, dnstype, doh_req->req_body,
                      sizeof(doh_req->req_body),
@@ -490,7 +490,7 @@ struct Curl_addrinfo *Curl_doh(struct Curl_easy *data,
 
   for(i = 0; i < DOH_SLOT_COUNT; ++i) {
     dohp->probe_resp[i].probe_mid = UINT_MAX;
-    Curl_dyn_init(&dohp->probe_resp[i].body, DYN_DOH_RESPONSE);
+    curlx_dyn_init(&dohp->probe_resp[i].body, DYN_DOH_RESPONSE);
   }
 
   conn->bits.doh = TRUE;
@@ -665,14 +665,14 @@ static DOHcode doh_store_cname(const unsigned char *doh, size_t dohlen,
       index++;
 
     if(length) {
-      if(Curl_dyn_len(c)) {
-        if(Curl_dyn_addn(c, STRCONST(".")))
+      if(curlx_dyn_len(c)) {
+        if(curlx_dyn_addn(c, STRCONST(".")))
           return DOH_OUT_OF_MEM;
       }
       if((index + length) > dohlen)
         return DOH_DNS_BAD_LABEL;
 
-      if(Curl_dyn_addn(c, &doh[index], length))
+      if(curlx_dyn_addn(c, &doh[index], length))
         return DOH_OUT_OF_MEM;
       index += length;
     }
@@ -736,7 +736,7 @@ UNITTEST void de_init(struct dohentry *de)
   memset(de, 0, sizeof(*de));
   de->ttl = INT_MAX;
   for(i = 0; i < DOH_MAX_CNAME; i++)
-    Curl_dyn_init(&de->cname[i], DYN_DOH_CNAME);
+    curlx_dyn_init(&de->cname[i], DYN_DOH_CNAME);
 }
 
 
@@ -923,7 +923,7 @@ static void doh_show(struct Curl_easy *data,
   }
 #endif
   for(i = 0; i < d->numcname; i++) {
-    infof(data, "CNAME: %s", Curl_dyn_ptr(&d->cname[i]));
+    infof(data, "CNAME: %s", curlx_dyn_ptr(&d->cname[i]));
   }
 }
 #else
@@ -1060,7 +1060,7 @@ UNITTEST void de_cleanup(struct dohentry *d)
 {
   int i = 0;
   for(i = 0; i < d->numcname; i++) {
-    Curl_dyn_free(&d->cname[i]);
+    curlx_dyn_free(&d->cname[i]);
   }
 #ifdef USE_HTTPSRR
   for(i = 0; i < d->numhttps_rrs; i++)
@@ -1095,35 +1095,35 @@ static CURLcode doh_decode_rdata_name(const unsigned char **buf,
   DEBUGASSERT(buf && remaining && dnsname);
   if(!buf || !remaining || !dnsname || !*remaining)
     return CURLE_OUT_OF_MEMORY;
-  Curl_dyn_init(&thename, CURL_MAXLEN_host_name);
+  curlx_dyn_init(&thename, CURL_MAXLEN_host_name);
   rem = *remaining;
   cp = *buf;
   clen = *cp++;
   if(clen == 0) {
     /* special case - return "." as name */
-    if(Curl_dyn_addn(&thename, ".", 1))
+    if(curlx_dyn_addn(&thename, ".", 1))
       return CURLE_OUT_OF_MEMORY;
   }
   while(clen) {
     if(clen >= rem) {
-      Curl_dyn_free(&thename);
+      curlx_dyn_free(&thename);
       return CURLE_OUT_OF_MEMORY;
     }
-    if(Curl_dyn_addn(&thename, cp, clen) ||
-       Curl_dyn_addn(&thename, ".", 1))
+    if(curlx_dyn_addn(&thename, cp, clen) ||
+       curlx_dyn_addn(&thename, ".", 1))
       return CURLE_TOO_LARGE;
 
     cp += clen;
     rem -= (clen + 1);
     if(rem <= 0) {
-      Curl_dyn_free(&thename);
+      curlx_dyn_free(&thename);
       return CURLE_OUT_OF_MEMORY;
     }
     clen = *cp++;
   }
   *buf = cp;
   *remaining = rem - 1;
-  *dnsname = Curl_dyn_ptr(&thename);
+  *dnsname = curlx_dyn_ptr(&thename);
   return CURLE_OK;
 }
 
@@ -1260,8 +1260,8 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
       struct doh_response *p = &dohp->probe_resp[slot];
       if(!p->dnstype)
         continue;
-      rc[slot] = doh_resp_decode(Curl_dyn_uptr(&p->body),
-                                 Curl_dyn_len(&p->body),
+      rc[slot] = doh_resp_decode(curlx_dyn_uptr(&p->body),
+                                 curlx_dyn_len(&p->body),
                                  p->dnstype, &de);
 #ifndef CURL_DISABLE_VERBOSE_STRINGS
       if(rc[slot]) {
@@ -1364,7 +1364,7 @@ void Curl_doh_cleanup(struct Curl_easy *data)
     int i;
     Curl_doh_close(data);
     for(i = 0; i < DOH_SLOT_COUNT; ++i) {
-      Curl_dyn_free(&dohp->probe_resp[i].body);
+      curlx_dyn_free(&dohp->probe_resp[i].body);
     }
     Curl_safefree(data->state.async.doh);
   }
index 2c92ca63fe6a41ba43286d92e1d55ebb7007fba3..5c52d7411ace9418d2c886580811ecffdca71180 100644 (file)
@@ -359,9 +359,10 @@ CURLcode Curl_dynhds_h1_dprint(struct dynhds *dynhds, struct dynbuf *dbuf)
     return result;
 
   for(i = 0; i < dynhds->hds_len; ++i) {
-    result = Curl_dyn_addf(dbuf, "%.*s: %.*s\r\n",
-               (int)dynhds->hds[i]->namelen, dynhds->hds[i]->name,
-               (int)dynhds->hds[i]->valuelen, dynhds->hds[i]->value);
+    result = curlx_dyn_addf(dbuf, "%.*s: %.*s\r\n",
+                            (int)dynhds->hds[i]->namelen, dynhds->hds[i]->name,
+                            (int)dynhds->hds[i]->valuelen,
+                            dynhds->hds[i]->value);
     if(result)
       break;
   }
index 191acdd1c2b72854421e85f43f83b5da7391f1c8..7cd5da472a4f4ab08a3b8aefa689dd7fd15dc71e 100644 (file)
@@ -26,7 +26,7 @@
 #include "curl_setup.h"
 
 #include <curl/curl.h>
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 
 struct dynbuf;
 
index af913bffa2c9cfbff71529c450d35a97e7c6f850..67064f2bc23bd946a176ab241bc15aeebaa63827 100644 (file)
 #include "mime.h"
 #include "amigaos.h"
 #include "macos.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "sigpipe.h"
 #include "vssh/ssh.h"
 #include "setopt.h"
 #include "http_digest.h"
 #include "system_win32.h"
 #include "http2.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 #include "altsvc.h"
 #include "hsts.h"
 
@@ -590,7 +590,7 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
     const unsigned int numfds = populate_fds(fds, ev);
 
     /* get the time stamp to use to figure out how long poll takes */
-    before = Curl_now();
+    before = curlx_now();
 
     if(numfds) {
       /* wait for activity or timeout */
@@ -645,7 +645,7 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
         /* If nothing updated the timeout, we decrease it by the spent time.
          * If it was updated, it has the new timeout time stored already.
          */
-        timediff_t timediff = Curl_timediff(Curl_now(), before);
+        timediff_t timediff = curlx_timediff(curlx_now(), before);
         if(timediff > 0) {
 #if DEBUG_EV_POLL
         fprintf(stderr, "poll timeout %ldms not updated, decrease by "
@@ -967,8 +967,8 @@ CURL *curl_easy_duphandle(CURL *d)
   outcurl->set.buffer_size = data->set.buffer_size;
 
   Curl_hash_init(&outcurl->meta_hash, 23,
-                 Curl_hash_str, Curl_str_key_compare, dupeasy_meta_freeentry);
-  Curl_dyn_init(&outcurl->state.headerb, CURL_MAX_HTTP_HEADER);
+                 Curl_hash_str, curlx_str_key_compare, dupeasy_meta_freeentry);
+  curlx_dyn_init(&outcurl->state.headerb, CURL_MAX_HTTP_HEADER);
   Curl_netrc_init(&outcurl->state.netrc);
 
   /* the connection pool is setup on demand */
@@ -1062,7 +1062,7 @@ fail:
 #ifndef CURL_DISABLE_COOKIES
     free(outcurl->cookies);
 #endif
-    Curl_dyn_free(&outcurl->state.headerb);
+    curlx_dyn_free(&outcurl->state.headerb);
     Curl_altsvc_cleanup(&outcurl->asi);
     Curl_hsts_cleanup(&outcurl->hsts);
     Curl_freeset(outcurl);
index 31673fff55052d292919049c149f96d48ce5a8f4..372c692d9d1416cfe9d58bf6435882042e53693e 100644 (file)
 struct Curl_easy;
 
 #include "urldata.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "escape.h"
 #include "strdup.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -71,7 +71,7 @@ char *curl_easy_escape(CURL *data, const char *string,
   if(!length)
     return strdup("");
 
-  Curl_dyn_init(&d, length * 3 + 1);
+  curlx_dyn_init(&d, length * 3 + 1);
 
   while(length--) {
     /* treat the characters unsigned */
@@ -79,19 +79,19 @@ char *curl_easy_escape(CURL *data, const char *string,
 
     if(ISUNRESERVED(in)) {
       /* append this */
-      if(Curl_dyn_addn(&d, &in, 1))
+      if(curlx_dyn_addn(&d, &in, 1))
         return NULL;
     }
     else {
       /* encode it */
       unsigned char out[3]={'%'};
       Curl_hexbyte(&out[1], in, FALSE);
-      if(Curl_dyn_addn(&d, out, 3))
+      if(curlx_dyn_addn(&d, out, 3))
         return NULL;
     }
   }
 
-  return Curl_dyn_ptr(&d);
+  return curlx_dyn_ptr(&d);
 }
 
 /*
index 05741f47ac9ddc49070020125a01cdc46f60fd8a..cec73aabdaa33ac33a3338ad4ec8444ec6a4e599 100644 (file)
@@ -70,7 +70,7 @@
 #include "transfer.h"
 #include "url.h"
 #include "parsedate.h" /* for the week day and month names */
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "curl_range.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -391,7 +391,7 @@ static CURLcode file_upload(struct Curl_easy *data)
     if(Curl_pgrsUpdate(data))
       result = CURLE_ABORTED_BY_CALLBACK;
     else
-      result = Curl_speedcheck(data, Curl_now());
+      result = Curl_speedcheck(data, curlx_now());
   }
   if(!result && Curl_pgrsUpdate(data))
     result = CURLE_ABORTED_BY_CALLBACK;
@@ -596,7 +596,7 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
       if(Curl_pgrsUpdate(data))
         result = CURLE_ABORTED_BY_CALLBACK;
       else
-        result = Curl_speedcheck(data, Curl_now());
+        result = Curl_speedcheck(data, curlx_now());
       if(result)
         goto out;
     }
index 2be3b3239b80e1f3a63437f9a7dda5b634972f9a..c3439af341e130c504a4ea5ef8c014a20ec50a7a 100644 (file)
@@ -40,7 +40,7 @@ void Curl_fileinfo_cleanup(struct fileinfo *finfo)
   if(!finfo)
     return;
 
-  Curl_dyn_free(&finfo->buf);
+  curlx_dyn_free(&finfo->buf);
   free(finfo);
 }
 #endif
index 0b3f56d9d493eb511a29eb667d96203032ce627c..6746ee2575527dd986675c7f009e06de9531a0e2 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <curl/curl.h>
 #include "llist.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 
 struct fileinfo {
   struct curl_fileinfo info;
index 43678e29f9f046edd421b5a22862d20e1ad0fdce..38b87f326e39b00fa736cca4716fe28954874159 100644 (file)
@@ -66,7 +66,7 @@ static char *dirslash(const char *path)
   size_t n;
   struct dynbuf out;
   DEBUGASSERT(path);
-  Curl_dyn_init(&out, CURL_MAX_INPUT_LENGTH);
+  curlx_dyn_init(&out, CURL_MAX_INPUT_LENGTH);
   n = strlen(path);
   if(n) {
     /* find the rightmost path separator, if any */
@@ -76,12 +76,12 @@ static char *dirslash(const char *path)
     while(n && IS_SEP(path[n-1]))
       --n;
   }
-  if(Curl_dyn_addn(&out, path, n))
+  if(curlx_dyn_addn(&out, path, n))
     return NULL;
   /* if there was a directory, append a single trailing slash */
-  if(n && Curl_dyn_addn(&out, PATHSEP, 1))
+  if(n && curlx_dyn_addn(&out, PATHSEP, 1))
     return NULL;
-  return Curl_dyn_ptr(&out);
+  return curlx_dyn_ptr(&out);
 }
 
 /*
index a1390291042f455eb6b94ffbd5c2bb683a39e8d4..910dc7e93251ad54c97d4e2dcb9564d35c080742 100644 (file)
@@ -38,7 +38,7 @@ struct Curl_easy;
 #include "sendf.h"
 #include "strdup.h"
 #include "rand.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
 #include "curl_memory.h"
index 925baf6585afc89b928d35539417388e0192760c..d78a13ed824c2a98de86e1d88c6ceecd8c2466c4 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
 #include "multiif.h"
 #include "url.h"
 #include "speedcheck.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "http_proxy.h"
 #include "socks.h"
 #include "strdup.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
 #include "curl_memory.h"
@@ -452,7 +452,7 @@ static CURLcode ftp_check_ctrl_on_data_wait(struct Curl_easy *data,
   bool response = FALSE;
 
   /* First check whether there is a cached response from server */
-  if(Curl_dyn_len(&pp->recvbuf) && (*Curl_dyn_ptr(&pp->recvbuf) > '3')) {
+  if(curlx_dyn_len(&pp->recvbuf) && (*curlx_dyn_ptr(&pp->recvbuf) > '3')) {
     /* Data connection could not be established, let's return */
     infof(data, "There is negative response in cache while serv connect");
     (void)Curl_GetFTPResponse(data, &nread, &ftpcode);
@@ -481,16 +481,16 @@ static CURLcode ftp_check_ctrl_on_data_wait(struct Curl_easy *data,
   if(response) {
     infof(data, "Ctrl conn has data while waiting for data conn");
     if(pp->overflow > 3) {
-      const char *r = Curl_dyn_ptr(&pp->recvbuf);
+      const char *r = curlx_dyn_ptr(&pp->recvbuf);
 
       DEBUGASSERT((pp->overflow + pp->nfinal) <=
-                  Curl_dyn_len(&pp->recvbuf));
+                  curlx_dyn_len(&pp->recvbuf));
       /* move over the most recently handled response line */
       r += pp->nfinal;
 
       if(LASTLINE(r)) {
         curl_off_t status;
-        if(!Curl_str_number(&r, &status, 999) && (status == 226)) {
+        if(!curlx_str_number(&r, &status, 999) && (status == 226)) {
           /* funny timing situation where we get the final message on the
              control connection before traffic on the data connection has been
              noticed. Leave the 226 in there and use this as a trigger to read
@@ -564,7 +564,7 @@ static bool ftp_endofresp(struct Curl_easy *data, struct connectdata *conn,
   (void)data;
   (void)conn;
 
-  if((len > 3) && LASTLINE(line) && !Curl_str_number(&line, &status, 999)) {
+  if((len > 3) && LASTLINE(line) && !curlx_str_number(&line, &status, 999)) {
     *code = (int)status;
     return TRUE;
   }
@@ -585,7 +585,7 @@ static CURLcode ftp_readresp(struct Curl_easy *data,
 #ifdef HAVE_GSSAPI
   {
     struct connectdata *conn = data->conn;
-    char * const buf = Curl_dyn_ptr(&ftpc->pp.recvbuf);
+    char * const buf = curlx_dyn_ptr(&ftpc->pp.recvbuf);
 
     /* handle the security-oriented responses 6xx ***/
     switch(code) {
@@ -695,7 +695,7 @@ CURLcode Curl_GetFTPResponse(struct Curl_easy *data,
      *
      */
 
-    if(Curl_dyn_len(&pp->recvbuf) && (cache_skip < 2)) {
+    if(curlx_dyn_len(&pp->recvbuf) && (cache_skip < 2)) {
       /*
        * There is a cache left since before. We then skipping the wait for
        * socket action, unless this is the same cache like the previous round
@@ -729,7 +729,7 @@ CURLcode Curl_GetFTPResponse(struct Curl_easy *data,
     if(result)
       break;
 
-    if(!nread && Curl_dyn_len(&pp->recvbuf))
+    if(!nread && curlx_dyn_len(&pp->recvbuf))
       /* bump cache skip counter as on repeated skips we must wait for more
          data */
       cache_skip++;
@@ -953,12 +953,12 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
         curl_off_t start;
         curl_off_t end;
         portp++;
-        if(!Curl_str_number(&portp, &start, 0xffff)) {
+        if(!curlx_str_number(&portp, &start, 0xffff)) {
           /* got the first number */
           port_min = (unsigned short)start;
-          if(!Curl_str_single(&portp, '-')) {
+          if(!curlx_str_single(&portp, '-')) {
             /* got the dash */
-            if(!Curl_str_number(&portp, &end, 0xffff))
+            if(!curlx_str_number(&portp, &end, 0xffff))
               /* got the second number */
               port_max = (unsigned short)end;
           }
@@ -1790,7 +1790,7 @@ static bool match_pasv_6nums(const char *p,
         return FALSE;
       p++;
     }
-    if(Curl_str_number(&p, &num, 0xff))
+    if(curlx_str_number(&p, &num, 0xff))
       return FALSE;
     array[i] = (unsigned int)num;
   }
@@ -1807,7 +1807,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data,
   unsigned short connectport; /* the local port connect() should use! */
   struct pingpong *pp = &ftpc->pp;
   char *str =
-    Curl_dyn_ptr(&pp->recvbuf) + 4; /* start on the first letter */
+    curlx_dyn_ptr(&pp->recvbuf) + 4; /* start on the first letter */
 
   /* if we come here again, make sure the former name is cleared */
   Curl_safefree(ftpc->newhost);
@@ -1824,7 +1824,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data,
       if((ptr[1] == sep) && (ptr[2] == sep) && ISDIGIT(ptr[3])) {
         const char *p = &ptr[3];
         curl_off_t num;
-        if(Curl_str_number(&p, &num, 0xffff) || (*p != sep)) {
+        if(curlx_str_number(&p, &num, 0xffff) || (*p != sep)) {
           failf(data, "Illegal port number in EPSV reply");
           return CURLE_FTP_WEIRD_PASV_REPLY;
         }
@@ -2073,7 +2073,7 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
          last .sss part is optional and means fractions of a second */
       int year, month, day, hour, minute, second;
       struct pingpong *pp = &ftpc->pp;
-      char *resp = Curl_dyn_ptr(&pp->recvbuf) + 4;
+      char *resp = curlx_dyn_ptr(&pp->recvbuf) + 4;
       if(ftp_213_date(resp, &year, &month, &day, &hour, &minute, &second)) {
         /* we have a time, reformat it */
         char timebuf[24];
@@ -2297,7 +2297,7 @@ static CURLcode ftp_state_size_resp(struct Curl_easy *data,
 {
   CURLcode result = CURLE_OK;
   curl_off_t filesize = -1;
-  char *buf = Curl_dyn_ptr(&ftpc->pp.recvbuf);
+  char *buf = curlx_dyn_ptr(&ftpc->pp.recvbuf);
   size_t len = ftpc->pp.nfinal;
 
   /* get the size from the ascii string: */
@@ -2316,7 +2316,7 @@ static CURLcode ftp_state_size_resp(struct Curl_easy *data,
     }
     else
       fdigit = start;
-    if(Curl_str_number(&fdigit, &filesize, CURL_OFF_T_MAX))
+    if(curlx_str_number(&fdigit, &filesize, CURL_OFF_T_MAX))
       filesize = -1; /* size remain unknown */
   }
   else if(ftpcode == 550) { /* "No such file or directory" */
@@ -2479,7 +2479,7 @@ static CURLcode ftp_state_get_resp(struct Curl_easy *data,
        *
        * Example D above makes this parsing a little tricky */
       const char *bytes;
-      char *buf = Curl_dyn_ptr(&ftpc->pp.recvbuf);
+      char *buf = curlx_dyn_ptr(&ftpc->pp.recvbuf);
       bytes = strstr(buf, " bytes");
       if(bytes) {
         long in = (long)(--bytes-buf);
@@ -2500,7 +2500,7 @@ static CURLcode ftp_state_get_resp(struct Curl_easy *data,
         if(bytes) {
           ++bytes;
           /* get the number! */
-          if(Curl_str_number(&bytes, &size, CURL_OFF_T_MAX))
+          if(curlx_str_number(&bytes, &size, CURL_OFF_T_MAX))
             size = 1;
         }
       }
@@ -2854,11 +2854,11 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data,
 
     case FTP_PWD:
       if(ftpcode == 257) {
-        char *ptr = Curl_dyn_ptr(&pp->recvbuf) + 4; /* start on the first
-                                                       letter */
+        char *ptr = curlx_dyn_ptr(&pp->recvbuf) + 4; /* start on the first
+                                                        letter */
         bool entry_extracted = FALSE;
         struct dynbuf out;
-        Curl_dyn_init(&out, 1000);
+        curlx_dyn_init(&out, 1000);
 
         /* Reply format is like
            257<space>[rubbish]"<directory-name>"<space><commentary> and the
@@ -2879,18 +2879,18 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data,
             if('\"' == *ptr) {
               if('\"' == ptr[1]) {
                 /* "quote-doubling" */
-                result = Curl_dyn_addn(&out, &ptr[1], 1);
+                result = curlx_dyn_addn(&out, &ptr[1], 1);
                 ptr++;
               }
               else {
                 /* end of path */
-                if(Curl_dyn_len(&out))
+                if(curlx_dyn_len(&out))
                   entry_extracted = TRUE;
                 break; /* get out of this loop */
               }
             }
             else
-              result = Curl_dyn_addn(&out, ptr, 1);
+              result = curlx_dyn_addn(&out, ptr, 1);
             if(result)
               return result;
           }
@@ -2907,7 +2907,7 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data,
                The method used here is to check the server OS: we do it only
              if the path name looks strange to minimize overhead on other
              systems. */
-          char *dir = Curl_dyn_ptr(&out);
+          char *dir = curlx_dyn_ptr(&out);
 
           if(!ftpc->server_os && dir[0] != '/') {
             result = Curl_pp_sendf(data, &ftpc->pp, "%s", "SYST");
@@ -2938,7 +2938,7 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data,
         }
         else {
           /* could not get the path */
-          Curl_dyn_free(&out);
+          curlx_dyn_free(&out);
           infof(data, "Failed to figure out path");
         }
       }
@@ -2948,7 +2948,7 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data,
 
     case FTP_SYST:
       if(ftpcode == 215) {
-        char *ptr = Curl_dyn_ptr(&pp->recvbuf) + 4; /* start on the first
+        char *ptr = curlx_dyn_ptr(&pp->recvbuf) + 4; /* start on the first
                                                        letter */
         char *os;
         char *start;
@@ -3351,7 +3351,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
     timediff_t old_time = pp->response_time;
 
     pp->response_time = 60*1000; /* give it only a minute for now */
-    pp->response = Curl_now(); /* timeout relative now */
+    pp->response = curlx_now(); /* timeout relative now */
 
     result = Curl_GetFTPResponse(data, &nread, &ftpcode);
 
@@ -3476,7 +3476,7 @@ CURLcode ftp_sendquote(struct Curl_easy *data,
 
       result = Curl_pp_sendf(data, &ftpc->pp, "%s", cmd);
       if(!result) {
-        pp->response = Curl_now(); /* timeout relative now */
+        pp->response = curlx_now(); /* timeout relative now */
         result = Curl_GetFTPResponse(data, &nread, &ftpcode);
       }
       if(result)
index b5739bd3f01a5e8abb856cfeec261ba3dd0608f2..f15759fb2bf361112d1e8288ef465a942badde3a 100644 (file)
@@ -50,7 +50,7 @@
 #include "ftplistparser.h"
 #include "curl_fnmatch.h"
 #include "multiif.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -318,7 +318,7 @@ static CURLcode ftp_pl_insert_finfo(struct Curl_easy *data,
   struct curl_fileinfo *finfo = &infop->info;
 
   /* set the finfo pointers */
-  char *str = Curl_dyn_ptr(&infop->buf);
+  char *str = curlx_dyn_ptr(&infop->buf);
   finfo->filename       = str + parser->offsets.filename;
   finfo->strings.group  = parser->offsets.group ?
                           str + parser->offsets.group : NULL;
@@ -403,18 +403,18 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
       }
       parser->item_offset = 0;
       parser->item_length = 0;
-      Curl_dyn_init(&parser->file_data->buf, MAX_FTPLIST_BUFFER);
+      curlx_dyn_init(&parser->file_data->buf, MAX_FTPLIST_BUFFER);
     }
 
     infop = parser->file_data;
     finfo = &infop->info;
 
-    if(Curl_dyn_addn(&infop->buf, &c, 1)) {
+    if(curlx_dyn_addn(&infop->buf, &c, 1)) {
       parser->error = CURLE_OUT_OF_MEMORY;
       goto fail;
     }
-    len = Curl_dyn_len(&infop->buf);
-    mem = Curl_dyn_ptr(&infop->buf);
+    len = curlx_dyn_len(&infop->buf);
+    mem = curlx_dyn_ptr(&infop->buf);
 
     switch(parser->os_type) {
     case OS_TYPE_UNIX:
@@ -429,7 +429,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
           else {
             parser->state.UNIX.main = PL_UNIX_FILETYPE;
             /* start FSM again not considering size of directory */
-            Curl_dyn_reset(&infop->buf);
+            curlx_dyn_reset(&infop->buf);
             continue;
           }
           break;
@@ -437,7 +437,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
           parser->item_length++;
           if(c == '\r') {
             parser->item_length--;
-            Curl_dyn_setlen(&infop->buf, --len);
+            curlx_dyn_setlen(&infop->buf, --len);
           }
           else if(c == '\n') {
             mem[parser->item_length - 1] = 0;
@@ -445,7 +445,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
               const char *endptr = mem + 6;
               /* here we can deal with directory size, pass the leading
                  whitespace and then the digits */
-              Curl_str_passblanks(&endptr);
+              curlx_str_passblanks(&endptr);
               while(ISDIGIT(*endptr))
                 endptr++;
               if(*endptr) {
@@ -453,7 +453,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
                 goto fail;
               }
               parser->state.UNIX.main = PL_UNIX_FILETYPE;
-              Curl_dyn_reset(&infop->buf);
+              curlx_dyn_reset(&infop->buf);
             }
             else {
               parser->error = CURLE_FTP_BAD_FILE_LIST;
@@ -548,7 +548,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
             curl_off_t hlinks;
             mem[parser->item_offset + parser->item_length - 1] = 0;
 
-            if(!Curl_str_number(&p, &hlinks, LONG_MAX)) {
+            if(!curlx_str_number(&p, &hlinks, LONG_MAX)) {
               parser->file_data->info.flags |= CURLFINFOFLAG_KNOWN_HLINKCOUNT;
               parser->file_data->info.hardlinks = (long)hlinks;
             }
@@ -629,7 +629,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
             const char *p = mem + parser->item_offset;
             curl_off_t fsize;
             mem[parser->item_offset + parser->item_length - 1] = 0;
-            if(!Curl_str_numblanks(&p, &fsize)) {
+            if(!curlx_str_numblanks(&p, &fsize)) {
               if(p[0] == '\0' && fsize != CURL_OFF_T_MAX) {
                 parser->file_data->info.flags |= CURLFINFOFLAG_KNOWN_SIZE;
                 parser->file_data->info.size = fsize;
@@ -952,7 +952,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
             }
             else {
               const char *p = mem + parser->item_offset;
-              if(Curl_str_numblanks(&p, &finfo->size)) {
+              if(curlx_str_numblanks(&p, &finfo->size)) {
                 parser->error = CURLE_FTP_BAD_FILE_LIST;
                 goto fail;
               }
index cefa01ca7fbb0d6fca63a43e4d783da5dbdc77b8..a81521040c7ffc718cdcf278a28a501d4cf8106a 100644 (file)
@@ -31,7 +31,7 @@
 #include "vtls/vtls.h"
 #include "connect.h" /* Curl_getconnectinfo() */
 #include "progress.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last #include files should be: */
 #include "curl_memory.h"
@@ -207,7 +207,7 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
   const char *timestr = getenv("CURL_TIME");
   if(timestr) {
     curl_off_t val;
-    Curl_str_number(&timestr, &val, TIME_T_MAX);
+    curlx_str_number(&timestr, &val, TIME_T_MAX);
     switch(info) {
     case CURLINFO_LOCAL_PORT:
       *param_longp = (long)val;
@@ -220,7 +220,7 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
   timestr = getenv("CURL_DEBUG_SIZE");
   if(timestr) {
     curl_off_t val;
-    Curl_str_number(&timestr, &val, LONG_MAX);
+    curlx_str_number(&timestr, &val, LONG_MAX);
     switch(info) {
     case CURLINFO_HEADER_SIZE:
     case CURLINFO_REQUEST_SIZE:
@@ -384,7 +384,7 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
   const char *timestr = getenv("CURL_TIME");
   if(timestr) {
     curl_off_t val;
-    Curl_str_number(&timestr, &val, CURL_OFF_T_MAX);
+    curlx_str_number(&timestr, &val, CURL_OFF_T_MAX);
 
     switch(info) {
     case CURLINFO_TOTAL_TIME_T:
@@ -483,7 +483,7 @@ static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info,
   const char *timestr = getenv("CURL_TIME");
   if(timestr) {
     curl_off_t val;
-    Curl_str_number(&timestr, &val, CURL_OFF_T_MAX);
+    curlx_str_number(&timestr, &val, CURL_OFF_T_MAX);
 
     switch(info) {
     case CURLINFO_TOTAL_TIME:
index aa003900d5022f3a6f27ed8fc4f41e8432736039..68ccb59e408a419ab63eececccbf2d4e477d3195 100644 (file)
@@ -39,7 +39,7 @@
 #include "vtls/vtls.h"
 #include "url.h"
 #include "escape.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "curl_printf.h"
 #include "curl_memory.h"
 /* The last #include file should be: */
index cd741659bedee4c274aa670d5d1ff8ac57b2d96e..8d13aae483af8f315b35cfe882484fdc856a31a9 100644 (file)
@@ -352,7 +352,7 @@ size_t Curl_hash_str(void *key, size_t key_length, size_t slots_num)
   return (h % slots_num);
 }
 
-size_t Curl_str_key_compare(void *k1, size_t key1_len,
+size_t curlx_str_key_compare(void *k1, size_t key1_len,
                             void *k2, size_t key2_len)
 {
   if((key1_len == key2_len) && !memcmp(k1, k2, key1_len))
index f429c76ccf9b1bf7d9240272ec6f8763808a83e3..314b811e4a4d58c0c17bbaed9893f957eb9717c7 100644 (file)
@@ -98,7 +98,7 @@ void Curl_hash_clean(struct Curl_hash *h);
 void Curl_hash_clean_with_criterium(struct Curl_hash *h, void *user,
                                     int (*comp)(void *, void *));
 size_t Curl_hash_str(void *key, size_t key_length, size_t slots_num);
-size_t Curl_str_key_compare(void *k1, size_t key1_len, void *k2,
+size_t curlx_str_key_compare(void *k1, size_t key1_len, void *k2,
                             size_t key2_len);
 void Curl_hash_start_iterate(struct Curl_hash *hash,
                              struct Curl_hash_iterator *iter);
index 1ae447a73dd030efbb4414025f9b6bdd49f2a282..c1ff58c931e969fe675ef074c203264718ad8981 100644 (file)
@@ -29,7 +29,7 @@
 #include "strcase.h"
 #include "sendf.h"
 #include "headers.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
index 7b8a29e69232b6c06bc9a5853fabf575a269db01..3af1f292dac22d1d30a19d0cc9d1fe4f9bcab162 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "curl_hmac.h"
 #include "curl_memory.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 
 /* The last #include file should be: */
 #include "memdebug.h"
index 365151e8a6c26b65f7c14c18bae24c322e92c9f0..77b69d1449cda9fbdaf266024860c51a066debc6 100644 (file)
 #include "inet_pton.h"
 #include "multiif.h"
 #include "doh.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "select.h"
 #include "strcase.h"
 #include "easy_lock.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -1126,7 +1126,7 @@ clean_up:
      the time we spent until now! */
   if(prev_alarm) {
     /* there was an alarm() set before us, now put it back */
-    timediff_t elapsed_secs = Curl_timediff(Curl_now(),
+    timediff_t elapsed_secs = curlx_timediff(curlx_now(),
                                             data->conn->created) / 1000;
 
     /* the alarm period is counted in even number of seconds */
@@ -1197,7 +1197,7 @@ static void dnscache_entry_dtor(void *entry)
  */
 void Curl_dnscache_init(struct Curl_dnscache *dns, size_t size)
 {
-  Curl_hash_init(&dns->entries, size, Curl_hash_str, Curl_str_key_compare,
+  Curl_hash_init(&dns->entries, size, Curl_hash_str, curlx_str_key_compare,
                  dnscache_entry_dtor);
 }
 
@@ -1227,23 +1227,23 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
       curl_off_t num = 0;
       size_t entry_len;
       host++;
-      if(!Curl_str_single(&host, '[')) {
-        if(Curl_str_until(&host, &source, MAX_IPADR_LEN, ']') ||
-           Curl_str_single(&host, ']') ||
-           Curl_str_single(&host, ':'))
+      if(!curlx_str_single(&host, '[')) {
+        if(curlx_str_until(&host, &source, MAX_IPADR_LEN, ']') ||
+           curlx_str_single(&host, ']') ||
+           curlx_str_single(&host, ':'))
           continue;
       }
       else {
-        if(Curl_str_until(&host, &source, 4096, ':') ||
-           Curl_str_single(&host, ':')) {
+        if(curlx_str_until(&host, &source, 4096, ':') ||
+           curlx_str_single(&host, ':')) {
           continue;
         }
       }
 
-      if(!Curl_str_number(&host, &num, 0xffff)) {
+      if(!curlx_str_number(&host, &num, 0xffff)) {
         /* Create an entry id, based upon the hostname and port */
-        entry_len = create_dnscache_id(Curl_str(&source),
-                                       Curl_strlen(&source), (int)num,
+        entry_len = create_dnscache_id(curlx_str(&source),
+                                       curlx_strlen(&source), (int)num,
                                        entry_id, sizeof(entry_id));
         dnscache_lock(data, dnscache);
         /* delete entry, ignore if it did not exist */
@@ -1267,18 +1267,18 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
         host++;
         permanent = FALSE;
       }
-      if(!Curl_str_single(&host, '[')) {
-        if(Curl_str_until(&host, &source, MAX_IPADR_LEN, ']') ||
-           Curl_str_single(&host, ']'))
+      if(!curlx_str_single(&host, '[')) {
+        if(curlx_str_until(&host, &source, MAX_IPADR_LEN, ']') ||
+           curlx_str_single(&host, ']'))
           continue;
       }
       else {
-        if(Curl_str_until(&host, &source, 4096, ':'))
+        if(curlx_str_until(&host, &source, 4096, ':'))
           continue;
       }
-      if(Curl_str_single(&host, ':') ||
-         Curl_str_number(&host, &port, 0xffff) ||
-         Curl_str_single(&host, ':'))
+      if(curlx_str_single(&host, ':') ||
+         curlx_str_number(&host, &port, 0xffff) ||
+         curlx_str_single(&host, ':'))
         goto err;
 
 #if !defined(CURL_DISABLE_VERBOSE_STRINGS)
@@ -1290,14 +1290,14 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
         struct Curl_str target;
         struct Curl_addrinfo *ai;
 
-        if(!Curl_str_single(&host, '[')) {
-          if(Curl_str_until(&host, &target, MAX_IPADR_LEN, ']') ||
-             Curl_str_single(&host, ']'))
+        if(!curlx_str_single(&host, '[')) {
+          if(curlx_str_until(&host, &target, MAX_IPADR_LEN, ']') ||
+             curlx_str_single(&host, ']'))
             goto err;
         }
         else {
-          if(Curl_str_until(&host, &target, 4096, ',')) {
-            if(Curl_str_single(&host, ','))
+          if(curlx_str_until(&host, &target, 4096, ',')) {
+            if(curlx_str_single(&host, ','))
               goto err;
             /* survive nothing but just a comma */
             continue;
@@ -1307,17 +1307,17 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
         if(memchr(target.str, ':', target.len)) {
           infof(data, "Ignoring resolve address '%s', missing IPv6 support.",
                 address);
-          if(Curl_str_single(&host, ','))
+          if(curlx_str_single(&host, ','))
             goto err;
           continue;
         }
 #endif
 
-        if(Curl_strlen(&target) >= sizeof(address))
+        if(curlx_strlen(&target) >= sizeof(address))
           goto err;
 
-        memcpy(address, Curl_str(&target), Curl_strlen(&target));
-        address[Curl_strlen(&target)] = '\0';
+        memcpy(address, curlx_str(&target), curlx_strlen(&target));
+        address[curlx_strlen(&target)] = '\0';
 
         ai = Curl_str2addr(address, (int)port);
         if(!ai) {
@@ -1332,7 +1332,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
         else {
           head = tail = ai;
         }
-        if(Curl_str_single(&host, ','))
+        if(curlx_str_single(&host, ','))
           break;
       }
 
@@ -1349,7 +1349,7 @@ err:
       }
 
       /* Create an entry id, based upon the hostname and port */
-      entry_len = create_dnscache_id(Curl_str(&source), Curl_strlen(&source),
+      entry_len = create_dnscache_id(curlx_str(&source), curlx_strlen(&source),
                                      (int)port,
                                      entry_id, sizeof(entry_id));
 
@@ -1360,8 +1360,8 @@ err:
 
       if(dns) {
         infof(data, "RESOLVE %.*s:%" CURL_FORMAT_CURL_OFF_T
-              " - old addresses discarded", (int)Curl_strlen(&source),
-              Curl_str(&source), port);
+              " - old addresses discarded", (int)curlx_strlen(&source),
+              curlx_str(&source), port);
         /* delete old entry, there are two reasons for this
          1. old entry may have different addresses.
          2. even if entry with correct addresses is already in the cache,
@@ -1377,8 +1377,8 @@ err:
       }
 
       /* put this new host in the cache */
-      dns = dnscache_add_addr(data, dnscache, head, Curl_str(&source),
-                              Curl_strlen(&source), (int)port, permanent);
+      dns = dnscache_add_addr(data, dnscache, head, curlx_str(&source),
+                              curlx_strlen(&source), (int)port, permanent);
       if(dns) {
         /* release the returned reference; the cache itself will keep the
          * entry alive: */
@@ -1392,12 +1392,12 @@ err:
 
 #ifndef CURL_DISABLE_VERBOSE_STRINGS
       infof(data, "Added %.*s:%" CURL_FORMAT_CURL_OFF_T ":%s to DNS cache%s",
-            (int)Curl_strlen(&source), Curl_str(&source), port, addresses,
+            (int)curlx_strlen(&source), curlx_str(&source), port, addresses,
             permanent ? "" : " (non-permanent)");
 #endif
 
       /* Wildcard hostname */
-      if(Curl_str_casecompare(&source, "*")) {
+      if(curlx_str_casecompare(&source, "*")) {
         infof(data, "RESOLVE *:%" CURL_FORMAT_CURL_OFF_T " using wildcard",
               port);
         data->state.wildcard_resolve = TRUE;
@@ -1433,9 +1433,9 @@ static void show_resolve_info(struct Curl_easy *data,
   infof(data, "Host %s:%d was resolved.",
         (dns->hostname[0] ? dns->hostname : "(none)"), dns->hostport);
 
-  Curl_dyn_init(&out[0], 1024);
+  curlx_dyn_init(&out[0], 1024);
 #ifdef CURLRES_IPV6
-  Curl_dyn_init(&out[1], 1024);
+  curlx_dyn_init(&out[1], 1024);
 #endif
 
   while(a) {
@@ -1447,10 +1447,10 @@ static void show_resolve_info(struct Curl_easy *data,
       char buf[MAX_IPADR_LEN];
       struct dynbuf *d = &out[(a->ai_family != PF_INET)];
       Curl_printable_address(a, buf, sizeof(buf));
-      if(Curl_dyn_len(d))
-        result = Curl_dyn_addn(d, ", ", 2);
+      if(curlx_dyn_len(d))
+        result = curlx_dyn_addn(d, ", ", 2);
       if(!result)
-        result = Curl_dyn_add(d, buf);
+        result = curlx_dyn_add(d, buf);
       if(result) {
         infof(data, "too many IP, cannot show");
         goto fail;
@@ -1461,15 +1461,15 @@ static void show_resolve_info(struct Curl_easy *data,
 
 #ifdef CURLRES_IPV6
   infof(data, "IPv6: %s",
-        (Curl_dyn_len(&out[1]) ? Curl_dyn_ptr(&out[1]) : "(none)"));
+        (curlx_dyn_len(&out[1]) ? curlx_dyn_ptr(&out[1]) : "(none)"));
 #endif
   infof(data, "IPv4: %s",
-        (Curl_dyn_len(&out[0]) ? Curl_dyn_ptr(&out[0]) : "(none)"));
+        (curlx_dyn_len(&out[0]) ? curlx_dyn_ptr(&out[0]) : "(none)"));
 
 fail:
-  Curl_dyn_free(&out[0]);
+  curlx_dyn_free(&out[0]);
 #ifdef CURLRES_IPV6
-  Curl_dyn_free(&out[1]);
+  curlx_dyn_free(&out[1]);
 #endif
 }
 #endif
index 43d80ba730af477c047884158471465312187642..4b652c87a08b1c1ae248fe63f616271220e66c4f 100644 (file)
@@ -27,7 +27,7 @@
 #include "curl_setup.h"
 #include "hash.h"
 #include "curl_addrinfo.h"
-#include "timeval.h" /* for timediff_t */
+#include "curlx/timeval.h" /* for timediff_t */
 #include "asyn.h"
 #include "httpsrr.h"
 
index 0724bd0a918450e797d6e44717525ba8e58f28c4..ccfc55dd295b805dbbe56a61f525a89f082bce9c 100644 (file)
@@ -40,7 +40,7 @@
 #include "rename.h"
 #include "share.h"
 #include "strdup.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -62,7 +62,7 @@ static time_t hsts_debugtime(void *unused)
   (void)unused;
   if(timestr) {
     curl_off_t val;
-    if(!Curl_str_number(&timestr, &val, TIME_T_MAX))
+    if(!curlx_str_number(&timestr, &val, TIME_T_MAX))
       val += (curl_off_t)deltatime;
     return (time_t)val;
   }
@@ -154,7 +154,7 @@ CURLcode Curl_hsts_parse(struct hsts *h, const char *hostname,
     return CURLE_OK;
 
   do {
-    Curl_str_passblanks(&p);
+    curlx_str_passblanks(&p);
     if(strncasecompare("max-age", p, 7)) {
       bool quoted = FALSE;
       int rc;
@@ -163,15 +163,15 @@ CURLcode Curl_hsts_parse(struct hsts *h, const char *hostname,
         return CURLE_BAD_FUNCTION_ARGUMENT;
 
       p += 7;
-      Curl_str_passblanks(&p);
-      if(Curl_str_single(&p, '='))
+      curlx_str_passblanks(&p);
+      if(curlx_str_single(&p, '='))
         return CURLE_BAD_FUNCTION_ARGUMENT;
-      Curl_str_passblanks(&p);
+      curlx_str_passblanks(&p);
 
-      if(!Curl_str_single(&p, '\"'))
+      if(!curlx_str_single(&p, '\"'))
         quoted = TRUE;
 
-      rc = Curl_str_number(&p, &expires, TIME_T_MAX);
+      rc = curlx_str_number(&p, &expires, TIME_T_MAX);
       if(rc == STRE_OVERFLOW)
         expires = CURL_OFF_T_MAX;
       else if(rc)
@@ -198,7 +198,7 @@ CURLcode Curl_hsts_parse(struct hsts *h, const char *hostname,
         p++;
     }
 
-    Curl_str_passblanks(&p);
+    curlx_str_passblanks(&p);
     if(*p == ';')
       p++;
   } while(*p);
@@ -417,10 +417,10 @@ static CURLcode hsts_add(struct hsts *h, const char *line)
   struct Curl_str host;
   struct Curl_str date;
 
-  if(Curl_str_word(&line, &host, MAX_HSTS_HOSTLEN) ||
-     Curl_str_singlespace(&line) ||
-     Curl_str_quotedword(&line, &date, MAX_HSTS_DATELEN) ||
-     Curl_str_newline(&line))
+  if(curlx_str_word(&line, &host, MAX_HSTS_HOSTLEN) ||
+     curlx_str_singlespace(&line) ||
+     curlx_str_quotedword(&line, &date, MAX_HSTS_DATELEN) ||
+     curlx_str_newline(&line))
     ;
   else {
     CURLcode result = CURLE_OK;
@@ -428,26 +428,26 @@ static CURLcode hsts_add(struct hsts *h, const char *line)
     struct stsentry *e;
     char dbuf[MAX_HSTS_DATELEN + 1];
     time_t expires;
-    const char *hp = Curl_str(&host);
+    const char *hp = curlx_str(&host);
 
     /* The date parser works on a null terminated string. The maximum length
-       is upheld by Curl_str_quotedword(). */
-    memcpy(dbuf, Curl_str(&date), Curl_strlen(&date));
-    dbuf[Curl_strlen(&date)] = 0;
+       is upheld by curlx_str_quotedword(). */
+    memcpy(dbuf, curlx_str(&date), curlx_strlen(&date));
+    dbuf[curlx_strlen(&date)] = 0;
 
     expires = strcmp(dbuf, UNLIMITED) ? Curl_getdate_capped(dbuf) :
       TIME_T_MAX;
 
     if(hp[0] == '.') {
-      Curl_str_nudge(&host, 1);
+      curlx_str_nudge(&host, 1);
       subdomain = TRUE;
     }
     /* only add it if not already present */
-    e = Curl_hsts(h, Curl_str(&host), Curl_strlen(&host), subdomain);
+    e = Curl_hsts(h, curlx_str(&host), curlx_strlen(&host), subdomain);
     if(!e)
-      result = hsts_create(h, Curl_str(&host), Curl_strlen(&host),
+      result = hsts_create(h, curlx_str(&host), curlx_strlen(&host),
                            subdomain, expires);
-    else if(Curl_str_casecompare(&host, e->host)) {
+    else if(curlx_str_casecompare(&host, e->host)) {
       /* the same hostname, use the largest expire time */
       if(expires > e->expires)
         e->expires = expires;
@@ -526,10 +526,10 @@ static CURLcode hsts_load(struct hsts *h, const char *file)
   fp = fopen(file, FOPEN_READTEXT);
   if(fp) {
     struct dynbuf buf;
-    Curl_dyn_init(&buf, MAX_HSTS_LINE);
+    curlx_dyn_init(&buf, MAX_HSTS_LINE);
     while(Curl_get_line(&buf, fp)) {
-      const char *lineptr = Curl_dyn_ptr(&buf);
-      Curl_str_passblanks(&lineptr);
+      const char *lineptr = curlx_dyn_ptr(&buf);
+      curlx_str_passblanks(&lineptr);
 
       /*
        * Skip empty or commented lines, since we know the line will have a
@@ -540,7 +540,7 @@ static CURLcode hsts_load(struct hsts *h, const char *file)
 
       hsts_add(h, lineptr);
     }
-    Curl_dyn_free(&buf); /* free the line buffer */
+    curlx_dyn_free(&buf); /* free the line buffer */
     fclose(fp);
   }
   return result;
index 4013678519d5f93557336ed2a1c3b052c10c03cd..8c593f5a733b2d8c2b525f8e607c7942a738f431 100644 (file)
@@ -54,7 +54,7 @@
 #include "formdata.h"
 #include "mime.h"
 #include "progress.h"
-#include "curl_base64.h"
+#include "curlx/base64.h"
 #include "cookie.h"
 #include "vauth/vauth.h"
 #include "vtls/vtls.h"
@@ -76,7 +76,7 @@
 #include "strcase.h"
 #include "content_encoding.h"
 #include "http_proxy.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "http2.h"
 #include "cfilters.h"
 #include "connect.h"
@@ -85,7 +85,7 @@
 #include "hsts.h"
 #include "ws.h"
 #include "curl_ctype.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -116,7 +116,7 @@ static CURLcode http_req_set_reader(struct Curl_easy *data,
                                     const char **tep);
 static CURLcode http_size(struct Curl_easy *data);
 static CURLcode http_statusline(struct Curl_easy *data,
-                                     struct connectdata *conn);
+                                struct connectdata *conn);
 static CURLcode http_target(struct Curl_easy *data, struct connectdata *conn,
                             struct dynbuf *req);
 static CURLcode http_useragent(struct Curl_easy *data);
@@ -285,12 +285,12 @@ char *Curl_copy_header_value(const char *header)
   struct Curl_str out;
 
   /* find the end of the header name */
-  if(!Curl_str_cspn(&header, &out, ";:") &&
-     (!Curl_str_single(&header, ':') || !Curl_str_single(&header, ';'))) {
-    Curl_str_untilnl(&header, &out, MAX_HTTP_RESP_HEADER_SIZE);
-    Curl_str_trimblanks(&out);
+  if(!curlx_str_cspn(&header, &out, ";:") &&
+     (!curlx_str_single(&header, ':') || !curlx_str_single(&header, ';'))) {
+    curlx_str_untilnl(&header, &out, MAX_HTTP_RESP_HEADER_SIZE);
+    curlx_str_trimblanks(&out);
 
-    return Curl_memdup0(Curl_str(&out), Curl_strlen(&out));
+    return Curl_memdup0(curlx_str(&out), curlx_strlen(&out));
   }
   /* bad input */
   return NULL;
@@ -336,7 +336,7 @@ static CURLcode http_output_basic(struct Curl_easy *data, bool proxy)
   if(!out)
     return CURLE_OUT_OF_MEMORY;
 
-  result = Curl_base64_encode(out, strlen(out), &authorization, &size);
+  result = curlx_base64_encode(out, strlen(out), &authorization, &size);
   if(result)
     goto fail;
 
@@ -768,12 +768,12 @@ Curl_http_output_auth(struct Curl_easy *data,
 #ifndef CURL_DISABLE_PROXY
     (conn->bits.httpproxy && conn->bits.proxy_user_passwd) ||
 #endif
-     data->state.aptr.user ||
+    data->state.aptr.user ||
 #ifdef USE_SPNEGO
-     authhost->want & CURLAUTH_NEGOTIATE ||
-     authproxy->want & CURLAUTH_NEGOTIATE ||
+    authhost->want & CURLAUTH_NEGOTIATE ||
+    authproxy->want & CURLAUTH_NEGOTIATE ||
 #endif
-     data->set.str[STRING_BEARER])
+    data->set.str[STRING_BEARER])
     /* continue please */;
   else {
     authhost->done = TRUE;
@@ -1073,7 +1073,7 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
       auth++;
     else
       break;
-    Curl_str_passblanks(&auth);
+    curlx_str_passblanks(&auth);
   }
   return result;
 #else
@@ -1474,15 +1474,15 @@ Curl_compareheader(const char *headerline, /* line to check */
   /* pass the header */
   p = &headerline[hlen];
 
-  if(Curl_str_untilnl(&p, &val, MAX_HTTP_RESP_HEADER_SIZE))
+  if(curlx_str_untilnl(&p, &val, MAX_HTTP_RESP_HEADER_SIZE))
     return FALSE;
-  Curl_str_trimblanks(&val);
+  curlx_str_trimblanks(&val);
 
   /* find the content string in the rest of the line */
-  if(Curl_strlen(&val) >= clen) {
+  if(curlx_strlen(&val) >= clen) {
     size_t len;
-    p = Curl_str(&val);
-    for(len = Curl_strlen(&val); len >= Curl_strlen(&val); len--, p++) {
+    p = curlx_str(&val);
+    for(len = curlx_strlen(&val); len >= curlx_strlen(&val); len--, p++) {
       if(strncasecompare(p, content, clen))
         return TRUE; /* match! */
     }
@@ -1533,7 +1533,7 @@ CURLcode Curl_http_done(struct Curl_easy *data,
   data->state.authhost.multipass = FALSE;
   data->state.authproxy.multipass = FALSE;
 
-  Curl_dyn_reset(&data->state.headerb);
+  curlx_dyn_reset(&data->state.headerb);
 
   if(status)
     return status;
@@ -1654,19 +1654,19 @@ CURLcode Curl_add_custom_headers(struct Curl_easy *data,
       /* explicitly asked to send header without content is done by a header
          that ends with a semicolon, but there must be no colon present in the
          name */
-      if(!Curl_str_until(&p, &name, MAX_HTTP_RESP_HEADER_SIZE, ';') &&
-         !Curl_str_single(&p, ';') &&
-         !Curl_str_single(&p, '\0') &&
-         !memchr(Curl_str(&name), ':', Curl_strlen(&name)))
+      if(!curlx_str_until(&p, &name, MAX_HTTP_RESP_HEADER_SIZE, ';') &&
+         !curlx_str_single(&p, ';') &&
+         !curlx_str_single(&p, '\0') &&
+         !memchr(curlx_str(&name), ':', curlx_strlen(&name)))
         blankheader = TRUE;
       else {
         p = origp;
-        if(!Curl_str_until(&p, &name, MAX_HTTP_RESP_HEADER_SIZE, ':') &&
-           !Curl_str_single(&p, ':')) {
+        if(!curlx_str_until(&p, &name, MAX_HTTP_RESP_HEADER_SIZE, ':') &&
+           !curlx_str_single(&p, ':')) {
           struct Curl_str val;
-          Curl_str_untilnl(&p, &val, MAX_HTTP_RESP_HEADER_SIZE);
-          Curl_str_trimblanks(&val);
-          if(!Curl_strlen(&val))
+          curlx_str_untilnl(&p, &val, MAX_HTTP_RESP_HEADER_SIZE);
+          curlx_str_trimblanks(&val);
+          if(!curlx_strlen(&val))
             /* no content, don't send this */
             continue;
         }
@@ -1681,41 +1681,41 @@ CURLcode Curl_add_custom_headers(struct Curl_easy *data,
          /* a Host: header was sent already, do not pass on any custom
             Host: header as that will produce *two* in the same
             request! */
-         Curl_str_casecompare(&name, "Host"))
+         curlx_str_casecompare(&name, "Host"))
         ;
       else if(data->state.httpreq == HTTPREQ_POST_FORM &&
               /* this header (extended by formdata.c) is sent later */
-              Curl_str_casecompare(&name, "Content-Type"))
+              curlx_str_casecompare(&name, "Content-Type"))
         ;
       else if(data->state.httpreq == HTTPREQ_POST_MIME &&
               /* this header is sent later */
-              Curl_str_casecompare(&name, "Content-Type"))
+              curlx_str_casecompare(&name, "Content-Type"))
         ;
       else if(data->req.authneg &&
               /* while doing auth neg, do not allow the custom length since
                  we will force length zero then */
-              Curl_str_casecompare(&name, "Content-Length"))
+              curlx_str_casecompare(&name, "Content-Length"))
         ;
       else if(data->state.aptr.te &&
               /* when asking for Transfer-Encoding, do not pass on a custom
                  Connection: */
-              Curl_str_casecompare(&name, "Connection"))
+              curlx_str_casecompare(&name, "Connection"))
         ;
       else if((httpversion >= 20) &&
-              Curl_str_casecompare(&name, "Transfer-Encoding"))
+              curlx_str_casecompare(&name, "Transfer-Encoding"))
         /* HTTP/2 does not support chunked requests */
         ;
-      else if((Curl_str_casecompare(&name, "Authorization") ||
-               Curl_str_casecompare(&name, "Cookie")) &&
+      else if((curlx_str_casecompare(&name, "Authorization") ||
+               curlx_str_casecompare(&name, "Cookie")) &&
               /* be careful of sending this potentially sensitive header to
                  other hosts */
               !Curl_auth_allowed_to_host(data))
         ;
       else if(blankheader)
-        result = Curl_dyn_addf(req, "%.*s:\r\n", (int)Curl_strlen(&name),
-                               Curl_str(&name));
+        result = curlx_dyn_addf(req, "%.*s:\r\n", (int)curlx_strlen(&name),
+                                curlx_str(&name));
       else
-        result = Curl_dyn_addf(req, "%s\r\n", origp);
+        result = curlx_dyn_addf(req, "%s\r\n", origp);
 
       if(result)
         return result;
@@ -1790,7 +1790,7 @@ CURLcode Curl_add_timecondition(struct Curl_easy *data,
             tm->tm_min,
             tm->tm_sec);
 
-  result = Curl_dyn_add(req, datestr);
+  result = curlx_dyn_add(req, datestr);
   return result;
 }
 #else
@@ -2014,7 +2014,7 @@ static CURLcode http_target(struct Curl_easy *data,
     curl_url_cleanup(h);
 
     /* target or URL */
-    result = Curl_dyn_add(r, data->set.str[STRING_TARGET] ?
+    result = curlx_dyn_add(r, data->set.str[STRING_TARGET] ?
       data->set.str[STRING_TARGET] : url);
     free(url);
     if(result)
@@ -2035,8 +2035,8 @@ static CURLcode http_target(struct Curl_easy *data,
           }
         }
         if(!type) {
-          result = Curl_dyn_addf(r, ";type=%c",
-                                 data->state.prefer_ascii ? 'a' : 'i');
+          result = curlx_dyn_addf(r, ";type=%c",
+                                  data->state.prefer_ascii ? 'a' : 'i');
           if(result)
             return result;
         }
@@ -2049,11 +2049,11 @@ static CURLcode http_target(struct Curl_easy *data,
     (void)conn; /* not used in disabled-proxy builds */
 #endif
   {
-    result = Curl_dyn_add(r, path);
+    result = curlx_dyn_add(r, path);
     if(result)
       return result;
     if(query)
-      result = Curl_dyn_addf(r, "?%s", query);
+      result = curlx_dyn_addf(r, "?%s", query);
   }
 
   return result;
@@ -2311,7 +2311,7 @@ static CURLcode addexpect(struct Curl_easy *data, struct dynbuf *r,
        operations (as there is one packet coming back from the web server) */
     curl_off_t client_len = Curl_creader_client_length(data);
     if(client_len > EXPECT_100_THRESHOLD || client_len < 0) {
-      result = Curl_dyn_addn(r, STRCONST("Expect: 100-continue\r\n"));
+      result = curlx_dyn_addn(r, STRCONST("Expect: 100-continue\r\n"));
       if(result)
         return result;
       *announced_exp100 = TRUE;
@@ -2355,8 +2355,8 @@ static CURLcode http_req_complete(struct Curl_easy *data,
         !Curl_checkheaders(data, STRCONST("Content-Length")))) {
       /* we allow replacing this header if not during auth negotiation,
          although it is not very wise to actually set your own */
-      result = Curl_dyn_addf(r, "Content-Length: %" FMT_OFF_T "\r\n",
-                             req_clen);
+      result = curlx_dyn_addf(r, "Content-Length: %" FMT_OFF_T "\r\n",
+                              req_clen);
     }
     if(result)
       goto out;
@@ -2368,7 +2368,7 @@ static CURLcode http_req_complete(struct Curl_easy *data,
       struct curl_slist *hdr;
 
       for(hdr = data->state.mimepost->curlheaders; hdr; hdr = hdr->next) {
-        result = Curl_dyn_addf(r, "%s\r\n", hdr->data);
+        result = curlx_dyn_addf(r, "%s\r\n", hdr->data);
         if(result)
           goto out;
       }
@@ -2376,8 +2376,8 @@ static CURLcode http_req_complete(struct Curl_easy *data,
 #endif
     if(httpreq == HTTPREQ_POST) {
       if(!Curl_checkheaders(data, STRCONST("Content-Type"))) {
-        result = Curl_dyn_addn(r, STRCONST("Content-Type: application/"
-                                           "x-www-form-urlencoded\r\n"));
+        result = curlx_dyn_addn(r, STRCONST("Content-Type: application/"
+                                            "x-www-form-urlencoded\r\n"));
         if(result)
           goto out;
       }
@@ -2391,7 +2391,7 @@ static CURLcode http_req_complete(struct Curl_easy *data,
   }
 
   /* end of headers */
-  result = Curl_dyn_addn(r, STRCONST("\r\n"));
+  result = curlx_dyn_addn(r, STRCONST("\r\n"));
   if(!result) {
     Curl_pgrsSetUploadSize(data, req_clen);
     if(announced_exp100)
@@ -2447,7 +2447,7 @@ static CURLcode http_cookies(struct Curl_easy *data,
         if(co->value) {
           size_t add;
           if(!count) {
-            result = Curl_dyn_addn(r, STRCONST("Cookie: "));
+            result = curlx_dyn_addn(r, STRCONST("Cookie: "));
             if(result)
               break;
           }
@@ -2458,8 +2458,8 @@ static CURLcode http_cookies(struct Curl_easy *data,
             linecap = TRUE;
             break;
           }
-          result = Curl_dyn_addf(r, "%s%s=%s", count ? "; " : "",
-                                 co->name, co->value);
+          result = curlx_dyn_addf(r, "%s%s=%s", count ? "; " : "",
+                                  co->name, co->value);
           if(result)
             break;
           clen += add + (count ? 2 : 0);
@@ -2470,14 +2470,14 @@ static CURLcode http_cookies(struct Curl_easy *data,
     }
     if(addcookies && !result && !linecap) {
       if(!count)
-        result = Curl_dyn_addn(r, STRCONST("Cookie: "));
+        result = curlx_dyn_addn(r, STRCONST("Cookie: "));
       if(!result) {
-        result = Curl_dyn_addf(r, "%s%s", count ? "; " : "", addcookies);
+        result = curlx_dyn_addf(r, "%s%s", count ? "; " : "", addcookies);
         count++;
       }
     }
     if(count && !result)
-      result = Curl_dyn_addn(r, STRCONST("\r\n"));
+      result = curlx_dyn_addn(r, STRCONST("\r\n"));
 
     if(result)
       return result;
@@ -2766,19 +2766,19 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
     goto fail;
 
   /* initialize a dynamic send-buffer */
-  Curl_dyn_init(&req, DYN_HTTP_REQUEST);
+  curlx_dyn_init(&req, DYN_HTTP_REQUEST);
 
   /* make sure the header buffer is reset - if there are leftovers from a
      previous transfer */
-  Curl_dyn_reset(&data->state.headerb);
+  curlx_dyn_reset(&data->state.headerb);
 
   /* add the main request stuff */
   /* GET/HEAD/POST/PUT */
-  result = Curl_dyn_addf(&req, "%s ", request);
+  result = curlx_dyn_addf(&req, "%s ", request);
   if(!result)
     result = http_target(data, conn, &req);
   if(result) {
-    Curl_dyn_free(&req);
+    curlx_dyn_free(&req);
     goto fail;
   }
 
@@ -2787,62 +2787,62 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
     altused = aprintf("Alt-Used: %s:%d\r\n",
                       conn->conn_to_host.name, conn->conn_to_port);
     if(!altused) {
-      Curl_dyn_free(&req);
+      curlx_dyn_free(&req);
       return CURLE_OUT_OF_MEMORY;
     }
   }
 #endif
   result =
-    Curl_dyn_addf(&req,
-                  " HTTP/%s\r\n" /* HTTP version */
-                  "%s" /* host */
-                  "%s" /* proxyuserpwd */
-                  "%s" /* userpwd */
-                  "%s" /* range */
-                  "%s" /* user agent */
-                  "%s" /* accept */
-                  "%s" /* TE: */
-                  "%s" /* accept-encoding */
-                  "%s" /* referer */
-                  "%s" /* Proxy-Connection */
-                  "%s" /* transfer-encoding */
-                  "%s",/* Alt-Used */
-
-                  httpstring,
-                  (data->state.aptr.host ? data->state.aptr.host : ""),
+    curlx_dyn_addf(&req,
+                   " HTTP/%s\r\n" /* HTTP version */
+                   "%s" /* host */
+                   "%s" /* proxyuserpwd */
+                   "%s" /* userpwd */
+                   "%s" /* range */
+                   "%s" /* user agent */
+                   "%s" /* accept */
+                   "%s" /* TE: */
+                   "%s" /* accept-encoding */
+                   "%s" /* referer */
+                   "%s" /* Proxy-Connection */
+                   "%s" /* transfer-encoding */
+                   "%s",/* Alt-Used */
+
+                   httpstring,
+                   (data->state.aptr.host ? data->state.aptr.host : ""),
 #ifndef CURL_DISABLE_PROXY
-                  data->state.aptr.proxyuserpwd ?
-                  data->state.aptr.proxyuserpwd : "",
+                   data->state.aptr.proxyuserpwd ?
+                   data->state.aptr.proxyuserpwd : "",
 #else
-                  "",
+                   "",
 #endif
-                  data->state.aptr.userpwd ? data->state.aptr.userpwd : "",
-                  (data->state.use_range && data->state.aptr.rangeline) ?
-                  data->state.aptr.rangeline : "",
-                  (data->set.str[STRING_USERAGENT] &&
-                   *data->set.str[STRING_USERAGENT] &&
-                   data->state.aptr.uagent) ?
-                  data->state.aptr.uagent : "",
-                  p_accept ? p_accept : "",
-                  data->state.aptr.te ? data->state.aptr.te : "",
-                  (data->set.str[STRING_ENCODING] &&
-                   *data->set.str[STRING_ENCODING] &&
-                   data->state.aptr.accept_encoding) ?
-                  data->state.aptr.accept_encoding : "",
-                  (data->state.referer && data->state.aptr.ref) ?
-                  data->state.aptr.ref : "" /* Referer: <data> */,
+                   data->state.aptr.userpwd ? data->state.aptr.userpwd : "",
+                   (data->state.use_range && data->state.aptr.rangeline) ?
+                   data->state.aptr.rangeline : "",
+                   (data->set.str[STRING_USERAGENT] &&
+                    *data->set.str[STRING_USERAGENT] &&
+                    data->state.aptr.uagent) ?
+                   data->state.aptr.uagent : "",
+                   p_accept ? p_accept : "",
+                   data->state.aptr.te ? data->state.aptr.te : "",
+                   (data->set.str[STRING_ENCODING] &&
+                    *data->set.str[STRING_ENCODING] &&
+                    data->state.aptr.accept_encoding) ?
+                   data->state.aptr.accept_encoding : "",
+                   (data->state.referer && data->state.aptr.ref) ?
+                   data->state.aptr.ref : "" /* Referer: <data> */,
 #ifndef CURL_DISABLE_PROXY
-                  (conn->bits.httpproxy &&
-                   !conn->bits.tunnel_proxy &&
-                   !Curl_checkheaders(data, STRCONST("Proxy-Connection")) &&
-                   !Curl_checkProxyheaders(data, conn,
-                                           STRCONST("Proxy-Connection"))) ?
-                  "Proxy-Connection: Keep-Alive\r\n":"",
+                   (conn->bits.httpproxy &&
+                    !conn->bits.tunnel_proxy &&
+                    !Curl_checkheaders(data, STRCONST("Proxy-Connection")) &&
+                    !Curl_checkProxyheaders(data, conn,
+                                            STRCONST("Proxy-Connection"))) ?
+                   "Proxy-Connection: Keep-Alive\r\n":"",
 #else
-                  "",
+                   "",
 #endif
-                  te,
-                  altused ? altused : ""
+                   te,
+                   altused ? altused : ""
       );
 
   /* clear userpwd and proxyuserpwd to avoid reusing old credentials
@@ -2854,7 +2854,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
   free(altused);
 
   if(result) {
-    Curl_dyn_free(&req);
+    curlx_dyn_free(&req);
     goto fail;
   }
 
@@ -2865,7 +2865,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
        over SSL */
     result = Curl_http2_request_upgrade(&req, data);
     if(result) {
-      Curl_dyn_free(&req);
+      curlx_dyn_free(&req);
       return result;
     }
   }
@@ -2886,7 +2886,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
     if(!result)
       result = Curl_req_send(data, &req, httpversion);
   }
-  Curl_dyn_free(&req);
+  curlx_dyn_free(&req);
   if(result)
     goto fail;
 
@@ -3026,7 +3026,7 @@ static CURLcode http_header(struct Curl_easy *data,
       HD_VAL(hd, hdlen, "Content-Length:") : NULL;
     if(v) {
       curl_off_t contentlength;
-      int offt = Curl_str_numblanks(&v, &contentlength);
+      int offt = curlx_str_numblanks(&v, &contentlength);
 
       if(offt == STRE_OK) {
         k->size = contentlength;
@@ -3118,7 +3118,7 @@ static CURLcode http_header(struct Curl_easy *data,
 
       /* if it truly stopped on a digit */
       if(ISDIGIT(*ptr)) {
-        if(!Curl_str_number(&ptr, &k->offset, CURL_OFF_T_MAX) &&
+        if(!curlx_str_number(&ptr, &k->offset, CURL_OFF_T_MAX) &&
            (data->state.resume_from == k->offset))
           /* we asked for a resume and we got it */
           k->content_range = TRUE;
@@ -3229,7 +3229,7 @@ static CURLcode http_header(struct Curl_easy *data,
       /* Retry-After = HTTP-date / delay-seconds */
       curl_off_t retry_after = 0; /* zero for unknown or "now" */
       time_t date;
-      Curl_str_passblanks(&v);
+      curlx_str_passblanks(&v);
 
       /* try it as a date first, because a date can otherwise start with and
          get treated as a number */
@@ -3243,7 +3243,7 @@ static CURLcode http_header(struct Curl_easy *data,
       }
       else
         /* Try it as a decimal number */
-        Curl_str_number(&v, &retry_after, CURL_OFF_T_MAX);
+        curlx_str_number(&v, &retry_after, CURL_OFF_T_MAX);
       /* limit to 6 hours max. this is not documented so that it can be changed
          in the future if necessary. */
       if(retry_after > 21600)
@@ -3858,8 +3858,8 @@ static CURLcode http_rw_hd(struct Curl_easy *data,
     struct dynbuf last_header;
     size_t consumed;
 
-    Curl_dyn_init(&last_header, hdlen + 1);
-    result = Curl_dyn_addn(&last_header, hd, hdlen);
+    curlx_dyn_init(&last_header, hdlen + 1);
+    result = curlx_dyn_addn(&last_header, hd, hdlen);
     if(result)
       return result;
 
@@ -3867,12 +3867,12 @@ static CURLcode http_rw_hd(struct Curl_easy *data,
     /* Caveat: we clear anything in the header brigade, because a
      * response might switch HTTP version which may call use recursively.
      * Not nice, but that is currently the way of things. */
-    Curl_dyn_reset(&data->state.headerb);
-    result = http_on_response(data, Curl_dyn_ptr(&last_header),
-                              Curl_dyn_len(&last_header),
+    curlx_dyn_reset(&data->state.headerb);
+    result = http_on_response(data, curlx_dyn_ptr(&last_header),
+                              curlx_dyn_len(&last_header),
                               buf_remain, blen, &consumed);
     *pconsumed += consumed;
-    Curl_dyn_free(&last_header);
+    curlx_dyn_free(&last_header);
     return result;
   }
 
@@ -3897,7 +3897,7 @@ static CURLcode http_rw_hd(struct Curl_easy *data,
        */
       const char *p = hd;
 
-      Curl_str_passblanks(&p);
+      curlx_str_passblanks(&p);
       if(!strncmp(p, "HTTP/", 5)) {
         p += 5;
         switch(*p) {
@@ -3960,11 +3960,11 @@ static CURLcode http_rw_hd(struct Curl_easy *data,
       curl_off_t status;
       /* we set the max string a little excessive to forgive some leading
          spaces */
-      if(!Curl_str_until(&p, &ver, 32, ' ') &&
-         !Curl_str_single(&p, ' ') &&
-         !Curl_str_number(&p, &status, 999)) {
-        Curl_str_trimblanks(&ver);
-        if(Curl_str_cmp(&ver, "RTSP/1.0")) {
+      if(!curlx_str_until(&p, &ver, 32, ' ') &&
+         !curlx_str_single(&p, ' ') &&
+         !curlx_str_number(&p, &status, 999)) {
+        curlx_str_trimblanks(&ver);
+        if(curlx_str_cmp(&ver, "RTSP/1.0")) {
           k->httpcode = (int)status;
           fine_statusline = TRUE;
           k->httpversion = 11; /* RTSP acts like HTTP 1.1 */
@@ -4034,7 +4034,7 @@ static CURLcode http_parse_headers(struct Curl_easy *data,
     if(!end_ptr) {
       /* Not a complete header line within buffer, append the data to
          the end of the headerbuff. */
-      result = Curl_dyn_addn(&data->state.headerb, buf, blen);
+      result = curlx_dyn_addn(&data->state.headerb, buf, blen);
       if(result)
         return result;
       *pconsumed += blen;
@@ -4043,8 +4043,8 @@ static CURLcode http_parse_headers(struct Curl_easy *data,
         /* check if this looks like a protocol header */
         statusline st =
           checkprotoprefix(data, conn,
-                           Curl_dyn_ptr(&data->state.headerb),
-                           Curl_dyn_len(&data->state.headerb));
+                           curlx_dyn_ptr(&data->state.headerb),
+                           curlx_dyn_len(&data->state.headerb));
 
         if(st == STATUS_BAD) {
           /* this is not the beginning of a protocol first header line.
@@ -4068,7 +4068,7 @@ static CURLcode http_parse_headers(struct Curl_easy *data,
 
     /* decrease the size of the remaining (supposed) header line */
     consumed = (end_ptr - buf) + 1;
-    result = Curl_dyn_addn(&data->state.headerb, buf, consumed);
+    result = curlx_dyn_addn(&data->state.headerb, buf, consumed);
     if(result)
       return result;
     blen -= consumed;
@@ -4082,8 +4082,8 @@ static CURLcode http_parse_headers(struct Curl_easy *data,
     if(!k->headerline) {
       /* the first read header */
       statusline st = checkprotoprefix(data, conn,
-                                       Curl_dyn_ptr(&data->state.headerb),
-                                       Curl_dyn_len(&data->state.headerb));
+                                       curlx_dyn_ptr(&data->state.headerb),
+                                       curlx_dyn_len(&data->state.headerb));
       if(st == STATUS_BAD) {
         streamclose(conn, "bad HTTP: No end-of-message indicator");
         /* this is not the beginning of a protocol first header line.
@@ -4102,13 +4102,13 @@ static CURLcode http_parse_headers(struct Curl_easy *data,
       }
     }
 
-    result = http_rw_hd(data, Curl_dyn_ptr(&data->state.headerb),
-                        Curl_dyn_len(&data->state.headerb),
+    result = http_rw_hd(data, curlx_dyn_ptr(&data->state.headerb),
+                        curlx_dyn_len(&data->state.headerb),
                         buf, blen, &consumed);
     /* We are done with this line. We reset because response
      * processing might switch to HTTP/2 and that might call us
      * directly again. */
-    Curl_dyn_reset(&data->state.headerb);
+    curlx_dyn_reset(&data->state.headerb);
     if(consumed) {
       blen -= consumed;
       buf += consumed;
@@ -4123,7 +4123,7 @@ static CURLcode http_parse_headers(struct Curl_easy *data,
      buffer. */
 out:
   if(!k->header && !leftover_body) {
-    Curl_dyn_free(&data->state.headerb);
+    curlx_dyn_free(&data->state.headerb);
   }
   return CURLE_OK;
 }
@@ -4161,15 +4161,15 @@ CURLcode Curl_http_write_resp_hds(struct Curl_easy *data,
 
     result = http_parse_headers(data, buf, blen, pconsumed);
     if(!result && !data->req.header) {
-      if(!data->req.no_body && Curl_dyn_len(&data->state.headerb)) {
+      if(!data->req.no_body && curlx_dyn_len(&data->state.headerb)) {
         /* leftover from parsing something that turned out not
          * to be a header, only happens if we allow for
          * HTTP/0.9 like responses */
         result = Curl_client_write(data, CLIENTWRITE_BODY,
-                                   Curl_dyn_ptr(&data->state.headerb),
-                                   Curl_dyn_len(&data->state.headerb));
+                                   curlx_dyn_ptr(&data->state.headerb),
+                                   curlx_dyn_len(&data->state.headerb));
       }
-      Curl_dyn_free(&data->state.headerb);
+      curlx_dyn_free(&data->state.headerb);
     }
     return result;
   }
@@ -4278,7 +4278,7 @@ static CURLcode req_assign_url_authority(struct httpreq *req, CURLU *url)
   CURLcode result = CURLE_URL_MALFORMAT;
 
   user = pass = host = port = NULL;
-  Curl_dyn_init(&buf, DYN_HTTP_REQUEST);
+  curlx_dyn_init(&buf, DYN_HTTP_REQUEST);
 
   uc = curl_url_get(url, CURLUPART_HOST, &host, 0);
   if(uc && uc != CURLUE_NO_HOST)
@@ -4302,27 +4302,27 @@ static CURLcode req_assign_url_authority(struct httpreq *req, CURLU *url)
   }
 
   if(user) {
-    result = Curl_dyn_add(&buf, user);
+    result = curlx_dyn_add(&buf, user);
     if(result)
       goto out;
     if(pass) {
-      result = Curl_dyn_addf(&buf, ":%s", pass);
+      result = curlx_dyn_addf(&buf, ":%s", pass);
       if(result)
         goto out;
     }
-    result = Curl_dyn_add(&buf, "@");
+    result = curlx_dyn_add(&buf, "@");
     if(result)
       goto out;
   }
-  result = Curl_dyn_add(&buf, host);
+  result = curlx_dyn_add(&buf, host);
   if(result)
     goto out;
   if(port) {
-    result = Curl_dyn_addf(&buf, ":%s", port);
+    result = curlx_dyn_addf(&buf, ":%s", port);
     if(result)
       goto out;
   }
-  req->authority = strdup(Curl_dyn_ptr(&buf));
+  req->authority = strdup(curlx_dyn_ptr(&buf));
   if(!req->authority)
     goto out;
   result = CURLE_OK;
@@ -4332,7 +4332,7 @@ out:
   free(pass);
   free(host);
   free(port);
-  Curl_dyn_free(&buf);
+  curlx_dyn_free(&buf);
   return result;
 }
 
@@ -4344,7 +4344,7 @@ static CURLcode req_assign_url_path(struct httpreq *req, CURLU *url)
   CURLcode result = CURLE_URL_MALFORMAT;
 
   path = query = NULL;
-  Curl_dyn_init(&buf, DYN_HTTP_REQUEST);
+  curlx_dyn_init(&buf, DYN_HTTP_REQUEST);
 
   uc = curl_url_get(url, CURLUPART_PATH, &path, CURLU_PATH_AS_IS);
   if(uc)
@@ -4362,16 +4362,16 @@ static CURLcode req_assign_url_path(struct httpreq *req, CURLU *url)
   }
   else {
     if(path) {
-      result = Curl_dyn_add(&buf, path);
+      result = curlx_dyn_add(&buf, path);
       if(result)
         goto out;
     }
     if(query) {
-      result = Curl_dyn_addf(&buf, "?%s", query);
+      result = curlx_dyn_addf(&buf, "?%s", query);
       if(result)
         goto out;
     }
-    req->path = strdup(Curl_dyn_ptr(&buf));
+    req->path = strdup(curlx_dyn_ptr(&buf));
     if(!req->path)
       goto out;
   }
@@ -4380,7 +4380,7 @@ static CURLcode req_assign_url_path(struct httpreq *req, CURLU *url)
 out:
   free(path);
   free(query);
-  Curl_dyn_free(&buf);
+  curlx_dyn_free(&buf);
   return result;
 }
 
@@ -4474,9 +4474,9 @@ static bool http_TE_has_token(const char *fvalue, const char *token)
     /* skip to first token */
     while(ISBLANK(*fvalue) || *fvalue == ',')
       fvalue++;
-    if(Curl_str_cspn(&fvalue, &name, " \t\r;,"))
+    if(curlx_str_cspn(&fvalue, &name, " \t\r;,"))
       return FALSE;
-    if(Curl_str_casecompare(&name, token))
+    if(curlx_str_casecompare(&name, token))
       return TRUE;
 
     /* skip any remainder after token, e.g. parameters with quoted strings */
@@ -4485,7 +4485,7 @@ static bool http_TE_has_token(const char *fvalue, const char *token)
         struct Curl_str qw;
         /* if we do not cleanly find a quoted word here, the header value
          * does not follow HTTP syntax and we reject */
-        if(Curl_str_quotedword(&fvalue, &qw, CURL_MAX_HTTP_HEADER))
+        if(curlx_str_quotedword(&fvalue, &qw, CURL_MAX_HTTP_HEADER))
           return FALSE;
       }
       else
@@ -4513,7 +4513,7 @@ CURLcode Curl_http_req_to_h2(struct dynhds *h2_headers,
     scheme = Curl_checkheaders(data, STRCONST(HTTP_PSEUDO_SCHEME));
     if(scheme) {
       scheme += sizeof(HTTP_PSEUDO_SCHEME);
-      Curl_str_passblanks(&scheme);
+      curlx_str_passblanks(&scheme);
       infof(data, "set pseudo header %s to %s", HTTP_PSEUDO_SCHEME, scheme);
     }
     else {
@@ -4648,7 +4648,7 @@ static CURLcode cr_exp100_read(struct Curl_easy *data,
     DEBUGF(infof(data, "cr_exp100_read, start AWAITING_CONTINUE, "
            "timeout %ldms", data->set.expect_100_timeout));
     ctx->state = EXP100_AWAITING_CONTINUE;
-    ctx->start = Curl_now();
+    ctx->start = curlx_now();
     Curl_expire(data, data->set.expect_100_timeout, EXPIRE_100_TIMEOUT);
     data->req.keepon &= ~KEEP_SEND;
     data->req.keepon |= KEEP_SEND_TIMED;
@@ -4661,7 +4661,7 @@ static CURLcode cr_exp100_read(struct Curl_easy *data,
     *eos = FALSE;
     return CURLE_READ_ERROR;
   case EXP100_AWAITING_CONTINUE:
-    ms = Curl_timediff(Curl_now(), ctx->start);
+    ms = curlx_timediff(curlx_now(), ctx->start);
     if(ms < data->set.expect_100_timeout) {
       DEBUGF(infof(data, "cr_exp100_read, AWAITING_CONTINUE, not expired"));
       data->req.keepon &= ~KEEP_SEND;
index 9d2461e81355a8e4f167969d8c9f248540562d63..a0ec255675c8e123cc6ecb8fe77054e575286e4f 100644 (file)
@@ -44,14 +44,14 @@ void Curl_h1_req_parse_init(struct h1_req_parser *parser, size_t max_line_len)
 {
   memset(parser, 0, sizeof(*parser));
   parser->max_line_len = max_line_len;
-  Curl_dyn_init(&parser->scratch, max_line_len);
+  curlx_dyn_init(&parser->scratch, max_line_len);
 }
 
 void Curl_h1_req_parse_free(struct h1_req_parser *parser)
 {
   if(parser) {
     Curl_http_req_free(parser->req);
-    Curl_dyn_free(&parser->scratch);
+    curlx_dyn_free(&parser->scratch);
     parser->req = NULL;
     parser->done = FALSE;
   }
@@ -108,18 +108,18 @@ static ssize_t next_line(struct h1_req_parser *parser,
   if(parser->line) {
     parser->line = NULL;
     parser->line_len = 0;
-    Curl_dyn_reset(&parser->scratch);
+    curlx_dyn_reset(&parser->scratch);
   }
 
   nread = detect_line(parser, buf, buflen, err);
   if(nread >= 0) {
-    if(Curl_dyn_len(&parser->scratch)) {
+    if(curlx_dyn_len(&parser->scratch)) {
       /* append detected line to scratch to have the complete line */
-      *err = Curl_dyn_addn(&parser->scratch, parser->line, parser->line_len);
+      *err = curlx_dyn_addn(&parser->scratch, parser->line, parser->line_len);
       if(*err)
         return -1;
-      parser->line = Curl_dyn_ptr(&parser->scratch);
-      parser->line_len = Curl_dyn_len(&parser->scratch);
+      parser->line = curlx_dyn_ptr(&parser->scratch);
+      parser->line_len = curlx_dyn_len(&parser->scratch);
     }
     *err = trim_line(parser, options);
     if(*err)
@@ -127,7 +127,8 @@ static ssize_t next_line(struct h1_req_parser *parser,
   }
   else if(*err == CURLE_AGAIN) {
     /* no line end in `buf`, add it to our scratch */
-    *err = Curl_dyn_addn(&parser->scratch, (const unsigned char *)buf, buflen);
+    *err = curlx_dyn_addn(&parser->scratch, (const unsigned char *)buf,
+                          buflen);
     nread = (*err) ? -1 : (ssize_t)buflen;
   }
   return nread;
@@ -299,7 +300,7 @@ ssize_t Curl_h1_req_parse_read(struct h1_req_parser *parser,
         goto out;
       }
       parser->done = TRUE;
-      Curl_dyn_reset(&parser->scratch);
+      curlx_dyn_reset(&parser->scratch);
       /* last chance adjustments */
     }
     else {
@@ -321,13 +322,13 @@ CURLcode Curl_h1_req_write_head(struct httpreq *req, int http_minor,
 {
   CURLcode result;
 
-  result = Curl_dyn_addf(dbuf, "%s %s%s%s%s HTTP/1.%d\r\n",
-                         req->method,
-                         req->scheme ? req->scheme : "",
-                         req->scheme ? "://" : "",
-                         req->authority ? req->authority : "",
-                         req->path ? req->path : "",
-                         http_minor);
+  result = curlx_dyn_addf(dbuf, "%s %s%s%s%s HTTP/1.%d\r\n",
+                          req->method,
+                          req->scheme ? req->scheme : "",
+                          req->scheme ? "://" : "",
+                          req->authority ? req->authority : "",
+                          req->path ? req->path : "",
+                          http_minor);
   if(result)
     goto out;
 
@@ -335,7 +336,7 @@ CURLcode Curl_h1_req_write_head(struct httpreq *req, int http_minor,
   if(result)
     goto out;
 
-  result = Curl_dyn_addn(dbuf, STRCONST("\r\n"));
+  result = curlx_dyn_addn(dbuf, STRCONST("\r\n"));
 
 out:
   return result;
index 84be0797a9110de667d337c5cebc20075d3f60f9..dd82aa963ec3a5be272e4097b6ce6b82b20bb139 100644 (file)
@@ -35,7 +35,7 @@
 #include "http.h"
 #include "sendf.h"
 #include "select.h"
-#include "curl_base64.h"
+#include "curlx/base64.h"
 #include "strcase.h"
 #include "multiif.h"
 #include "url.h"
@@ -44,9 +44,9 @@
 #include "connect.h"
 #include "rand.h"
 #include "strdup.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 #include "transfer.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 #include "headers.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -166,7 +166,7 @@ static void cf_h2_ctx_init(struct cf_h2_ctx *ctx, bool via_h1_upgrade)
   Curl_bufcp_init(&ctx->stream_bufcp, H2_CHUNK_SIZE, H2_STREAM_POOL_SPARES);
   Curl_bufq_initp(&ctx->inbufq, &ctx->stream_bufcp, H2_NW_RECV_CHUNKS, 0);
   Curl_bufq_initp(&ctx->outbufq, &ctx->stream_bufcp, H2_NW_SEND_CHUNKS, 0);
-  Curl_dyn_init(&ctx->scratch, CURL_MAX_HTTP_HEADER);
+  curlx_dyn_init(&ctx->scratch, CURL_MAX_HTTP_HEADER);
   Curl_uint_hash_init(&ctx->streams, 63, h2_stream_hash_free);
   ctx->remote_max_sid = 2147483647;
   ctx->via_h1_upgrade = via_h1_upgrade;
@@ -177,7 +177,7 @@ static void cf_h2_ctx_init(struct cf_h2_ctx *ctx, bool via_h1_upgrade)
     ctx->stream_win_max = H2_STREAM_WINDOW_SIZE_MAX;
     if(p) {
       curl_off_t l;
-      if(!Curl_str_number(&p, &l, INT_MAX))
+      if(!curlx_str_number(&p, &l, INT_MAX))
         ctx->stream_win_max = (int32_t)l;
     }
   }
@@ -191,7 +191,7 @@ static void cf_h2_ctx_free(struct cf_h2_ctx *ctx)
     Curl_bufq_free(&ctx->inbufq);
     Curl_bufq_free(&ctx->outbufq);
     Curl_bufcp_free(&ctx->stream_bufcp);
-    Curl_dyn_free(&ctx->scratch);
+    curlx_dyn_free(&ctx->scratch);
     Curl_uint_hash_destroy(&ctx->streams);
     memset(ctx, 0, sizeof(*ctx));
   }
@@ -206,7 +206,7 @@ static void cf_h2_ctx_close(struct cf_h2_ctx *ctx)
 }
 
 static CURLcode h2_progress_egress(struct Curl_cfilter *cf,
-                                  struct Curl_easy *data);
+                                   struct Curl_easy *data);
 
 /**
  * All about the H2 internals of a stream
@@ -237,8 +237,9 @@ struct h2_stream_ctx {
   BIT(write_paused);  /* stream write is paused */
 };
 
-#define H2_STREAM_CTX(ctx,data)   ((struct h2_stream_ctx *)(\
-            data? Curl_uint_hash_get(&(ctx)->streams, (data)->mid) : NULL))
+#define H2_STREAM_CTX(ctx,data)                                         \
+  ((struct h2_stream_ctx *)(                                            \
+    data? Curl_uint_hash_get(&(ctx)->streams, (data)->mid) : NULL))
 
 static struct h2_stream_ctx *h2_stream_ctx_create(struct cf_h2_ctx *ctx)
 {
@@ -461,7 +462,7 @@ static int h2_client_new(struct Curl_cfilter *cf,
   struct cf_h2_ctx *ctx = cf->ctx;
   nghttp2_option *o;
   nghttp2_mem mem = {NULL, Curl_nghttp2_malloc, Curl_nghttp2_free,
-                     Curl_nghttp2_calloc, Curl_nghttp2_realloc};
+    Curl_nghttp2_calloc, Curl_nghttp2_realloc};
 
   int rc = nghttp2_option_new(&o);
   if(rc)
@@ -1721,15 +1722,15 @@ 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;
     }
-    Curl_dyn_reset(&ctx->scratch);
-    result = Curl_dyn_addn(&ctx->scratch, STRCONST("HTTP/2 "));
+    curlx_dyn_reset(&ctx->scratch);
+    result = curlx_dyn_addn(&ctx->scratch, STRCONST("HTTP/2 "));
     if(!result)
-      result = Curl_dyn_addn(&ctx->scratch, value, valuelen);
+      result = curlx_dyn_addn(&ctx->scratch, value, valuelen);
     if(!result)
-      result = Curl_dyn_addn(&ctx->scratch, STRCONST(" \r\n"));
+      result = curlx_dyn_addn(&ctx->scratch, STRCONST(" \r\n"));
     if(!result)
-      h2_xfer_write_resp_hd(cf, data_s, stream, Curl_dyn_ptr(&ctx->scratch),
-                            Curl_dyn_len(&ctx->scratch), FALSE);
+      h2_xfer_write_resp_hd(cf, data_s, stream, curlx_dyn_ptr(&ctx->scratch),
+                            curlx_dyn_len(&ctx->scratch), FALSE);
     if(result) {
       cf_h2_header_error(cf, data_s, stream, result);
       return NGHTTP2_ERR_CALLBACK_FAILURE;
@@ -1746,17 +1747,17 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
   /* nghttp2 guarantees that namelen > 0, and :status was already
      received, and this is not pseudo-header field . */
   /* convert to an HTTP1-style header */
-  Curl_dyn_reset(&ctx->scratch);
-  result = Curl_dyn_addn(&ctx->scratch, (const char *)name, namelen);
+  curlx_dyn_reset(&ctx->scratch);
+  result = curlx_dyn_addn(&ctx->scratch, (const char *)name, namelen);
   if(!result)
-    result = Curl_dyn_addn(&ctx->scratch, STRCONST(": "));
+    result = curlx_dyn_addn(&ctx->scratch, STRCONST(": "));
   if(!result)
-    result = Curl_dyn_addn(&ctx->scratch, (const char *)value, valuelen);
+    result = curlx_dyn_addn(&ctx->scratch, (const char *)value, valuelen);
   if(!result)
-    result = Curl_dyn_addn(&ctx->scratch, STRCONST("\r\n"));
+    result = curlx_dyn_addn(&ctx->scratch, STRCONST("\r\n"));
   if(!result)
-    h2_xfer_write_resp_hd(cf, data_s, stream, Curl_dyn_ptr(&ctx->scratch),
-                          Curl_dyn_len(&ctx->scratch), FALSE);
+    h2_xfer_write_resp_hd(cf, data_s, stream, curlx_dyn_ptr(&ctx->scratch),
+                          curlx_dyn_len(&ctx->scratch), FALSE);
   if(result) {
     cf_h2_header_error(cf, data_s, stream, result);
     return NGHTTP2_ERR_CALLBACK_FAILURE;
@@ -1849,22 +1850,22 @@ CURLcode Curl_http2_request_upgrade(struct dynbuf *req,
   binlen = populate_binsettings(binsettings, data);
   if(binlen <= 0) {
     failf(data, "nghttp2 unexpectedly failed on pack_settings_payload");
-    Curl_dyn_free(req);
+    curlx_dyn_free(req);
     return CURLE_FAILED_INIT;
   }
 
-  result = Curl_base64url_encode((const char *)binsettings, (size_t)binlen,
-                                 &base64, &blen);
+  result = curlx_base64url_encode((const char *)binsettings, (size_t)binlen,
+                                  &base64, &blen);
   if(result) {
-    Curl_dyn_free(req);
+    curlx_dyn_free(req);
     return result;
   }
 
-  result = Curl_dyn_addf(req,
-                         "Connection: Upgrade, HTTP2-Settings\r\n"
-                         "Upgrade: %s\r\n"
-                         "HTTP2-Settings: %s\r\n",
-                         NGHTTP2_CLEARTEXT_PROTO_VERSION_ID, base64);
+  result = curlx_dyn_addf(req,
+                          "Connection: Upgrade, HTTP2-Settings\r\n"
+                          "Upgrade: %s\r\n"
+                          "HTTP2-Settings: %s\r\n",
+                          NGHTTP2_CLEARTEXT_PROTO_VERSION_ID, base64);
   free(base64);
 
   k->upgr101 = UPGR101_H2;
@@ -1924,25 +1925,25 @@ static ssize_t http2_handle_stream_close(struct Curl_cfilter *cf,
     size_t i;
 
     *err = CURLE_OK;
-    Curl_dyn_init(&dbuf, DYN_TRAILERS);
+    curlx_dyn_init(&dbuf, DYN_TRAILERS);
     for(i = 0; i < Curl_dynhds_count(&stream->resp_trailers); ++i) {
       e = Curl_dynhds_getn(&stream->resp_trailers, i);
       if(!e)
         break;
-      Curl_dyn_reset(&dbuf);
-      *err = Curl_dyn_addf(&dbuf, "%.*s: %.*s\x0d\x0a",
-                          (int)e->namelen, e->name,
-                          (int)e->valuelen, e->value);
+      curlx_dyn_reset(&dbuf);
+      *err = curlx_dyn_addf(&dbuf, "%.*s: %.*s\x0d\x0a",
+                            (int)e->namelen, e->name,
+                            (int)e->valuelen, e->value);
       if(*err)
         break;
-      Curl_debug(data, CURLINFO_HEADER_IN, Curl_dyn_ptr(&dbuf),
-                 Curl_dyn_len(&dbuf));
+      Curl_debug(data, CURLINFO_HEADER_IN, curlx_dyn_ptr(&dbuf),
+                 curlx_dyn_len(&dbuf));
       *err = Curl_client_write(data, CLIENTWRITE_HEADER|CLIENTWRITE_TRAILER,
-                               Curl_dyn_ptr(&dbuf), Curl_dyn_len(&dbuf));
+                               curlx_dyn_ptr(&dbuf), curlx_dyn_len(&dbuf));
       if(*err)
         break;
     }
-    Curl_dyn_free(&dbuf);
+    curlx_dyn_free(&dbuf);
     if(*err)
       goto out;
   }
index 70471382797fb3df78ac36e4b382caaea7110912..1b8354fdff91a04fbaf6942694bf867e5ac276e0 100644 (file)
@@ -35,7 +35,7 @@
 #include "parsedate.h"
 #include "sendf.h"
 #include "escape.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 #include <time.h>
 
@@ -95,7 +95,7 @@ static void trim_headers(struct curl_slist *head)
     store = (char *)CURL_UNCONST(value);
 
     /* skip leading whitespace */
-    Curl_str_passblanks(&value);
+    curlx_str_passblanks(&value);
 
     while(*value) {
       int space = 0;
@@ -172,9 +172,9 @@ static CURLcode merge_duplicate_headers(struct curl_slist *head)
       char *colon_next;
       char *val_next;
 
-      Curl_dyn_init(&buf, CURL_MAX_HTTP_HEADER);
+      curlx_dyn_init(&buf, CURL_MAX_HTTP_HEADER);
 
-      result = Curl_dyn_add(&buf, curr->data);
+      result = curlx_dyn_add(&buf, curr->data);
       if(result)
         return result;
 
@@ -182,16 +182,16 @@ static CURLcode merge_duplicate_headers(struct curl_slist *head)
       DEBUGASSERT(colon_next);
       val_next = colon_next + 1;
 
-      result = Curl_dyn_addn(&buf, ",", 1);
+      result = curlx_dyn_addn(&buf, ",", 1);
       if(result)
         return result;
 
-      result = Curl_dyn_add(&buf, val_next);
+      result = curlx_dyn_add(&buf, val_next);
       if(result)
         return result;
 
       free(curr->data);
-      curr->data = Curl_dyn_ptr(&buf);
+      curr->data = curlx_dyn_ptr(&buf);
 
       curr->next = next->next;
       free(next->data);
@@ -319,7 +319,7 @@ static CURLcode make_headers(struct Curl_easy *data,
       goto fail;
     }
     ++value;
-    Curl_str_passblanks(&value);
+    curlx_str_passblanks(&value);
     endp = value;
     while(*endp && ISALNUM(*endp))
       ++endp;
@@ -357,9 +357,9 @@ static CURLcode make_headers(struct Curl_easy *data,
   for(l = head; l; l = l->next) {
     char *tmp;
 
-    if(Curl_dyn_add(canonical_headers, l->data))
+    if(curlx_dyn_add(canonical_headers, l->data))
       goto fail;
-    if(Curl_dyn_add(canonical_headers, "\n"))
+    if(curlx_dyn_add(canonical_headers, "\n"))
       goto fail;
 
     tmp = strchr(l->data, ':');
@@ -367,10 +367,10 @@ static CURLcode make_headers(struct Curl_easy *data,
       *tmp = 0;
 
     if(l != head) {
-      if(Curl_dyn_add(signed_headers, ";"))
+      if(curlx_dyn_add(signed_headers, ";"))
         goto fail;
     }
-    if(Curl_dyn_add(signed_headers, l->data))
+    if(curlx_dyn_add(signed_headers, l->data))
       goto fail;
   }
 
@@ -409,7 +409,7 @@ static const char *parse_content_sha_hdr(struct Curl_easy *data,
     return NULL;
   ++value;
 
-  Curl_str_passblanks(&value);
+  curlx_str_passblanks(&value);
 
   len = strlen(value);
   while(len > 0 && ISBLANK(value[len-1]))
@@ -512,7 +512,7 @@ static CURLcode canon_string(const char *q, size_t len,
 
   for(; len && !result; q++, len--) {
     if(ISALNUM(*q))
-      result = Curl_dyn_addn(dq, q, 1);
+      result = curlx_dyn_addn(dq, q, 1);
     else {
       switch(*q) {
       case '-':
@@ -520,7 +520,7 @@ static CURLcode canon_string(const char *q, size_t len,
       case '_':
       case '~':
         /* allowed as-is */
-        result = Curl_dyn_addn(dq, q, 1);
+        result = curlx_dyn_addn(dq, q, 1);
         break;
       case '%':
         /* uppercase the following if hexadecimal */
@@ -528,13 +528,13 @@ static CURLcode canon_string(const char *q, size_t len,
           char tmp[3]="%";
           tmp[1] = Curl_raw_toupper(q[1]);
           tmp[2] = Curl_raw_toupper(q[2]);
-          result = Curl_dyn_addn(dq, tmp, 3);
+          result = curlx_dyn_addn(dq, tmp, 3);
           q += 2;
           len -= 2;
         }
         else
           /* '%' without a following two-digit hex, encode it */
-          result = Curl_dyn_addn(dq, "%25", 3);
+          result = curlx_dyn_addn(dq, "%25", 3);
         break;
       default: {
         unsigned char out[3]={'%'};
@@ -543,21 +543,21 @@ static CURLcode canon_string(const char *q, size_t len,
           /* if found_equals is NULL assuming, been in path */
           if(*q == '/') {
             /* allowed as if */
-            result = Curl_dyn_addn(dq, q, 1);
+            result = curlx_dyn_addn(dq, q, 1);
             break;
           }
         }
         else {
           /* allowed as-is */
           if(*q == '=') {
-            result = Curl_dyn_addn(dq, q, 1);
+            result = curlx_dyn_addn(dq, q, 1);
             *found_equals = TRUE;
             break;
           }
         }
         /* URL encode */
         Curl_hexbyte(&out[1], *q, FALSE);
-        result = Curl_dyn_addn(dq, out, 3);
+        result = curlx_dyn_addn(dq, out, 3);
         break;
       }
       }
@@ -611,11 +611,11 @@ static CURLcode canon_query(struct Curl_easy *data,
     result = canon_string(q, ap->len, dq, &found_equals);
     if(!result && !found_equals) {
       /* queries without value still need an equals */
-      result = Curl_dyn_addn(dq, "=", 1);
+      result = curlx_dyn_addn(dq, "=", 1);
     }
     if(!result && i < entry - 1) {
       /* insert ampersands between query pairs */
-      result = Curl_dyn_addn(dq, "&", 1);
+      result = curlx_dyn_addn(dq, "&", 1);
     }
   }
   return result;
@@ -664,10 +664,10 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
   }
 
   /* we init those buffers here, so goto fail will free initialized dynbuf */
-  Curl_dyn_init(&canonical_headers, CURL_MAX_HTTP_HEADER);
-  Curl_dyn_init(&canonical_query, CURL_MAX_HTTP_HEADER);
-  Curl_dyn_init(&signed_headers, CURL_MAX_HTTP_HEADER);
-  Curl_dyn_init(&canonical_path, CURL_MAX_HTTP_HEADER);
+  curlx_dyn_init(&canonical_headers, CURL_MAX_HTTP_HEADER);
+  curlx_dyn_init(&canonical_query, CURL_MAX_HTTP_HEADER);
+  curlx_dyn_init(&signed_headers, CURL_MAX_HTTP_HEADER);
+  curlx_dyn_init(&canonical_path, CURL_MAX_HTTP_HEADER);
 
   /*
    * Parameters parsing
@@ -684,62 +684,62 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
 
      No string can be longer than N bytes of non-whitespace
   */
-  if(Curl_str_until(&line, &provider0, MAX_SIGV4_LEN, ':')) {
+  if(curlx_str_until(&line, &provider0, MAX_SIGV4_LEN, ':')) {
     failf(data, "first aws-sigv4 provider cannot be empty");
     result = CURLE_BAD_FUNCTION_ARGUMENT;
     goto fail;
   }
-  if(Curl_str_single(&line, ':') ||
-     Curl_str_until(&line, &provider1, MAX_SIGV4_LEN, ':')) {
+  if(curlx_str_single(&line, ':') ||
+     curlx_str_until(&line, &provider1, MAX_SIGV4_LEN, ':')) {
     provider1 = provider0;
   }
-  else if(Curl_str_single(&line, ':') ||
-          Curl_str_until(&line, &region, MAX_SIGV4_LEN, ':') ||
-          Curl_str_single(&line, ':') ||
-          Curl_str_until(&line, &service, MAX_SIGV4_LEN, ':')) {
+  else if(curlx_str_single(&line, ':') ||
+          curlx_str_until(&line, &region, MAX_SIGV4_LEN, ':') ||
+          curlx_str_single(&line, ':') ||
+          curlx_str_until(&line, &service, MAX_SIGV4_LEN, ':')) {
     /* nothing to do */
   }
 
-  if(!Curl_strlen(&service)) {
+  if(!curlx_strlen(&service)) {
     const char *p = hostname;
-    if(Curl_str_until(&p, &service, MAX_SIGV4_LEN, '.') ||
-       Curl_str_single(&p, '.')) {
+    if(curlx_str_until(&p, &service, MAX_SIGV4_LEN, '.') ||
+       curlx_str_single(&p, '.')) {
       failf(data, "aws-sigv4: service missing in parameters and hostname");
       result = CURLE_URL_MALFORMAT;
       goto fail;
     }
 
     infof(data, "aws_sigv4: picked service %.*s from host",
-          (int)Curl_strlen(&service), Curl_str(&service));
+          (int)curlx_strlen(&service), curlx_str(&service));
 
-    if(!Curl_strlen(&region)) {
-      if(Curl_str_until(&p, &region, MAX_SIGV4_LEN, '.') ||
-         Curl_str_single(&p, '.')) {
+    if(!curlx_strlen(&region)) {
+      if(curlx_str_until(&p, &region, MAX_SIGV4_LEN, '.') ||
+         curlx_str_single(&p, '.')) {
         failf(data, "aws-sigv4: region missing in parameters and hostname");
         result = CURLE_URL_MALFORMAT;
         goto fail;
       }
       infof(data, "aws_sigv4: picked region %.*s from host",
-            (int)Curl_strlen(&region), Curl_str(&region));
+            (int)curlx_strlen(&region), curlx_str(&region));
     }
   }
 
   Curl_http_method(data, conn, &method, &httpreq);
 
   payload_hash =
-    parse_content_sha_hdr(data, Curl_str(&provider1), Curl_strlen(&provider1),
-                          &payload_hash_len);
+    parse_content_sha_hdr(data, curlx_str(&provider1),
+                          curlx_strlen(&provider1), &payload_hash_len);
 
   if(!payload_hash) {
     /* AWS S3 requires a x-amz-content-sha256 header, and supports special
      * values like UNSIGNED-PAYLOAD */
-    bool sign_as_s3 = Curl_str_casecompare(&provider0, "aws") &&
-      Curl_str_casecompare(&service, "s3");
+    bool sign_as_s3 = curlx_str_casecompare(&provider0, "aws") &&
+      curlx_str_casecompare(&service, "s3");
 
     if(sign_as_s3)
-      result = calc_s3_payload_hash(data, httpreq, Curl_str(&provider1),
-                                    Curl_strlen(&provider1), sha_hash, sha_hex,
-                                    content_sha256_hdr);
+      result = calc_s3_payload_hash(data, httpreq, curlx_str(&provider1),
+                                    curlx_strlen(&provider1), sha_hash,
+                                    sha_hex, content_sha256_hdr);
     else
       result = calc_payload_hash(data, sha_hash, sha_hex);
     if(result)
@@ -771,7 +771,7 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
   }
 
   result = make_headers(data, hostname, timestamp,
-                        Curl_str(&provider1), Curl_strlen(&provider1),
+                        curlx_str(&provider1), curlx_strlen(&provider1),
                         &date_header, content_sha256_hdr,
                         &canonical_headers, &signed_headers);
   if(result)
@@ -805,11 +805,11 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
             "%s\n" /* SignedHeaders */
             "%.*s",  /* HashedRequestPayload in hex */
             method,
-            Curl_dyn_ptr(&canonical_path),
-            Curl_dyn_ptr(&canonical_query) ?
-            Curl_dyn_ptr(&canonical_query) : "",
-            Curl_dyn_ptr(&canonical_headers),
-            Curl_dyn_ptr(&signed_headers),
+            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;
@@ -818,17 +818,17 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
     canonical_request);
 
   request_type = aprintf("%.*s4_request",
-                         (int)Curl_strlen(&provider0), Curl_str(&provider0));
+                         (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 */
-  Curl_strntolower(request_type, request_type, Curl_strlen(&provider0));
+  Curl_strntolower(request_type, request_type, curlx_strlen(&provider0));
 
   credential_scope = aprintf("%s/%.*s/%.*s/%s", date,
-                             (int)Curl_strlen(&region), Curl_str(&region),
-                             (int)Curl_strlen(&service), Curl_str(&service),
+                             (int)curlx_strlen(&region), curlx_str(&region),
+                             (int)curlx_strlen(&service), curlx_str(&service),
                              request_type);
   if(!credential_scope)
     goto fail;
@@ -847,7 +847,7 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
                         "%s\n" /* RequestDateTime */
                         "%s\n" /* CredentialScope */
                         "%s",  /* HashedCanonicalRequest in hex */
-                        (int)Curl_strlen(&provider0), Curl_str(&provider0),
+                        (int)curlx_strlen(&provider0), curlx_str(&provider0),
                         timestamp,
                         credential_scope,
                         sha_hex);
@@ -855,24 +855,25 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
     goto fail;
 
   /* make provider0 part done uppercase */
-  Curl_strntoupper(str_to_sign, Curl_str(&provider0), Curl_strlen(&provider0));
+  Curl_strntoupper(str_to_sign, curlx_str(&provider0),
+                   curlx_strlen(&provider0));
 
   infof(data, "aws_sigv4: String to sign (enclosed in []) - [%s]",
     str_to_sign);
 
-  secret = aprintf("%.*s4%s", (int)Curl_strlen(&provider0),
-                   Curl_str(&provider0), data->state.aptr.passwd ?
+  secret = aprintf("%.*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 */
-  Curl_strntoupper(secret, Curl_str(&provider0), Curl_strlen(&provider0));
+  Curl_strntoupper(secret, curlx_str(&provider0), curlx_strlen(&provider0));
 
   HMAC_SHA256(secret, strlen(secret), date, strlen(date), sign0);
   HMAC_SHA256(sign0, sizeof(sign0),
-              Curl_str(&region), Curl_strlen(&region), sign1);
+              curlx_str(&region), curlx_strlen(&region), sign1);
   HMAC_SHA256(sign1, sizeof(sign1),
-              Curl_str(&service), Curl_strlen(&service), sign0);
+              curlx_str(&service), curlx_strlen(&service), sign0);
   HMAC_SHA256(sign0, sizeof(sign0), request_type, strlen(request_type), sign1);
   HMAC_SHA256(sign1, sizeof(sign1), str_to_sign, strlen(str_to_sign), sign0);
 
@@ -891,10 +892,10 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
                           */
                          "%s"
                          "%s", /* optional sha256 header includes \r\n */
-                         (int)Curl_strlen(&provider0), Curl_str(&provider0),
+                         (int)curlx_strlen(&provider0), curlx_str(&provider0),
                          user,
                          credential_scope,
-                         Curl_dyn_ptr(&signed_headers),
+                         curlx_dyn_ptr(&signed_headers),
                          sha_hex,
                          date_header ? date_header : "",
                          content_sha256_hdr);
@@ -903,7 +904,7 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
   }
   /* provider 0 uppercase */
   Curl_strntoupper(&auth_headers[sizeof("Authorization: ") - 1],
-                   Curl_str(&provider0), Curl_strlen(&provider0));
+                   curlx_str(&provider0), curlx_strlen(&provider0));
 
   free(data->state.aptr.userpwd);
   data->state.aptr.userpwd = auth_headers;
@@ -911,10 +912,10 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
   result = CURLE_OK;
 
 fail:
-  Curl_dyn_free(&canonical_query);
-  Curl_dyn_free(&canonical_path);
-  Curl_dyn_free(&canonical_headers);
-  Curl_dyn_free(&signed_headers);
+  curlx_dyn_free(&canonical_query);
+  curlx_dyn_free(&canonical_path);
+  curlx_dyn_free(&canonical_headers);
+  curlx_dyn_free(&signed_headers);
   free(canonical_request);
   free(request_type);
   free(credential_scope);
index 402c4d9872752937116f10080dc2f974d64ed444..9d734c5354e714b6cb4712c75571bfa45351f65f 100644 (file)
 #include "curl_printf.h"
 #include "curl_trc.h"
 #include "sendf.h"   /* for the client write stuff */
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 #include "content_encoding.h"
 #include "http.h"
 #include "multiif.h"
-#include "strparse.h"
-#include "warnless.h"
+#include "curlx/strparse.h"
+#include "curlx/warnless.h"
 
 /* The last #include files should be: */
 #include "curl_memory.h"
@@ -85,7 +85,7 @@ void Curl_httpchunk_init(struct Curl_easy *data, struct Curl_chunker *ch,
   ch->hexindex = 0;      /* start at 0 */
   ch->state = CHUNK_HEX; /* we get hex first! */
   ch->last_code = CHUNKE_OK;
-  Curl_dyn_init(&ch->trailer, DYN_H1_TRAILER);
+  curlx_dyn_init(&ch->trailer, DYN_H1_TRAILER);
   ch->ignore_body = ignore_body;
 }
 
@@ -96,14 +96,14 @@ void Curl_httpchunk_reset(struct Curl_easy *data, struct Curl_chunker *ch,
   ch->hexindex = 0;      /* start at 0 */
   ch->state = CHUNK_HEX; /* we get hex first! */
   ch->last_code = CHUNKE_OK;
-  Curl_dyn_reset(&ch->trailer);
+  curlx_dyn_reset(&ch->trailer);
   ch->ignore_body = ignore_body;
 }
 
 void Curl_httpchunk_free(struct Curl_easy *data, struct Curl_chunker *ch)
 {
   (void)data;
-  Curl_dyn_free(&ch->trailer);
+  curlx_dyn_free(&ch->trailer);
 }
 
 bool Curl_httpchunk_is_done(struct Curl_easy *data, struct Curl_chunker *ch)
@@ -170,7 +170,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
         /* blen and buf are unmodified */
         ch->hexbuffer[ch->hexindex] = 0;
         p = &ch->hexbuffer[0];
-        if(Curl_str_hex(&p, &ch->datasize, CURL_OFF_T_MAX)) {
+        if(curlx_str_hex(&p, &ch->datasize, CURL_OFF_T_MAX)) {
           failf(data, "invalid chunk size: '%s'", ch->hexbuffer);
           ch->state = CHUNK_FAILED;
           ch->last_code = CHUNKE_ILLEGAL_HEX;
@@ -251,20 +251,20 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
 
     case CHUNK_TRAILER:
       if((*buf == 0x0d) || (*buf == 0x0a)) {
-        char *tr = Curl_dyn_ptr(&ch->trailer);
+        char *tr = curlx_dyn_ptr(&ch->trailer);
         /* this is the end of a trailer, but if the trailer was zero bytes
            there was no trailer and we move on */
 
         if(tr) {
           size_t trlen;
-          result = Curl_dyn_addn(&ch->trailer, STRCONST("\x0d\x0a"));
+          result = curlx_dyn_addn(&ch->trailer, STRCONST("\x0d\x0a"));
           if(result) {
             ch->state = CHUNK_FAILED;
             ch->last_code = CHUNKE_OUT_OF_MEMORY;
             return result;
           }
-          tr = Curl_dyn_ptr(&ch->trailer);
-          trlen = Curl_dyn_len(&ch->trailer);
+          tr = curlx_dyn_ptr(&ch->trailer);
+          trlen = curlx_dyn_len(&ch->trailer);
           if(!data->set.http_te_skip) {
             if(cw_next)
               result = Curl_cwriter_write(data, cw_next,
@@ -282,7 +282,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
               return result;
             }
           }
-          Curl_dyn_reset(&ch->trailer);
+          curlx_dyn_reset(&ch->trailer);
           ch->state = CHUNK_TRAILER_CR;
           if(*buf == 0x0a)
             /* already on the LF */
@@ -295,7 +295,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
         }
       }
       else {
-        result = Curl_dyn_addn(&ch->trailer, buf, 1);
+        result = curlx_dyn_addn(&ch->trailer, buf, 1);
         if(result) {
           ch->state = CHUNK_FAILED;
           ch->last_code = CHUNKE_OUT_OF_MEMORY;
index 34951ea0f41bd85e8c42f222bfaf11b7886ece25..0461c80f788aa3bfeee286c3cddf5f0dc9fd2696 100644 (file)
@@ -26,7 +26,7 @@
 
 #ifndef CURL_DISABLE_HTTP
 
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 
 struct connectdata;
 
index 3701486684dfbe366b86fa943020e0d3c7a73406..651bb834037cbd8a34a6d437524d4b398ac8d085 100644 (file)
@@ -30,7 +30,7 @@
 #include "strcase.h"
 #include "vauth/vauth.h"
 #include "http_digest.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -63,7 +63,7 @@ CURLcode Curl_input_digest(struct Curl_easy *data,
     return CURLE_BAD_CONTENT_ENCODING;
 
   header += strlen("Digest");
-  Curl_str_passblanks(&header);
+  curlx_str_passblanks(&header);
 
   return Curl_auth_decode_digest_http_message(header, digest);
 }
index deb50f03d62f6777b33096d1dd4b8332d3c12b68..5bec3b39ff5bd9fe5e8b87cd493d0414d3b68ad0 100644 (file)
@@ -32,7 +32,7 @@
 #include "http_negotiate.h"
 #include "vauth/vauth.h"
 #include "vtls/vtls.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -87,7 +87,7 @@ CURLcode Curl_input_negotiate(struct Curl_easy *data, struct connectdata *conn,
 
   /* Obtain the input token, if any */
   header += strlen("Negotiate");
-  Curl_str_passblanks(&header);
+  curlx_str_passblanks(&header);
 
   len = strlen(header);
   neg_ctx->havenegdata = len != 0;
@@ -111,7 +111,7 @@ CURLcode Curl_input_negotiate(struct Curl_easy *data, struct connectdata *conn,
   /* Check if the connection is using SSL and get the channel binding data */
 #ifdef HAVE_GSSAPI
 #ifdef USE_SSL
-  Curl_dyn_init(&neg_ctx->channel_binding_data, SSL_CB_MAX_SIZE + 1);
+  curlx_dyn_init(&neg_ctx->channel_binding_data, SSL_CB_MAX_SIZE + 1);
   if(Curl_conn_is_ssl(conn, FIRSTSOCKET)) {
     result = Curl_ssl_get_channel_binding(
       data, FIRSTSOCKET, &neg_ctx->channel_binding_data);
@@ -121,7 +121,7 @@ CURLcode Curl_input_negotiate(struct Curl_easy *data, struct connectdata *conn,
     }
   }
 #else
-  Curl_dyn_init(&neg_ctx->channel_binding_data, 1);
+  curlx_dyn_init(&neg_ctx->channel_binding_data, 1);
 #endif /* USE_SSL */
 #endif /* HAVE_GSSAPI */
 
@@ -130,7 +130,7 @@ CURLcode Curl_input_negotiate(struct Curl_easy *data, struct connectdata *conn,
                                            host, header, neg_ctx);
 
 #ifdef HAVE_GSSAPI
-  Curl_dyn_free(&neg_ctx->channel_binding_data);
+  curlx_dyn_free(&neg_ctx->channel_binding_data);
 #endif
 
   if(result)
index a2d342a7a01a9e0d22d26b443928433bb9ecd243..e6a3b175a776a4447fc959b687d3dcaca0401093 100644 (file)
 #include "strcase.h"
 #include "http_ntlm.h"
 #include "curl_ntlm_core.h"
-#include "curl_base64.h"
+#include "curlx/base64.h"
 #include "vauth/vauth.h"
 #include "url.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* SSL backend-specific #if branches in this file must be kept in the order
    documented in curl_ntlm_core. */
@@ -71,12 +71,12 @@ CURLcode Curl_input_ntlm(struct Curl_easy *data,
   if(checkprefix("NTLM", header)) {
     header += strlen("NTLM");
 
-    Curl_str_passblanks(&header);
+    curlx_str_passblanks(&header);
     if(*header) {
       unsigned char *hdr;
       size_t hdrlen;
 
-      result = Curl_base64_decode(header, &hdr, &hdrlen);
+      result = curlx_base64_decode(header, &hdr, &hdrlen);
       if(!result) {
         struct bufref hdrbuf;
 
@@ -205,7 +205,7 @@ CURLcode Curl_output_ntlm(struct Curl_easy *data, bool proxy)
                                                  ntlm, &ntlmmsg);
     if(!result) {
       DEBUGASSERT(Curl_bufref_len(&ntlmmsg) != 0);
-      result = Curl_base64_encode((const char *) Curl_bufref_ptr(&ntlmmsg),
+      result = curlx_base64_encode((const char *) Curl_bufref_ptr(&ntlmmsg),
                                   Curl_bufref_len(&ntlmmsg), &base64, &len);
       if(!result) {
         free(*allocuserpwd);
@@ -224,8 +224,8 @@ CURLcode Curl_output_ntlm(struct Curl_easy *data, bool proxy)
     result = Curl_auth_create_ntlm_type3_message(data, userp, passwdp,
                                                  ntlm, &ntlmmsg);
     if(!result && Curl_bufref_len(&ntlmmsg)) {
-      result = Curl_base64_encode((const char *) Curl_bufref_ptr(&ntlmmsg),
-                                  Curl_bufref_len(&ntlmmsg), &base64, &len);
+      result = curlx_base64_encode((const char *) Curl_bufref_ptr(&ntlmmsg),
+                                   Curl_bufref_len(&ntlmmsg), &base64, &len);
       if(!result) {
         free(*allocuserpwd);
         *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
index 0cacf4cef3e652985f41784f7ecc856393f90487..3df6329c06f602fc60b1431d72ff9052ca2faa1f 100644 (file)
 #include "cf-h1-proxy.h"
 #include "cf-h2-proxy.h"
 #include "connect.h"
-#include "curlx.h"
+#include "strcase.h"
 #include "vtls/vtls.h"
 #include "transfer.h"
 #include "multiif.h"
 #include "vauth/vauth.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -109,7 +109,7 @@ static CURLcode dynhds_add_custom(struct Curl_easy *data,
         name = headers->data;
         namelen = ptr - headers->data;
         ptr++; /* pass the colon */
-        Curl_str_passblanks(&ptr);
+        curlx_str_passblanks(&ptr);
         if(*ptr) {
           value = ptr;
           valuelen = strlen(value);
@@ -131,7 +131,7 @@ static CURLcode dynhds_add_custom(struct Curl_easy *data,
         name = headers->data;
         namelen = ptr - headers->data;
         ptr++; /* pass the semicolon */
-        Curl_str_passblanks(&ptr);
+        curlx_str_passblanks(&ptr);
         if(!*ptr) {
           /* quirk #2, send an empty header */
           value = "";
index 6a96527aee2090f043ff2fbdea28478013c0050c..71cf5540a3889d5a4f3671cb3e3032b4a03e2eeb 100644 (file)
--- a/lib/idn.c
+++ b/lib/idn.c
@@ -31,7 +31,7 @@
 #include "idn.h"
 #include "sendf.h"
 #include "curl_multibyte.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 
 #ifdef USE_LIBIDN2
 #include <idn2.h>
index 92794da742d3fc048cd092d271a194d769cbff5e..e11ed71fb7de7bd0cbdaf58ab96f054874150cdf 100644 (file)
@@ -36,7 +36,7 @@
  ***************************************************************************/
 
 #include "curl_setup.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 
 #ifndef CURL_DISABLE_IMAP
 
@@ -65,7 +65,7 @@
 #include "socks.h"
 #include "imap.h"
 #include "mime.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 #include "strcase.h"
 #include "vtls/vtls.h"
 #include "cfilters.h"
@@ -75,7 +75,7 @@
 #include "url.h"
 #include "bufref.h"
 #include "curl_sasl.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "curl_ctype.h"
 
 /* The last 3 #include files should be in this order */
@@ -436,7 +436,7 @@ static CURLcode imap_get_message(struct Curl_easy *data, struct bufref *out)
   if(!imapc)
     return CURLE_FAILED_INIT;
 
-  message = Curl_dyn_ptr(&imapc->pp.recvbuf);
+  message = curlx_dyn_ptr(&imapc->pp.recvbuf);
   len = imapc->pp.nfinal;
   if(len > 2) {
     /* Find the start of the message */
@@ -912,7 +912,7 @@ static CURLcode imap_perform_append(struct Curl_easy *data,
     return CURLE_OUT_OF_MEMORY;
 
   /* Generate flags string and send the APPEND command */
-  Curl_dyn_init(&flags, 100);
+  curlx_dyn_init(&flags, 100);
   if(data->set.upload_flags) {
     int i;
     struct ulbits ulflag[] = {
@@ -925,29 +925,30 @@ static CURLcode imap_perform_append(struct Curl_easy *data,
     };
 
     result = CURLE_OUT_OF_MEMORY;
-    if(Curl_dyn_add(&flags, " (")) {
+    if(curlx_dyn_add(&flags, " (")) {
       goto cleanup;
     }
 
     for(i = 0; ulflag[i].bit; i++) {
       if(data->set.upload_flags & ulflag[i].bit) {
-        if((Curl_dyn_len(&flags) > 2 && Curl_dyn_add(&flags, " ")) ||
-           Curl_dyn_add(&flags, "\\") || Curl_dyn_add(&flags, ulflag[i].flag))
-            goto cleanup;
+        if((curlx_dyn_len(&flags) > 2 && curlx_dyn_add(&flags, " ")) ||
+           curlx_dyn_add(&flags, "\\") ||
+           curlx_dyn_add(&flags, ulflag[i].flag))
+          goto cleanup;
       }
     }
 
-    if(Curl_dyn_add(&flags, ")"))
+    if(curlx_dyn_add(&flags, ")"))
       goto cleanup;
   }
-  else if(Curl_dyn_add(&flags, ""))
+  else if(curlx_dyn_add(&flags, ""))
     goto cleanup;
 
   result = imap_sendf(data, imapc, "APPEND %s%s {%" FMT_OFF_T "}",
-                      mailbox, Curl_dyn_ptr(&flags), data->state.infilesize);
+                      mailbox, curlx_dyn_ptr(&flags), data->state.infilesize);
 
 cleanup:
-  Curl_dyn_free(&flags);
+  curlx_dyn_free(&flags);
   free(mailbox);
 
   if(!result)
@@ -1030,7 +1031,7 @@ static CURLcode imap_state_capability_resp(struct Curl_easy *data,
 {
   CURLcode result = CURLE_OK;
   struct connectdata *conn = data->conn;
-  const char *line = Curl_dyn_ptr(&imapc->pp.recvbuf);
+  const char *line = curlx_dyn_ptr(&imapc->pp.recvbuf);
 
   (void)instate; /* no use for this yet */
 
@@ -1193,7 +1194,7 @@ static CURLcode imap_state_listsearch_resp(struct Curl_easy *data,
                                            imapstate instate)
 {
   CURLcode result = CURLE_OK;
-  char *line = Curl_dyn_ptr(&imapc->pp.recvbuf);
+  char *line = curlx_dyn_ptr(&imapc->pp.recvbuf);
   size_t len = imapc->pp.nfinal;
 
   (void)instate; /* No use for this yet */
@@ -1217,7 +1218,7 @@ static CURLcode imap_state_select_resp(struct Curl_easy *data,
                                        imapstate instate)
 {
   CURLcode result = CURLE_OK;
-  const char *line = Curl_dyn_ptr(&imapc->pp.recvbuf);
+  const char *line = curlx_dyn_ptr(&imapc->pp.recvbuf);
 
   (void)instate; /* no use for this yet */
 
@@ -1230,11 +1231,11 @@ static CURLcode imap_state_select_resp(struct Curl_easy *data,
         len++;
       if(len && (p[len] == ']')) {
         struct dynbuf uid;
-        Curl_dyn_init(&uid, 20);
-        if(Curl_dyn_addn(&uid, p, len))
+        curlx_dyn_init(&uid, 20);
+        if(curlx_dyn_addn(&uid, p, len))
           return CURLE_OUT_OF_MEMORY;
         free(imapc->mailbox_uidvalidity);
-        imapc->mailbox_uidvalidity = Curl_dyn_ptr(&uid);
+        imapc->mailbox_uidvalidity = curlx_dyn_ptr(&uid);
       }
     }
   }
@@ -1276,7 +1277,7 @@ static CURLcode imap_state_fetch_resp(struct Curl_easy *data,
 {
   CURLcode result = CURLE_OK;
   struct pingpong *pp = &imapc->pp;
-  const char *ptr = Curl_dyn_ptr(&imapc->pp.recvbuf);
+  const char *ptr = curlx_dyn_ptr(&imapc->pp.recvbuf);
   size_t len = imapc->pp.nfinal;
   bool parsed = FALSE;
   curl_off_t size = 0;
@@ -1294,8 +1295,8 @@ static CURLcode imap_state_fetch_resp(struct Curl_easy *data,
   ptr = memchr(ptr, '{', len);
   if(ptr) {
     ptr++;
-    if(!Curl_str_number(&ptr, &size, CURL_OFF_T_MAX) &&
-       !Curl_str_single(&ptr, '}'))
+    if(!curlx_str_number(&ptr, &size, CURL_OFF_T_MAX) &&
+       !curlx_str_single(&ptr, '}'))
       parsed = TRUE;
   }
 
@@ -1310,7 +1311,7 @@ static CURLcode imap_state_fetch_resp(struct Curl_easy *data,
       size_t chunk = pp->overflow;
 
       /* keep only the overflow */
-      Curl_dyn_tail(&pp->recvbuf, chunk);
+      curlx_dyn_tail(&pp->recvbuf, chunk);
       pp->nfinal = 0; /* done */
 
       if(chunk > (size_t)size)
@@ -1323,7 +1324,7 @@ static CURLcode imap_state_fetch_resp(struct Curl_easy *data,
         return CURLE_OK;
       }
       result = Curl_client_write(data, CLIENTWRITE_BODY,
-                                 Curl_dyn_ptr(&pp->recvbuf), chunk);
+                                 curlx_dyn_ptr(&pp->recvbuf), chunk);
       if(result)
         return result;
 
@@ -1334,12 +1335,12 @@ static CURLcode imap_state_fetch_resp(struct Curl_easy *data,
       if(pp->overflow > chunk) {
         /* remember the remaining trailing overflow data */
         pp->overflow -= chunk;
-        Curl_dyn_tail(&pp->recvbuf, pp->overflow);
+        curlx_dyn_tail(&pp->recvbuf, pp->overflow);
       }
       else {
         pp->overflow = 0; /* handled */
         /* Free the cache */
-        Curl_dyn_reset(&pp->recvbuf);
+        curlx_dyn_reset(&pp->recvbuf);
       }
     }
 
@@ -1898,7 +1899,7 @@ static void imap_conn_dtor(void *key, size_t klen, void *entry)
   (void)key;
   (void)klen;
   Curl_pp_disconnect(&imapc->pp);
-  Curl_dyn_free(&imapc->dyn);
+  curlx_dyn_free(&imapc->dyn);
   Curl_safefree(imapc->mailbox);
   Curl_safefree(imapc->mailbox_uidvalidity);
   free(imapc);
@@ -1922,7 +1923,7 @@ static CURLcode imap_setup_connection(struct Curl_easy *data,
   imapc->preftype = IMAP_TYPE_ANY;
   Curl_sasl_init(&imapc->sasl, data, &saslimap);
 
-  Curl_dyn_init(&imapc->dyn, DYN_IMAP_CMD);
+  curlx_dyn_init(&imapc->dyn, DYN_IMAP_CMD);
   Curl_pp_init(pp);
 
   if(Curl_conn_meta_set(conn, CURL_META_IMAP_CONN, imapc, imap_conn_dtor))
@@ -1958,10 +1959,10 @@ static CURLcode imap_sendf(struct Curl_easy *data,
             ++imapc->cmdid);
 
   /* start with a blank buffer */
-  Curl_dyn_reset(&imapc->dyn);
+  curlx_dyn_reset(&imapc->dyn);
 
   /* append tag + space + fmt */
-  result = Curl_dyn_addf(&imapc->dyn, "%s %s", imapc->resptag, fmt);
+  result = curlx_dyn_addf(&imapc->dyn, "%s %s", imapc->resptag, fmt);
   if(!result) {
     va_list ap;
     va_start(ap, fmt);
@@ -1969,7 +1970,7 @@ static CURLcode imap_sendf(struct Curl_easy *data,
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wformat-nonliteral"
 #endif
-    result = Curl_pp_vsendf(data, &imapc->pp, Curl_dyn_ptr(&imapc->dyn), ap);
+    result = Curl_pp_vsendf(data, &imapc->pp, curlx_dyn_ptr(&imapc->dyn), ap);
 #ifdef __clang__
 #pragma clang diagnostic pop
 #endif
@@ -2003,24 +2004,24 @@ static char *imap_atom(const char *str, bool escape_only)
     /* nothing to escape, return a strdup */
     return strdup(str);
 
-  Curl_dyn_init(&line, 2000);
+  curlx_dyn_init(&line, 2000);
 
-  if(!escape_only && Curl_dyn_addn(&line, "\"", 1))
+  if(!escape_only && curlx_dyn_addn(&line, "\"", 1))
     return NULL;
 
   while(*str) {
     if((*str == '\\' || *str == '"') &&
-       Curl_dyn_addn(&line, "\\", 1))
+       curlx_dyn_addn(&line, "\\", 1))
       return NULL;
-    if(Curl_dyn_addn(&line, str, 1))
+    if(curlx_dyn_addn(&line, str, 1))
       return NULL;
     str++;
   }
 
-  if(!escape_only && Curl_dyn_addn(&line, "\"", 1))
+  if(!escape_only && curlx_dyn_addn(&line, "\"", 1))
     return NULL;
 
-  return Curl_dyn_ptr(&line);
+  return curlx_dyn_ptr(&line);
 }
 
 /***********************************************************************
index 46b29ad9a0b1bb40678ffb97f2fcdfb9484e04d9..e197afd79531e92a59388f36534c96874e5735e7 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "curl_setup.h"
 #include "curl_ctype.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 #ifndef HAVE_INET_PTON
 
index 5c74d9f033b2872c1774ea94a14749ecfa2bc88d..9ebba4e3d1d0d1d6de0e83e432b52647c43a25d1 100644 (file)
 #include "url.h"
 #include "cfilters.h"
 #include "cf-socket.h"
-#include "curl_base64.h"
+#include "curlx/base64.h"
 #include "ftp.h"
 #include "curl_gssapi.h"
 #include "sendf.h"
 #include "transfer.h"
 #include "curl_krb5.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "strcase.h"
 #include "strdup.h"
 
@@ -247,7 +247,7 @@ krb5_auth(void *app_data, struct Curl_easy *data, struct connectdata *conn)
       if(Curl_GetFTPResponse(data, &nread, NULL))
         return -1;
       else {
-        char *line = Curl_dyn_ptr(&ftpc->pp.recvbuf);
+        char *line = curlx_dyn_ptr(&ftpc->pp.recvbuf);
         if(line[0] != '3')
           return -1;
       }
@@ -308,7 +308,7 @@ krb5_auth(void *app_data, struct Curl_easy *data, struct connectdata *conn)
       if(output_buffer.length) {
         char *cmd;
 
-        result = Curl_base64_encode((char *)output_buffer.value,
+        result = curlx_base64_encode((char *)output_buffer.value,
                                     output_buffer.length, &p, &base64_sz);
         if(result) {
           infof(data, "base64-encoding: %s", curl_easy_strerror(result));
@@ -335,8 +335,8 @@ krb5_auth(void *app_data, struct Curl_easy *data, struct connectdata *conn)
           break;
         }
         else {
-          size_t len = Curl_dyn_len(&ftpc->pp.recvbuf);
-          p = Curl_dyn_ptr(&ftpc->pp.recvbuf);
+          size_t len = curlx_dyn_len(&ftpc->pp.recvbuf);
+          p = curlx_dyn_ptr(&ftpc->pp.recvbuf);
           if((len < 4) || (p[0] != '2' && p[0] != '3')) {
             infof(data, "Server did not accept auth data");
             ret = AUTH_ERROR;
@@ -351,7 +351,7 @@ krb5_auth(void *app_data, struct Curl_easy *data, struct connectdata *conn)
         if(p) {
           unsigned char *outptr;
           size_t outlen;
-          result = Curl_base64_decode(p + 5, &outptr, &outlen);
+          result = curlx_base64_decode(p + 5, &outptr, &outlen);
           if(result) {
             failf(data, "base64-decoding: %s", curl_easy_strerror(result));
             ret = AUTH_CONTINUE;
@@ -540,7 +540,7 @@ static CURLcode read_data(struct Curl_easy *data, int sockindex,
     if(len > CURL_MAX_INPUT_LENGTH)
       return CURLE_TOO_LARGE;
 
-    Curl_dyn_reset(&buf->buf);
+    curlx_dyn_reset(&buf->buf);
   }
   else
     return CURLE_RECV_ERROR;
@@ -551,18 +551,18 @@ static CURLcode read_data(struct Curl_easy *data, int sockindex,
     result = socket_read(data, sockindex, buffer, (size_t)nread);
     if(result)
       return result;
-    result = Curl_dyn_addn(&buf->buf, buffer, nread);
+    result = curlx_dyn_addn(&buf->buf, buffer, nread);
     if(result)
       return result;
     len -= nread;
   } while(len);
   /* this decodes the dynbuf *in place* */
   nread = conn->mech->decode(conn->app_data,
-                             Curl_dyn_ptr(&buf->buf),
+                             curlx_dyn_ptr(&buf->buf),
                              len, conn->data_prot, conn);
   if(nread < 0)
     return CURLE_RECV_ERROR;
-  Curl_dyn_setlen(&buf->buf, nread);
+  curlx_dyn_setlen(&buf->buf, nread);
   buf->index = 0;
   return CURLE_OK;
 }
@@ -570,10 +570,10 @@ static CURLcode read_data(struct Curl_easy *data, int sockindex,
 static size_t
 buffer_read(struct krb5buffer *buf, void *data, size_t len)
 {
-  size_t size = Curl_dyn_len(&buf->buf);
+  size_t size = curlx_dyn_len(&buf->buf);
   if(size - buf->index < len)
     len = size - buf->index;
-  memcpy(data, Curl_dyn_ptr(&buf->buf) + buf->index, len);
+  memcpy(data, curlx_dyn_ptr(&buf->buf) + buf->index, len);
   buf->index += len;
   return len;
 }
@@ -608,7 +608,7 @@ static ssize_t sec_recv(struct Curl_easy *data, int sockindex,
   while(len > 0) {
     if(read_data(data, sockindex, &conn->in_buffer))
       return -1;
-    if(Curl_dyn_len(&conn->in_buffer.buf) == 0) {
+    if(curlx_dyn_len(&conn->in_buffer.buf) == 0) {
       if(bytes_read > 0)
         conn->in_buffer.eof_flag = 1;
       return bytes_read;
@@ -648,7 +648,7 @@ static void do_sec_send(struct Curl_easy *data, struct connectdata *conn,
     return; /* error */
 
   if(iscmd) {
-    error = Curl_base64_encode(buffer, curlx_sitouz(bytes),
+    error = curlx_base64_encode(buffer, curlx_sitouz(bytes),
                                &cmd_buffer, &cmd_size);
     if(error) {
       free(buffer);
@@ -726,7 +726,7 @@ int Curl_sec_read_msg(struct Curl_easy *data, struct connectdata *conn,
 
   DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);
 
-  error = Curl_base64_decode(buffer + 4, (unsigned char **)&buf, &decoded_sz);
+  error = curlx_base64_decode(buffer + 4, (unsigned char **)&buf, &decoded_sz);
   if(error || decoded_sz == 0)
     return -1;
 
@@ -800,7 +800,7 @@ static int sec_set_protection_level(struct Curl_easy *data)
     }
     conn->buffer_size = buffer_size;
 
-    line = Curl_dyn_ptr(&ftpc->pp.recvbuf);
+    line = curlx_dyn_ptr(&ftpc->pp.recvbuf);
     pbsz = strstr(line, "PBSZ=");
     if(pbsz) {
       /* stick to default value if the check fails */
@@ -922,7 +922,7 @@ Curl_sec_login(struct Curl_easy *data, struct connectdata *conn)
 void
 Curl_sec_conn_init(struct connectdata *conn)
 {
-  Curl_dyn_init(&conn->in_buffer.buf, CURL_MAX_INPUT_LENGTH);
+  curlx_dyn_init(&conn->in_buffer.buf, CURL_MAX_INPUT_LENGTH);
   conn->in_buffer.index = 0;
   conn->in_buffer.eof_flag = 0;
 }
@@ -933,7 +933,7 @@ Curl_sec_conn_destroy(struct connectdata *conn)
   if(conn->mech && conn->mech->end)
     conn->mech->end(conn->app_data);
   Curl_safefree(conn->app_data);
-  Curl_dyn_free(&conn->in_buffer.buf);
+  curlx_dyn_free(&conn->in_buffer.buf);
   conn->in_buffer.index = 0;
   conn->in_buffer.eof_flag = 0;
   conn->sec_complete = 0;
index 5ad02d9316133554d0e39db0ef3bb90ec53fe3cd..6c2c209349a45f8834cb8748d638eb6c2cec7ebb 100644 (file)
 #include "progress.h"
 #include "transfer.h"
 #include "strcase.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 #include "curl_ldap.h"
 #include "curl_multibyte.h"
-#include "curl_base64.h"
+#include "curlx/base64.h"
 #include "connect.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -629,8 +629,8 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
           if((attr_len > 7) &&
              (strcmp(";binary", attr + (attr_len - 7)) == 0)) {
             /* Binary attribute, encode to base64. */
-            result = Curl_base64_encode(vals[i]->bv_val, vals[i]->bv_len,
-                                        &val_b64, &val_b64_sz);
+            result = curlx_base64_encode(vals[i]->bv_val, vals[i]->bv_len,
+                                         &val_b64, &val_b64_sz);
             if(result) {
               ldap_value_free_len(vals);
               FREE_ON_WINLDAP(attr);
@@ -729,7 +729,7 @@ static void _ldap_trace(const char *fmt, ...)
   if(do_trace == -1) {
     const char *env = getenv("CURL_TRACE");
     curl_off_t e = 0;
-    if(!Curl_str_number(&env, &e, INT_MAX))
+    if(!curlx_str_number(&env, &e, INT_MAX))
       do_trace = e > 0;
   }
   if(!do_trace)
@@ -884,7 +884,7 @@ static int _ldap_url_parse2(struct Curl_easy *data,
       CURLcode result;
       struct Curl_str out;
 
-      if(Curl_str_until(&atp, &out, 1024, ','))
+      if(curlx_str_until(&atp, &out, 1024, ','))
         break;
 
       LDAP_TRACE(("attr[%zu] '%.*s'\n", i, (int)out.len, out.str));
@@ -913,7 +913,7 @@ static int _ldap_url_parse2(struct Curl_easy *data,
 #endif
 
       ludp->lud_attrs_dups++;
-      if(Curl_str_single(&atp, ','))
+      if(curlx_str_single(&atp, ','))
         break;
     }
   }
index 4f0f349c601da439575c2f23c92e5776f52ca213..a77085a6b28c7db26218d31171f2416066d14f33 100644 (file)
--- a/lib/md4.c
+++ b/lib/md4.c
@@ -30,7 +30,7 @@
 
 #include "strdup.h"
 #include "curl_md4.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 
 #ifdef USE_OPENSSL
 #include <openssl/opensslv.h>
index c27aa4176890e91fb88921b657f4de6ba51117d5..6a273c56c0e3ca53679255239fbbca317a270751 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -32,7 +32,7 @@
 
 #include "curl_md5.h"
 #include "curl_hmac.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 
 #ifdef USE_MBEDTLS
 #include <mbedtls/version.h>
index af5ef034fe7f1f2d3c8d8548a13a7ae4550ed7d4..1a107b746006afddaf3384d236e8583711db4f5b 100644 (file)
@@ -29,7 +29,7 @@
 struct Curl_easy;
 
 #include "mime.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "urldata.h"
 #include "sendf.h"
 #include "strdup.h"
@@ -45,7 +45,7 @@ struct Curl_easy;
 #include "rand.h"
 #include "slist.h"
 #include "strcase.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
 #include "curl_memory.h"
@@ -318,19 +318,19 @@ static char *escape_string(struct Curl_easy *data,
   if(strategy == MIMESTRATEGY_MAIL || (data && (data->set.mime_formescape)))
     table = mimetable;
 
-  Curl_dyn_init(&db, CURL_MAX_INPUT_LENGTH);
+  curlx_dyn_init(&db, CURL_MAX_INPUT_LENGTH);
 
-  for(result = Curl_dyn_addn(&db, STRCONST("")); !result && *src; src++) {
+  for(result = curlx_dyn_addn(&db, STRCONST("")); !result && *src; src++) {
     for(p = table; *p && **p != *src; p++)
       ;
 
     if(*p)
-      result = Curl_dyn_add(&db, *p + 1);
+      result = curlx_dyn_add(&db, *p + 1);
     else
-      result = Curl_dyn_addn(&db, src, 1);
+      result = curlx_dyn_addn(&db, src, 1);
   }
 
-  return Curl_dyn_ptr(&db);
+  return curlx_dyn_ptr(&db);
 }
 
 /* Check if header matches. */
index bedd3615cb398a861cb9d4147523c6b76142aedf..6d363be65105506bace724ebd28cf57d887a8737 100644 (file)
@@ -23,9 +23,9 @@
  */
 
 #include "curl_setup.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 #include "curl_printf.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 #include "curl_memory.h"
 /* The last #include file should be: */
@@ -173,8 +173,8 @@ struct asprintf {
 static int dollarstring(const char *p, const char **end)
 {
   curl_off_t num;
-  if(Curl_str_number(&p, &num, MAX_PARAMETERS) ||
-     Curl_str_single(&p, '$') || !num)
+  if(curlx_str_number(&p, &num, MAX_PARAMETERS) ||
+     curlx_str_single(&p, '$') || !num)
     return -1;
   *end = p;
   return (int)num - 1;
@@ -306,7 +306,7 @@ static int parsefmt(const char *format,
             is_neg = ('-' == *fmt);
             if(is_neg)
               fmt++;
-            if(Curl_str_number(&fmt, &num, INT_MAX))
+            if(curlx_str_number(&fmt, &num, INT_MAX))
               return PFMT_PREC;
             precision = (int)num;
             if(is_neg)
@@ -378,7 +378,7 @@ static int parsefmt(const char *format,
           curl_off_t num;
           flags |= FLAGS_WIDTH;
           fmt--;
-          if(Curl_str_number(&fmt, &num, INT_MAX))
+          if(curlx_str_number(&fmt, &num, INT_MAX))
             return PFMT_WIDTH;
           width = (int)num;
           break;
@@ -1087,7 +1087,7 @@ int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...)
 static int alloc_addbyter(unsigned char outc, void *f)
 {
   struct asprintf *infop = f;
-  CURLcode result = Curl_dyn_addn(infop->b, &outc, 1);
+  CURLcode result = curlx_dyn_addn(infop->b, &outc, 1);
   if(result) {
     infop->merr = result == CURLE_TOO_LARGE ? MERR_TOO_LARGE : MERR_MEM;
     return 1 ; /* fail */
@@ -1096,7 +1096,7 @@ static int alloc_addbyter(unsigned char outc, void *f)
 }
 
 /* appends the formatted string, returns MERR error code */
-int Curl_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save)
+int curlx_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save)
 {
   struct asprintf info;
   info.b = dyn;
@@ -1104,7 +1104,7 @@ int Curl_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save)
 
   (void)formatf(&info, alloc_addbyter, format, ap_save);
   if(info.merr) {
-    Curl_dyn_free(info.b);
+    curlx_dyn_free(info.b);
     return info.merr;
   }
   return 0;
@@ -1115,16 +1115,16 @@ char *curl_mvaprintf(const char *format, va_list ap_save)
   struct asprintf info;
   struct dynbuf dyn;
   info.b = &dyn;
-  Curl_dyn_init(info.b, DYN_APRINTF);
+  curlx_dyn_init(info.b, DYN_APRINTF);
   info.merr = MERR_OK;
 
   (void)formatf(&info, alloc_addbyter, format, ap_save);
   if(info.merr) {
-    Curl_dyn_free(info.b);
+    curlx_dyn_free(info.b);
     return NULL;
   }
-  if(Curl_dyn_len(info.b))
-    return Curl_dyn_ptr(info.b);
+  if(curlx_dyn_len(info.b))
+    return curlx_dyn_ptr(info.b);
   return strdup("");
 }
 
index 0d736de2907362de85b270edacc036d867d52b74..77e7334613120afac8a3647fa08e59a0df886b9f 100644 (file)
@@ -37,7 +37,7 @@
 #include "strdup.h"
 #include "url.h"
 #include "escape.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "curl_printf.h"
 #include "curl_memory.h"
 #include "multiif.h"
@@ -146,8 +146,8 @@ static void mqtt_easy_dtor(void *key, size_t klen, void *entry)
   struct MQTT *mq = entry;
   (void)key;
   (void)klen;
-  Curl_dyn_free(&mq->sendbuf);
-  Curl_dyn_free(&mq->recvbuf);
+  curlx_dyn_free(&mq->sendbuf);
+  curlx_dyn_free(&mq->recvbuf);
   free(mq);
 }
 
@@ -173,8 +173,8 @@ static CURLcode mqtt_setup_conn(struct Curl_easy *data,
   mq = calloc(1, sizeof(struct MQTT));
   if(!mq)
     return CURLE_OUT_OF_MEMORY;
-  Curl_dyn_init(&mq->recvbuf, DYN_MQTT_RECV);
-  Curl_dyn_init(&mq->sendbuf, DYN_MQTT_SEND);
+  curlx_dyn_init(&mq->recvbuf, DYN_MQTT_RECV);
+  curlx_dyn_init(&mq->sendbuf, DYN_MQTT_SEND);
   if(Curl_meta_set(data, CURL_META_MQTT_EASY, mq, mqtt_easy_dtor))
     return CURLE_OUT_OF_MEMORY;
   return CURLE_OK;
@@ -193,20 +193,20 @@ static CURLcode mqtt_send(struct Curl_easy *data,
   result = Curl_xfer_send(data, buf, len, FALSE, &n);
   if(result)
     return result;
-  mq->lastTime = Curl_now();
+  mq->lastTime = curlx_now();
   Curl_debug(data, CURLINFO_HEADER_OUT, buf, (size_t)n);
   if(len != n) {
     size_t nsend = len - n;
-    if(Curl_dyn_len(&mq->sendbuf)) {
-      DEBUGASSERT(Curl_dyn_len(&mq->sendbuf) >= nsend);
-      result = Curl_dyn_tail(&mq->sendbuf, nsend); /* keep this much */
+    if(curlx_dyn_len(&mq->sendbuf)) {
+      DEBUGASSERT(curlx_dyn_len(&mq->sendbuf) >= nsend);
+      result = curlx_dyn_tail(&mq->sendbuf, nsend); /* keep this much */
     }
     else {
-      result = Curl_dyn_addn(&mq->sendbuf, &buf[n], nsend);
+      result = curlx_dyn_addn(&mq->sendbuf, &buf[n], nsend);
     }
   }
   else
-    Curl_dyn_reset(&mq->sendbuf);
+    curlx_dyn_reset(&mq->sendbuf);
   return result;
 }
 
@@ -424,7 +424,7 @@ static CURLcode mqtt_recv_atleast(struct Curl_easy *data, size_t nbytes)
 
   if(!mq)
     return CURLE_FAILED_INIT;
-  rlen = Curl_dyn_len(&mq->recvbuf);
+  rlen = curlx_dyn_len(&mq->recvbuf);
 
   if(rlen < nbytes) {
     unsigned char readbuf[1024];
@@ -435,9 +435,9 @@ static CURLcode mqtt_recv_atleast(struct Curl_easy *data, size_t nbytes)
     if(result)
       return result;
     DEBUGASSERT(nread >= 0);
-    if(Curl_dyn_addn(&mq->recvbuf, readbuf, (size_t)nread))
+    if(curlx_dyn_addn(&mq->recvbuf, readbuf, (size_t)nread))
       return CURLE_OUT_OF_MEMORY;
-    rlen = Curl_dyn_len(&mq->recvbuf);
+    rlen = curlx_dyn_len(&mq->recvbuf);
   }
   return (rlen >= nbytes) ? CURLE_OK : CURLE_AGAIN;
 }
@@ -447,11 +447,11 @@ static void mqtt_recv_consume(struct Curl_easy *data, size_t nbytes)
   struct MQTT *mq = Curl_meta_get(data, CURL_META_MQTT_EASY);
   DEBUGASSERT(mq);
   if(mq) {
-    size_t rlen = Curl_dyn_len(&mq->recvbuf);
+    size_t rlen = curlx_dyn_len(&mq->recvbuf);
     if(rlen <= nbytes)
-      Curl_dyn_reset(&mq->recvbuf);
+      curlx_dyn_reset(&mq->recvbuf);
     else
-      Curl_dyn_tail(&mq->recvbuf, rlen - nbytes);
+      curlx_dyn_tail(&mq->recvbuf, rlen - nbytes);
   }
 }
 
@@ -470,14 +470,14 @@ static CURLcode mqtt_verify_connack(struct Curl_easy *data)
     goto fail;
 
   /* verify CONNACK */
-  DEBUGASSERT(Curl_dyn_len(&mq->recvbuf) >= MQTT_CONNACK_LEN);
-  ptr = Curl_dyn_ptr(&mq->recvbuf);
+  DEBUGASSERT(curlx_dyn_len(&mq->recvbuf) >= MQTT_CONNACK_LEN);
+  ptr = curlx_dyn_ptr(&mq->recvbuf);
   Curl_debug(data, CURLINFO_HEADER_IN, ptr, MQTT_CONNACK_LEN);
 
   if(ptr[0] != 0x00 || ptr[1] != 0x00) {
     failf(data, "Expected %02x%02x but got %02x%02x",
           0x00, 0x00, ptr[0], ptr[1]);
-    Curl_dyn_reset(&mq->recvbuf);
+    curlx_dyn_reset(&mq->recvbuf);
     result = CURLE_WEIRD_SERVER_REPLY;
     goto fail;
   }
@@ -572,14 +572,14 @@ static CURLcode mqtt_verify_suback(struct Curl_easy *data)
     goto fail;
 
   /* verify SUBACK */
-  DEBUGASSERT(Curl_dyn_len(&mq->recvbuf) >= MQTT_SUBACK_LEN);
-  ptr = Curl_dyn_ptr(&mq->recvbuf);
+  DEBUGASSERT(curlx_dyn_len(&mq->recvbuf) >= MQTT_SUBACK_LEN);
+  ptr = curlx_dyn_ptr(&mq->recvbuf);
   Curl_debug(data, CURLINFO_HEADER_IN, ptr, MQTT_SUBACK_LEN);
 
   if(((unsigned char)ptr[0]) != ((mqtt->packetid >> 8) & 0xff) ||
      ((unsigned char)ptr[1]) != (mqtt->packetid & 0xff) ||
      ptr[2] != 0x00) {
-    Curl_dyn_reset(&mq->recvbuf);
+    curlx_dyn_reset(&mq->recvbuf);
     result = CURLE_WEIRD_SERVER_REPLY;
     goto fail;
   }
@@ -777,7 +777,7 @@ MQTT_SUBACK_COMING:
     }
 
     /* we received something */
-    mq->lastTime = Curl_now();
+    mq->lastTime = curlx_now();
 
     /* if QoS is set, message contains packet id */
     result = Curl_client_write(data, CLIENTWRITE_BODY, buffer, nread);
@@ -807,7 +807,7 @@ static CURLcode mqtt_do(struct Curl_easy *data, bool *done)
 
   if(!mq)
     return CURLE_FAILED_INIT;
-  mq->lastTime = Curl_now();
+  mq->lastTime = curlx_now();
   mq->pingsent = FALSE;
 
   result = mqtt_connect(data);
@@ -826,8 +826,8 @@ static CURLcode mqtt_done(struct Curl_easy *data,
   (void)status;
   (void)premature;
   if(mq) {
-    Curl_dyn_free(&mq->sendbuf);
-    Curl_dyn_free(&mq->recvbuf);
+    curlx_dyn_free(&mq->sendbuf);
+    curlx_dyn_free(&mq->recvbuf);
   }
   return CURLE_OK;
 }
@@ -846,8 +846,8 @@ static CURLcode mqtt_ping(struct Curl_easy *data)
   if(mqtt->state == MQTT_FIRST &&
      !mq->pingsent &&
      data->set.upkeep_interval_ms > 0) {
-    struct curltime t = Curl_now();
-    timediff_t diff = Curl_timediff(t, mq->lastTime);
+    struct curltime t = curlx_now();
+    timediff_t diff = curlx_timediff(t, mq->lastTime);
 
     if(diff > data->set.upkeep_interval_ms) {
       /* 0xC0 is PINGREQ, and 0x00 is remaining length */
@@ -877,10 +877,10 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
 
   *done = FALSE;
 
-  if(Curl_dyn_len(&mq->sendbuf)) {
+  if(curlx_dyn_len(&mq->sendbuf)) {
     /* send the remainder of an outgoing packet */
-    result = mqtt_send(data, Curl_dyn_ptr(&mq->sendbuf),
-                       Curl_dyn_len(&mq->sendbuf));
+    result = mqtt_send(data, curlx_dyn_ptr(&mq->sendbuf),
+                       curlx_dyn_len(&mq->sendbuf));
     if(result)
       return result;
   }
@@ -905,7 +905,7 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
     Curl_debug(data, CURLINFO_HEADER_IN, (const char *)&mq->firstbyte, 1);
 
     /* we received something */
-    mq->lastTime = Curl_now();
+    mq->lastTime = curlx_now();
 
     /* remember the first byte */
     mq->npacket = 0;
index ddeab7e86726fb955c774187232542494ea98198..f71d7a88f3fa36ad07d3ac9b1fbb2ae2a722616e 100644 (file)
 #include "multiif.h"
 #include "multi_ev.h"
 #include "sendf.h"
-#include "timeval.h"
+#include "curlx/timeval.h"
 #include "http.h"
 #include "select.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "speedcheck.h"
 #include "conncache.h"
 #include "multihandle.h"
@@ -237,7 +237,7 @@ struct Curl_multi *Curl_multi_handle(unsigned int xfer_table_size,
   Curl_uint_bset_init(&multi->pending);
   Curl_uint_bset_init(&multi->msgsent);
   Curl_hash_init(&multi->proto_hash, 23,
-                 Curl_hash_str, Curl_str_key_compare, ph_freeentry);
+                 Curl_hash_str, curlx_str_key_compare, ph_freeentry);
   Curl_llist_init(&multi->msglist, NULL);
 
   multi->multiplexing = TRUE;
@@ -1633,22 +1633,22 @@ static bool multi_handle_timeout(struct Curl_easy *data,
       since = data->progress.t_startop;
     if(data->mstate == MSTATE_RESOLVING)
       failf(data, "Resolving timed out after %" FMT_TIMEDIFF_T
-            " milliseconds", Curl_timediff(*now, since));
+            " milliseconds", curlx_timediff(*now, since));
     else if(data->mstate == MSTATE_CONNECTING)
       failf(data, "Connection timed out after %" FMT_TIMEDIFF_T
-            " milliseconds", Curl_timediff(*now, since));
+            " milliseconds", curlx_timediff(*now, since));
     else {
       struct SingleRequest *k = &data->req;
       if(k->size != -1) {
         failf(data, "Operation timed out after %" FMT_TIMEDIFF_T
               " milliseconds with %" FMT_OFF_T " out of %"
               FMT_OFF_T " bytes received",
-              Curl_timediff(*now, since), k->bytecount, k->size);
+              curlx_timediff(*now, since), k->bytecount, k->size);
       }
       else {
         failf(data, "Operation timed out after %" FMT_TIMEDIFF_T
               " milliseconds with %" FMT_OFF_T " bytes received",
-              Curl_timediff(*now, since), k->bytecount);
+              curlx_timediff(*now, since), k->bytecount);
       }
     }
     *result = CURLE_OPERATION_TIMEDOUT;
@@ -2650,7 +2650,7 @@ CURLMcode curl_multi_perform(CURLM *m, int *running_handles)
 {
   CURLMcode returncode = CURLM_OK;
   struct Curl_tree *t = NULL;
-  struct curltime now = Curl_now();
+  struct curltime now = curlx_now();
   struct Curl_multi *multi = m;
   unsigned int mid;
   SIGPIPE_VARIABLE(pipe_st);
@@ -2897,7 +2897,7 @@ static CURLMcode add_next_timeout(struct curltime now,
   for(e = Curl_llist_head(list); e;) {
     struct Curl_llist_node *n = Curl_node_next(e);
     struct time_node *node = Curl_node_elem(e);
-    timediff_t diff = Curl_timediff_us(node->time, now);
+    timediff_t diff = curlx_timediff_us(node->time, now);
     if(diff <= 0)
       /* remove outdated entry */
       Curl_node_remove(e);
@@ -2990,7 +2990,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
   (void)ev_bitmask;
   memset(&mrc, 0, sizeof(mrc));
   mrc.multi = multi;
-  mrc.now = Curl_now();
+  mrc.now = curlx_now();
   sigpipe_init(&mrc.pipe_st);
 
   if(checkall) {
@@ -3028,7 +3028,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
      * to set a 0 timeout and call us again, we run them here.
      * Do that only once or it might be unfair to transfers on other
      * sockets. */
-    mrc.now = Curl_now();
+    mrc.now = curlx_now();
     result = multi_run_expired(&mrc);
   }
 
@@ -3170,7 +3170,7 @@ static CURLMcode multi_timeout(struct Curl_multi *multi,
 
   if(multi->timetree) {
     /* we have a tree of expire times */
-    struct curltime now = Curl_now();
+    struct curltime now = curlx_now();
 
     /* splay the lowest to the bottom */
     multi->timetree = Curl_splay(tv_zero, multi->timetree);
@@ -3181,9 +3181,9 @@ static CURLMcode multi_timeout(struct Curl_multi *multi,
     /* 'multi->timetree' will be non-NULL here but the compilers sometimes
        yell at us if we assume so */
     if(multi->timetree &&
-       Curl_timediff_us(multi->timetree->key, now) > 0) {
+       curlx_timediff_us(multi->timetree->key, now) > 0) {
       /* some time left before expiration */
-      timediff_t diff = Curl_timediff_ceil(multi->timetree->key, now);
+      timediff_t diff = curlx_timediff_ceil(multi->timetree->key, now);
       /* this should be safe even on 32-bit archs, as we do not use that
          overly long timeouts */
       *timeout_ms = (long)diff;
@@ -3256,7 +3256,7 @@ CURLMcode Curl_update_timer(struct Curl_multi *multi)
 #endif
     set_value = TRUE;
   }
-  else if(Curl_timediff_us(multi->last_expire_ts, expire_ts)) {
+  else if(curlx_timediff_us(multi->last_expire_ts, expire_ts)) {
     /* We had a timeout before and have one now, the absolute timestamp
      * differs. The relative timeout_ms may be the same, but the starting
      * point differs. Let the application restart its timer. */
@@ -3340,7 +3340,7 @@ multi_addtimeout(struct Curl_easy *data,
     /* find the correct spot in the list */
     for(e = Curl_llist_head(timeoutlist); e; e = Curl_node_next(e)) {
       struct time_node *check = Curl_node_elem(e);
-      timediff_t diff = Curl_timediff(check->time, node->time);
+      timediff_t diff = curlx_timediff(check->time, node->time);
       if(diff > 0)
         break;
       prev = e;
@@ -3389,7 +3389,7 @@ void Curl_expire_ex(struct Curl_easy *data,
     /* This means that the struct is added as a node in the splay tree.
        Compare if the new time is earlier, and only remove-old/add-new if it
        is. */
-    timediff_t diff = Curl_timediff(set, *curr_expire);
+    timediff_t diff = curlx_timediff(set, *curr_expire);
     int rc;
 
     if(diff > 0) {
@@ -3427,7 +3427,7 @@ void Curl_expire_ex(struct Curl_easy *data,
  */
 void Curl_expire(struct Curl_easy *data, timediff_t milli, expire_id id)
 {
-  struct curltime now = Curl_now();
+  struct curltime now = curlx_now();
   Curl_expire_ex(data, &now, milli, id);
 }
 
index ca634b2a9e5430f97302ea2aa99711d65776f25a..6d01cca2a7851d4fb6a4847bf040ab81518ee70d 100644 (file)
 #include "cfilters.h"
 #include "curl_trc.h"
 #include "multiif.h"
-#include "timeval.h"
+#include "curlx/timeval.h"
 #include "multi_ev.h"
 #include "select.h"
 #include "uint-bset.h"
 #include "uint-spbset.h"
 #include "uint-table.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "multihandle.h"
 #include "socks.h"
 /* The last 3 #include files should be in this order */
index 83c6f42ac28feb6176dca7024efc391dac004c96..5de3286385de0d611b80ec99ef03081ac081c49d 100644 (file)
@@ -39,7 +39,7 @@
 #include "netrc.h"
 #include "strcase.h"
 #include "curl_get_line.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -78,18 +78,18 @@ static NETRCcode file2memory(const char *filename, struct dynbuf *filebuf)
   NETRCcode ret = NETRC_FILE_MISSING; /* if it cannot open the file */
   FILE *file = fopen(filename, FOPEN_READTEXT);
   struct dynbuf linebuf;
-  Curl_dyn_init(&linebuf, MAX_NETRC_LINE);
+  curlx_dyn_init(&linebuf, MAX_NETRC_LINE);
 
   if(file) {
     ret = NETRC_OK;
     while(Curl_get_line(&linebuf, file)) {
       CURLcode result;
-      const char *line = Curl_dyn_ptr(&linebuf);
+      const char *line = curlx_dyn_ptr(&linebuf);
       /* skip comments on load */
-      Curl_str_passblanks(&line);
+      curlx_str_passblanks(&line);
       if(*line == '#')
         continue;
-      result = Curl_dyn_add(filebuf, line);
+      result = curlx_dyn_add(filebuf, line);
       if(result) {
         ret = curl2netrc(result);
         goto done;
@@ -97,7 +97,7 @@ static NETRCcode file2memory(const char *filename, struct dynbuf *filebuf)
     }
   }
 done:
-  Curl_dyn_free(&linebuf);
+  curlx_dyn_free(&linebuf);
   if(file)
     fclose(file);
   return ret;
@@ -126,7 +126,7 @@ static NETRCcode parsenetrc(struct store_netrc *store,
   struct dynbuf token;
   struct dynbuf *filebuf = &store->filebuf;
   DEBUGASSERT(!*passwordp);
-  Curl_dyn_init(&token, MAX_NETRC_TOKEN);
+  curlx_dyn_init(&token, MAX_NETRC_TOKEN);
 
   if(!store->loaded) {
     NETRCcode ret = file2memory(netrcfile, filebuf);
@@ -135,15 +135,15 @@ static NETRCcode parsenetrc(struct store_netrc *store,
     store->loaded = TRUE;
   }
 
-  netrcbuffer = Curl_dyn_ptr(filebuf);
+  netrcbuffer = curlx_dyn_ptr(filebuf);
 
   while(!done) {
     const char *tok = netrcbuffer;
     while(tok && !done) {
       const char *tok_end;
       bool quoted;
-      Curl_dyn_reset(&token);
-      Curl_str_passblanks(&tok);
+      curlx_dyn_reset(&token);
+      curlx_str_passblanks(&tok);
       /* tok is first non-space letter */
       if(state == MACDEF) {
         if((*tok == '\n') || (*tok == '\r'))
@@ -169,7 +169,7 @@ static NETRCcode parsenetrc(struct store_netrc *store,
           retcode = NETRC_SYNTAX_ERROR;
           goto out;
         }
-        result = Curl_dyn_addn(&token, tok, len);
+        result = curlx_dyn_addn(&token, tok, len);
         if(result) {
           retcode = curl2netrc(result);
           goto out;
@@ -206,7 +206,7 @@ static NETRCcode parsenetrc(struct store_netrc *store,
             endquote = TRUE;
             break;
           }
-          result = Curl_dyn_addn(&token, &s, 1);
+          result = curlx_dyn_addn(&token, &s, 1);
           if(result) {
             retcode = curl2netrc(result);
             goto out;
@@ -220,7 +220,7 @@ static NETRCcode parsenetrc(struct store_netrc *store,
         }
       }
 
-      tok = Curl_dyn_ptr(&token);
+      tok = curlx_dyn_ptr(&token);
 
       switch(state) {
       case NOTHING:
@@ -332,7 +332,7 @@ static NETRCcode parsenetrc(struct store_netrc *store,
   } /* while !done */
 
 out:
-  Curl_dyn_free(&token);
+  curlx_dyn_free(&token);
   if(!retcode) {
     if(!password && our_login) {
       /* success without a password, set a blank one */
@@ -351,7 +351,7 @@ out:
     *passwordp = password;
   }
   else {
-    Curl_dyn_free(filebuf);
+    curlx_dyn_free(filebuf);
     if(!specific_login)
       free(login);
     free(password);
@@ -456,12 +456,12 @@ NETRCcode Curl_parsenetrc(struct store_netrc *store, const char *host,
 
 void Curl_netrc_init(struct store_netrc *s)
 {
-  Curl_dyn_init(&s->filebuf, MAX_NETRC_FILE);
+  curlx_dyn_init(&s->filebuf, MAX_NETRC_FILE);
   s->loaded = FALSE;
 }
 void Curl_netrc_cleanup(struct store_netrc *s)
 {
-  Curl_dyn_free(&s->filebuf);
+  curlx_dyn_free(&s->filebuf);
   s->loaded = FALSE;
 }
 #endif
index ac0f88622b79f461bd2ddb67919a0698a69e3eff..ef3bde5212ad2f55aee3672345ac04c73ed712c4 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "curl_setup.h"
 #ifndef CURL_DISABLE_NETRC
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 
 struct store_netrc {
   struct dynbuf filebuf;
index e0838b8762661e5b351a6686d679049b1b047793..f84ce1e7b76c93e655fcd773adc5ba55c80e8d7f 100644 (file)
@@ -29,7 +29,7 @@
 #include "inet_pton.h"
 #include "strcase.h"
 #include "noproxy.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
@@ -178,7 +178,7 @@ bool Curl_check_noproxy(const char *name, const char *no_proxy)
       bool match = FALSE;
 
       /* pass blanks */
-      Curl_str_passblanks(&p);
+      curlx_str_passblanks(&p);
 
       token = p;
       /* pass over the pattern */
@@ -247,7 +247,7 @@ bool Curl_check_noproxy(const char *name, const char *no_proxy)
           return TRUE;
       } /* if(tokenlen) */
       /* pass blanks after pattern */
-      Curl_str_passblanks(&p);
+      curlx_str_passblanks(&p);
       /* if not a comma, this ends the loop */
       if(*p != ',')
         break;
index 97a5591b8f3019083ab293b62a1525060853e82e..c52f6c3d2d16647d95ea6bf920385d4cc4ed6985 100644 (file)
@@ -47,7 +47,7 @@
 #include "vtls/vtls.h"
 #include "transfer.h"
 #include "curl_ldap.h"
-#include "curl_base64.h"
+#include "curlx/base64.h"
 #include "cfilters.h"
 #include "connect.h"
 #include "curl_sasl.h"
@@ -614,7 +614,7 @@ static CURLcode oldap_connect(struct Curl_easy *data, bool *done)
   if(do_trace < 0) {
     const char *env = getenv("CURL_OPENLDAP_TRACE");
     curl_off_t e = 0;
-    if(!Curl_str_number(&env, &e, INT_MAX))
+    if(!curlx_str_number(&env, &e, INT_MAX))
       do_trace = e > 0;
   }
   if(do_trace)
@@ -1165,8 +1165,8 @@ static ssize_t oldap_recv(struct Curl_easy *data, int sockindex, char *buf,
 
           /* Binary value, encode to base64. */
           if(bvals[i].bv_len)
-            result = Curl_base64_encode(bvals[i].bv_val, bvals[i].bv_len,
-                                        &val_b64, &val_b64_sz);
+            result = curlx_base64_encode(bvals[i].bv_val, bvals[i].bv_len,
+                                         &val_b64, &val_b64_sz);
           if(!result)
             result = client_write(data, STRCONST(": "), val_b64, val_b64_sz,
                                   STRCONST("\n"));
index 29ebd5a133864f001c8ebe2965da756148643120..7e0c69106c0a48d5a223ee415202c1e8208b38ec 100644 (file)
@@ -81,9 +81,9 @@
 
 #include <curl/curl.h>
 #include "strcase.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "parsedate.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /*
  * parsedate()
@@ -423,7 +423,7 @@ static int parsedate(const char *date, time_t *output)
         curl_off_t lval;
         int num_digits = 0;
         const char *p = date;
-        if(Curl_str_number(&p, &lval, 99999999))
+        if(curlx_str_number(&p, &lval, 99999999))
           return PARSEDATE_FAIL;
 
         /* we know num_digits cannot be larger than 8 */
index f90b40d3caab63663d6de5e80a92ed99795f2b0b..c5513f6050283e37821e33a474f46daab9a58d5a 100644 (file)
@@ -54,7 +54,7 @@ timediff_t Curl_pp_state_timeout(struct Curl_easy *data,
   timediff_t timeout_ms; /* in milliseconds */
   timediff_t response_time = (data->set.server_response_timeout) ?
     data->set.server_response_timeout : pp->response_time;
-  struct curltime now = Curl_now();
+  struct curltime now = curlx_now();
 
   /* if CURLOPT_SERVER_RESPONSE_TIMEOUT is set, use that to determine
      remaining time, or use pp->response because SERVER_RESPONSE_TIMEOUT is
@@ -63,7 +63,7 @@ timediff_t Curl_pp_state_timeout(struct Curl_easy *data,
 
   /* Without a requested timeout, we only wait 'response_time' seconds for the
      full response to arrive before we bail out */
-  timeout_ms = response_time - Curl_timediff(now, pp->response);
+  timeout_ms = response_time - curlx_timediff(now, pp->response);
 
   if(data->set.timeout && !disconnecting) {
     /* if timeout is requested, find out how much overall remains */
@@ -127,7 +127,7 @@ CURLcode Curl_pp_statemach(struct Curl_easy *data,
     if(Curl_pgrsUpdate(data))
       result = CURLE_ABORTED_BY_CALLBACK;
     else
-      result = Curl_speedcheck(data, Curl_now());
+      result = Curl_speedcheck(data, curlx_now());
 
     if(result)
       return result;
@@ -150,10 +150,10 @@ void Curl_pp_init(struct pingpong *pp)
 {
   DEBUGASSERT(!pp->initialised);
   pp->nread_resp = 0;
-  pp->response = Curl_now(); /* start response time-out now! */
+  pp->response = curlx_now(); /* start response time-out now! */
   pp->pending_resp = TRUE;
-  Curl_dyn_init(&pp->sendbuf, DYN_PINGPPONG_CMD);
-  Curl_dyn_init(&pp->recvbuf, DYN_PINGPPONG_CMD);
+  curlx_dyn_init(&pp->sendbuf, DYN_PINGPPONG_CMD);
+  curlx_dyn_init(&pp->recvbuf, DYN_PINGPPONG_CMD);
   pp->initialised = TRUE;
 }
 
@@ -190,19 +190,19 @@ CURLcode Curl_pp_vsendf(struct Curl_easy *data,
     /* cannot send without a connection! */
     return CURLE_SEND_ERROR;
 
-  Curl_dyn_reset(&pp->sendbuf);
-  result = Curl_dyn_vaddf(&pp->sendbuf, fmt, args);
+  curlx_dyn_reset(&pp->sendbuf);
+  result = curlx_dyn_vaddf(&pp->sendbuf, fmt, args);
   if(result)
     return result;
 
   /* append CRLF */
-  result = Curl_dyn_addn(&pp->sendbuf, "\r\n", 2);
+  result = curlx_dyn_addn(&pp->sendbuf, "\r\n", 2);
   if(result)
     return result;
 
   pp->pending_resp = TRUE;
-  write_len = Curl_dyn_len(&pp->sendbuf);
-  s = Curl_dyn_ptr(&pp->sendbuf);
+  write_len = curlx_dyn_len(&pp->sendbuf);
+  s = curlx_dyn_ptr(&pp->sendbuf);
 
 #ifdef HAVE_GSSAPI
   conn->data_prot = PROT_CMD;
@@ -231,7 +231,7 @@ CURLcode Curl_pp_vsendf(struct Curl_easy *data,
   else {
     pp->sendthis = NULL;
     pp->sendleft = pp->sendsize = 0;
-    pp->response = Curl_now();
+    pp->response = curlx_now();
   }
 
   return CURLE_OK;
@@ -305,10 +305,10 @@ CURLcode Curl_pp_readresp(struct Curl_easy *data,
     if(pp->nfinal) {
       /* a previous call left this many bytes in the beginning of the buffer as
          that was the final line; now ditch that */
-      size_t full = Curl_dyn_len(&pp->recvbuf);
+      size_t full = curlx_dyn_len(&pp->recvbuf);
 
       /* trim off the "final" leading part */
-      Curl_dyn_tail(&pp->recvbuf, full -  pp->nfinal);
+      curlx_dyn_tail(&pp->recvbuf, full -  pp->nfinal);
 
       pp->nfinal = 0; /* now gone */
     }
@@ -326,7 +326,7 @@ CURLcode Curl_pp_readresp(struct Curl_easy *data,
         return CURLE_RECV_ERROR;
       }
 
-      result = Curl_dyn_addn(&pp->recvbuf, buffer, gotbytes);
+      result = curlx_dyn_addn(&pp->recvbuf, buffer, gotbytes);
       if(result)
         return result;
 
@@ -336,8 +336,8 @@ CURLcode Curl_pp_readresp(struct Curl_easy *data,
     }
 
     do {
-      char *line = Curl_dyn_ptr(&pp->recvbuf);
-      char *nl = memchr(line, '\n', Curl_dyn_len(&pp->recvbuf));
+      char *line = curlx_dyn_ptr(&pp->recvbuf);
+      char *nl = memchr(line, '\n', curlx_dyn_len(&pp->recvbuf));
       if(nl) {
         /* a newline is CRLF in pp-talk, so the CR is ignored as
            the line is not really terminated until the LF comes */
@@ -363,8 +363,8 @@ CURLcode Curl_pp_readresp(struct Curl_easy *data,
              parsers). Store the overflow counter to inform about additional
              data in this buffer after the endofresp line. */
           pp->nfinal = length;
-          if(Curl_dyn_len(&pp->recvbuf) > length)
-            pp->overflow = Curl_dyn_len(&pp->recvbuf) - length;
+          if(curlx_dyn_len(&pp->recvbuf) > length)
+            pp->overflow = curlx_dyn_len(&pp->recvbuf) - length;
           else
             pp->overflow = 0;
           *size = pp->nread_resp; /* size of the response */
@@ -372,11 +372,11 @@ CURLcode Curl_pp_readresp(struct Curl_easy *data,
           gotbytes = 0; /* force break out of outer loop */
           break;
         }
-        if(Curl_dyn_len(&pp->recvbuf) > length)
+        if(curlx_dyn_len(&pp->recvbuf) > length)
           /* keep the remaining piece */
-          Curl_dyn_tail((&pp->recvbuf), Curl_dyn_len(&pp->recvbuf) - length);
+          curlx_dyn_tail((&pp->recvbuf), curlx_dyn_len(&pp->recvbuf) - length);
         else
-          Curl_dyn_reset(&pp->recvbuf);
+          curlx_dyn_reset(&pp->recvbuf);
       }
       else {
         /* without a newline, there is no overflow */
@@ -442,7 +442,7 @@ CURLcode Curl_pp_flushsend(struct Curl_easy *data,
   else {
     pp->sendthis = NULL;
     pp->sendleft = pp->sendsize = 0;
-    pp->response = Curl_now();
+    pp->response = curlx_now();
   }
   return CURLE_OK;
 }
@@ -450,8 +450,8 @@ CURLcode Curl_pp_flushsend(struct Curl_easy *data,
 CURLcode Curl_pp_disconnect(struct pingpong *pp)
 {
   if(pp->initialised) {
-    Curl_dyn_free(&pp->sendbuf);
-    Curl_dyn_free(&pp->recvbuf);
+    curlx_dyn_free(&pp->sendbuf);
+    curlx_dyn_free(&pp->recvbuf);
     memset(pp, 0, sizeof(*pp));
   }
   return CURLE_OK;
@@ -459,7 +459,7 @@ CURLcode Curl_pp_disconnect(struct pingpong *pp)
 
 bool Curl_pp_moredata(struct pingpong *pp)
 {
-  return !pp->sendleft && Curl_dyn_len(&pp->recvbuf) > pp->nfinal;
+  return !pp->sendleft && curlx_dyn_len(&pp->recvbuf) > pp->nfinal;
 }
 
 #endif
index 28ed7af04f3ca779fe061e4ce9f008fbe1e229c9..84570fd913f00188aea6f192413e5aac894bcb64 100644 (file)
@@ -76,7 +76,7 @@
 #include "bufref.h"
 #include "curl_sasl.h"
 #include "curl_md5.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "strdup.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -367,7 +367,7 @@ static CURLcode pop3_get_message(struct Curl_easy *data, struct bufref *out)
 
   if(!pop3c)
     return CURLE_FAILED_INIT;
-  message = Curl_dyn_ptr(&pop3c->pp.recvbuf);
+  message = curlx_dyn_ptr(&pop3c->pp.recvbuf);
   len = pop3c->pp.nfinal;
   if(len > 2) {
     /* Find the start of the message */
@@ -819,7 +819,7 @@ static CURLcode pop3_state_servergreet_resp(struct Curl_easy *data,
   if(!pop3c)
     return CURLE_FAILED_INIT;
 
-  line = Curl_dyn_ptr(&pop3c->pp.recvbuf);
+  line = curlx_dyn_ptr(&pop3c->pp.recvbuf);
   len = pop3c->pp.nfinal;
 
   if(pop3code != '+') {
@@ -874,7 +874,7 @@ static CURLcode pop3_state_capa_resp(struct Curl_easy *data, int pop3code,
   if(!pop3c)
     return CURLE_FAILED_INIT;
 
-  line = Curl_dyn_ptr(&pop3c->pp.recvbuf);
+  line = curlx_dyn_ptr(&pop3c->pp.recvbuf);
   len = pop3c->pp.nfinal;
 
   /* Do we have a untagged continuation response? */
@@ -1128,18 +1128,18 @@ static CURLcode pop3_state_command_resp(struct Curl_easy *data,
          the body */
 
       /* keep only the overflow */
-      Curl_dyn_tail(&pp->recvbuf, pp->overflow);
+      curlx_dyn_tail(&pp->recvbuf, pp->overflow);
       pp->nfinal = 0; /* done */
 
       if(!data->req.no_body) {
-        result = pop3_write(data, Curl_dyn_ptr(&pp->recvbuf),
-                            Curl_dyn_len(&pp->recvbuf), FALSE);
+        result = pop3_write(data, curlx_dyn_ptr(&pp->recvbuf),
+                            curlx_dyn_len(&pp->recvbuf), FALSE);
         if(result)
           return result;
       }
 
       /* reset the buffer */
-      Curl_dyn_reset(&pp->recvbuf);
+      curlx_dyn_reset(&pp->recvbuf);
       pp->overflow = 0;
     }
   }
index aa63fed0e598577c226b13f0e566ca588a3841c8..1d675cd5b628ee10ec43612d3cd0eff5d10db4cc 100644 (file)
@@ -28,7 +28,7 @@
 #include "sendf.h"
 #include "multiif.h"
 #include "progress.h"
-#include "timeval.h"
+#include "curlx/timeval.h"
 #include "curl_printf.h"
 
 /* check rate limits within this many recent milliseconds, at minimum. */
@@ -181,7 +181,7 @@ void Curl_pgrsTimeWas(struct Curl_easy *data, timerid timer,
   case TIMER_POSTQUEUE:
     /* Queue time is accumulative from all involved redirects */
     data->progress.t_postqueue +=
-      Curl_timediff_us(timestamp, data->progress.t_startqueue);
+      curlx_timediff_us(timestamp, data->progress.t_startqueue);
     break;
   case TIMER_STARTACCEPT:
     data->progress.t_acceptdata = timestamp;
@@ -217,13 +217,13 @@ void Curl_pgrsTimeWas(struct Curl_easy *data, timerid timer,
     delta = &data->progress.t_posttransfer;
     break;
   case TIMER_REDIRECT:
-    data->progress.t_redirect = Curl_timediff_us(timestamp,
+    data->progress.t_redirect = curlx_timediff_us(timestamp,
                                                  data->progress.start);
     data->progress.t_startqueue = timestamp;
     break;
   }
   if(delta) {
-    timediff_t us = Curl_timediff_us(timestamp, data->progress.t_startsingle);
+    timediff_t us = curlx_timediff_us(timestamp, data->progress.t_startsingle);
     if(us < 1)
       us = 1; /* make sure at least one microsecond passed */
     *delta += us;
@@ -239,7 +239,7 @@ void Curl_pgrsTimeWas(struct Curl_easy *data, timerid timer,
  */
 struct curltime Curl_pgrsTime(struct Curl_easy *data, timerid timer)
 {
-  struct curltime now = Curl_now();
+  struct curltime now = curlx_now();
 
   Curl_pgrsTimeWas(data, timer, now);
   return now;
@@ -248,7 +248,7 @@ struct curltime Curl_pgrsTime(struct Curl_easy *data, timerid timer)
 void Curl_pgrsStartNow(struct Curl_easy *data)
 {
   data->progress.speeder_c = 0; /* reset the progress meter display */
-  data->progress.start = Curl_now();
+  data->progress.start = curlx_now();
   data->progress.is_t_startransfer_set = FALSE;
   data->progress.ul.limit.start = data->progress.start;
   data->progress.dl.limit.start = data->progress.start;
@@ -308,7 +308,7 @@ timediff_t Curl_pgrsLimitWaitTime(struct pgrs_dir *d,
    * 'actual' is the time in milliseconds it took to actually download the
    * last 'size' bytes.
    */
-  actual = Curl_timediff_ceil(now, d->limit.start);
+  actual = curlx_timediff_ceil(now, d->limit.start);
   if(actual < minimum) {
     /* if it downloaded the data faster than the limit, make it wait the
        difference */
@@ -334,14 +334,14 @@ void Curl_ratelimit(struct Curl_easy *data, struct curltime now)
 {
   /* do not set a new stamp unless the time since last update is long enough */
   if(data->set.max_recv_speed) {
-    if(Curl_timediff(now, data->progress.dl.limit.start) >=
+    if(curlx_timediff(now, data->progress.dl.limit.start) >=
        MIN_RATE_LIMIT_PERIOD) {
       data->progress.dl.limit.start = now;
       data->progress.dl.limit.start_size = data->progress.dl.cur_size;
     }
   }
   if(data->set.max_send_speed) {
-    if(Curl_timediff(now, data->progress.ul.limit.start) >=
+    if(curlx_timediff(now, data->progress.ul.limit.start) >=
        MIN_RATE_LIMIT_PERIOD) {
       data->progress.ul.limit.start = now;
       data->progress.ul.limit.start_size = data->progress.ul.cur_size;
@@ -407,7 +407,7 @@ static bool progress_calc(struct Curl_easy *data, struct curltime now)
   struct Progress * const p = &data->progress;
 
   /* The time spent so far (from the start) in microseconds */
-  p->timespent = Curl_timediff_us(now, p->start);
+  p->timespent = curlx_timediff_us(now, p->start);
   p->dl.speed = trspeed(p->dl.cur_size, p->timespent);
   p->ul.speed = trspeed(p->ul.cur_size, p->timespent);
 
@@ -447,7 +447,7 @@ static bool progress_calc(struct Curl_easy *data, struct curltime now)
       checkindex = (p->speeder_c >= CURR_TIME) ? p->speeder_c%CURR_TIME : 0;
 
       /* Figure out the exact time for the time span */
-      span_ms = Curl_timediff(now, p->speeder_time[checkindex]);
+      span_ms = curlx_timediff(now, p->speeder_time[checkindex]);
       if(0 == span_ms)
         span_ms = 1; /* at least one millisecond MUST have passed */
 
@@ -636,7 +636,7 @@ static int pgrsupdate(struct Curl_easy *data, bool showprogress)
 
 int Curl_pgrsUpdate(struct Curl_easy *data)
 {
-  struct curltime now = Curl_now(); /* what time is it */
+  struct curltime now = curlx_now(); /* what time is it */
   bool showprogress = progress_calc(data, now);
   return pgrsupdate(data, showprogress);
 }
@@ -646,6 +646,6 @@ int Curl_pgrsUpdate(struct Curl_easy *data)
  */
 void Curl_pgrsUpdate_nometer(struct Curl_easy *data)
 {
-  struct curltime now = Curl_now(); /* what time is it */
+  struct curltime now = curlx_now(); /* what time is it */
   (void)progress_calc(data, now);
 }
index 326271ef1e4b314e4070d8b07f4b8c163acff198..8abd269420dc0d1a2edd04473859b2591da1fd57 100644 (file)
@@ -24,7 +24,7 @@
  *
  ***************************************************************************/
 
-#include "timeval.h"
+#include "curlx/timeval.h"
 
 
 typedef enum {
index 3e63dbfe6161c4851a6a14d512e51c244c4e2d67..a488a46e9315a1a3dd2b4eefd06418b247dae6e6 100644 (file)
--- a/lib/psl.c
+++ b/lib/psl.c
@@ -48,7 +48,7 @@ void Curl_psl_destroy(struct PslCache *pslcache)
 
 static time_t now_seconds(void)
 {
-  struct curltime now = Curl_now();
+  struct curltime now = curlx_now();
 
   return now.tv_sec;
 }
index bf81af0948ec3f0e7464c115aaac9c024cb7ff9c..c0368dd76352bfc200f4f013c1921d4a89e37805 100644 (file)
@@ -37,7 +37,7 @@
 #include "urldata.h"
 #include "vtls/vtls.h"
 #include "sendf.h"
-#include "timeval.h"
+#include "curlx/timeval.h"
 #include "rand.h"
 #include "escape.h"
 
@@ -130,7 +130,7 @@ static CURLcode weak_random(struct Curl_easy *data,
     static bool seeded = FALSE;
     unsigned int rnd;
     if(!seeded) {
-      struct curltime now = Curl_now();
+      struct curltime now = curlx_now();
       randseed += (unsigned int)now.tv_usec + (unsigned int)now.tv_sec;
       randseed = randseed * 1103515245 + 12345;
       randseed = randseed * 1103515245 + 12345;
index ac6e68d31dcbe6a4581443d3ec7cd523e2dd8aff..14419338acec732d7c8c5916111aad547123904b 100644 (file)
@@ -30,7 +30,7 @@
   !defined(CURL_DISABLE_ALTSVC)
 
 #include "curl_multibyte.h"
-#include "timeval.h"
+#include "curlx/timeval.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -45,7 +45,7 @@ int Curl_rename(const char *oldpath, const char *newpath)
      MoveFileEx() will overwrite and is usually atomic, however it fails
      when there are open handles to the file. */
   const int max_wait_ms = 1000;
-  struct curltime start = Curl_now();
+  struct curltime start = curlx_now();
   TCHAR *tchar_oldpath = curlx_convert_UTF8_to_tchar(oldpath);
   TCHAR *tchar_newpath = curlx_convert_UTF8_to_tchar(newpath);
   for(;;) {
@@ -55,7 +55,7 @@ int Curl_rename(const char *oldpath, const char *newpath)
       curlx_unicodefree(tchar_newpath);
       break;
     }
-    diff = Curl_timediff(Curl_now(), start);
+    diff = curlx_timediff(curlx_now(), start);
     if(diff < 0 || diff > max_wait_ms) {
       curlx_unicodefree(tchar_oldpath);
       curlx_unicodefree(tchar_newpath);
index 79d1544c270251190e84e35ed31342f4281dab16..43923d1438b58d13bec5495ec5afc65a04dee3c9 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "urldata.h"
 #include "cfilters.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 #include "doh.h"
 #include "multiif.h"
 #include "progress.h"
@@ -34,7 +34,7 @@
 #include "sendf.h"
 #include "transfer.h"
 #include "url.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -95,7 +95,7 @@ CURLcode Curl_req_soft_reset(struct SingleRequest *req,
 CURLcode Curl_req_start(struct SingleRequest *req,
                         struct Curl_easy *data)
 {
-  req->start = Curl_now();
+  req->start = curlx_now();
   return Curl_req_soft_reset(req, data);
 }
 
@@ -198,7 +198,7 @@ static CURLcode xfer_send(struct Curl_easy *data,
       const char *p = getenv("CURL_SMALLREQSEND");
       if(p) {
         curl_off_t body_small;
-        if(!Curl_str_number(&p, &body_small, body_len))
+        if(!curlx_str_number(&p, &body_small, body_len))
           blen = hds_len + (size_t)body_small;
       }
     }
@@ -387,8 +387,8 @@ CURLcode Curl_req_send(struct Curl_easy *data, struct dynbuf *req,
     return CURLE_FAILED_INIT;
 
   data->req.httpversion_sent = httpversion;
-  buf = Curl_dyn_ptr(req);
-  blen = Curl_dyn_len(req);
+  buf = curlx_dyn_ptr(req);
+  blen = curlx_dyn_len(req);
   if(!Curl_creader_total_length(data)) {
     /* Request without body. Try to send directly from the buf given. */
     data->req.eos_read = TRUE;
index 9437539c8df657190d1861e900aa9529ac9d678b..f13bd493ad05022c1b688c12cb18486b1f4a4456 100644 (file)
@@ -40,7 +40,7 @@
 #include "connect.h"
 #include "cfilters.h"
 #include "strdup.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
 #include "curl_memory.h"
@@ -168,7 +168,7 @@ static void rtsp_conn_dtor(void *key, size_t klen, void *entry)
   struct rtsp_conn *rtspc = entry;
   (void)key;
   (void)klen;
-  Curl_dyn_free(&rtspc->buf);
+  curlx_dyn_free(&rtspc->buf);
   free(rtspc);
 }
 
@@ -181,7 +181,7 @@ static CURLcode rtsp_setup_connection(struct Curl_easy *data,
   rtspc = calloc(1, sizeof(*rtspc));
   if(!rtspc)
     return CURLE_OUT_OF_MEMORY;
-  Curl_dyn_init(&rtspc->buf, MAX_RTP_BUFFERSIZE);
+  curlx_dyn_init(&rtspc->buf, MAX_RTP_BUFFERSIZE);
   if(Curl_conn_meta_set(conn, CURL_META_RTSP_CONN, rtspc, rtsp_conn_dtor))
     return CURLE_OUT_OF_MEMORY;
 
@@ -302,7 +302,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
     return CURLE_FAILED_INIT;
 
   /* Initialize a dynamic send buffer */
-  Curl_dyn_init(&req_buffer, DYN_RTSP_REQ_HEADER);
+  curlx_dyn_init(&req_buffer, DYN_RTSP_REQ_HEADER);
 
   rtsp->CSeq_sent = data->state.rtsp_next_client_CSeq;
   rtsp->CSeq_recv = 0;
@@ -501,10 +501,10 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
   }
 
   result =
-    Curl_dyn_addf(&req_buffer,
-                  "%s %s RTSP/1.0\r\n" /* Request Stream-URI RTSP/1.0 */
-                  "CSeq: %ld\r\n", /* CSeq */
-                  p_request, p_stream_uri, rtsp->CSeq_sent);
+    curlx_dyn_addf(&req_buffer,
+                   "%s %s RTSP/1.0\r\n" /* Request Stream-URI RTSP/1.0 */
+                   "CSeq: %ld\r\n", /* CSeq */
+                   p_request, p_stream_uri, rtsp->CSeq_sent);
   if(result)
     goto out;
 
@@ -513,7 +513,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
    * to make comparison easier
    */
   if(p_session_id) {
-    result = Curl_dyn_addf(&req_buffer, "Session: %s\r\n", p_session_id);
+    result = curlx_dyn_addf(&req_buffer, "Session: %s\r\n", p_session_id);
     if(result)
       goto out;
   }
@@ -521,24 +521,24 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
   /*
    * Shared HTTP-like options
    */
-  result = Curl_dyn_addf(&req_buffer,
-                         "%s" /* transport */
-                         "%s" /* accept */
-                         "%s" /* accept-encoding */
-                         "%s" /* range */
-                         "%s" /* referrer */
-                         "%s" /* user-agent */
-                         "%s" /* proxyuserpwd */
-                         "%s" /* userpwd */
-                         ,
-                         p_transport ? p_transport : "",
-                         p_accept ? p_accept : "",
-                         p_accept_encoding ? p_accept_encoding : "",
-                         p_range ? p_range : "",
-                         p_referrer ? p_referrer : "",
-                         p_uagent ? p_uagent : "",
-                         p_proxyuserpwd ? p_proxyuserpwd : "",
-                         p_userpwd ? p_userpwd : "");
+  result = curlx_dyn_addf(&req_buffer,
+                          "%s" /* transport */
+                          "%s" /* accept */
+                          "%s" /* accept-encoding */
+                          "%s" /* range */
+                          "%s" /* referrer */
+                          "%s" /* user-agent */
+                          "%s" /* proxyuserpwd */
+                          "%s" /* userpwd */
+                          ,
+                          p_transport ? p_transport : "",
+                          p_accept ? p_accept : "",
+                          p_accept_encoding ? p_accept_encoding : "",
+                          p_range ? p_range : "",
+                          p_referrer ? p_referrer : "",
+                          p_uagent ? p_uagent : "",
+                          p_proxyuserpwd ? p_proxyuserpwd : "",
+                          p_userpwd ? p_userpwd : "");
 
   /*
    * Free userpwd now --- cannot reuse this for Negotiate and possibly NTLM
@@ -594,8 +594,8 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
        * actually set a custom Content-Length in the headers */
       if(!Curl_checkheaders(data, STRCONST("Content-Length"))) {
         result =
-          Curl_dyn_addf(&req_buffer, "Content-Length: %" FMT_OFF_T"\r\n",
-                        req_clen);
+          curlx_dyn_addf(&req_buffer, "Content-Length: %" FMT_OFF_T"\r\n",
+                         req_clen);
         if(result)
           goto out;
       }
@@ -603,9 +603,9 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
       if(rtspreq == RTSPREQ_SET_PARAMETER ||
          rtspreq == RTSPREQ_GET_PARAMETER) {
         if(!Curl_checkheaders(data, STRCONST("Content-Type"))) {
-          result = Curl_dyn_addn(&req_buffer,
-                                 STRCONST("Content-Type: "
-                                          "text/parameters\r\n"));
+          result = curlx_dyn_addn(&req_buffer,
+                                  STRCONST("Content-Type: "
+                                           "text/parameters\r\n"));
           if(result)
             goto out;
         }
@@ -613,9 +613,9 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
 
       if(rtspreq == RTSPREQ_ANNOUNCE) {
         if(!Curl_checkheaders(data, STRCONST("Content-Type"))) {
-          result = Curl_dyn_addn(&req_buffer,
-                                 STRCONST("Content-Type: "
-                                          "application/sdp\r\n"));
+          result = curlx_dyn_addn(&req_buffer,
+                                  STRCONST("Content-Type: "
+                                           "application/sdp\r\n"));
           if(result)
             goto out;
         }
@@ -634,7 +634,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
   }
 
   /* Finish the request buffer */
-  result = Curl_dyn_addn(&req_buffer, STRCONST("\r\n"));
+  result = curlx_dyn_addn(&req_buffer, STRCONST("\r\n"));
   if(result)
     goto out;
 
@@ -658,7 +658,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
       result = CURLE_ABORTED_BY_CALLBACK;
   }
 out:
-  Curl_dyn_free(&req_buffer);
+  curlx_dyn_free(&req_buffer);
   return result;
 }
 
@@ -703,7 +703,7 @@ static CURLcode rtsp_filter_rtp(struct Curl_easy *data,
     switch(rtspc->state) {
 
     case RTP_PARSE_SKIP: {
-      DEBUGASSERT(Curl_dyn_len(&rtspc->buf) == 0);
+      DEBUGASSERT(curlx_dyn_len(&rtspc->buf) == 0);
       while(blen && buf[0] != '$') {
         if(!in_body && buf[0] == 'R' &&
            data->set.rtspreq != RTSPREQ_RECEIVE) {
@@ -733,7 +733,7 @@ static CURLcode rtsp_filter_rtp(struct Curl_easy *data,
           if(result)
             goto out;
         }
-        if(Curl_dyn_addn(&rtspc->buf, buf, 1)) {
+        if(curlx_dyn_addn(&rtspc->buf, buf, 1)) {
           result = CURLE_OUT_OF_MEMORY;
           goto out;
         }
@@ -748,7 +748,7 @@ static CURLcode rtsp_filter_rtp(struct Curl_easy *data,
     case RTP_PARSE_CHANNEL: {
       int idx = ((unsigned char)buf[0]) / 8;
       int off = ((unsigned char)buf[0]) % 8;
-      DEBUGASSERT(Curl_dyn_len(&rtspc->buf) == 1);
+      DEBUGASSERT(curlx_dyn_len(&rtspc->buf) == 1);
       if(!(data->state.rtp_channel_mask[idx] & (1 << off))) {
         /* invalid channel number, junk or BODY data */
         rtspc->state = RTP_PARSE_SKIP;
@@ -760,7 +760,7 @@ static CURLcode rtsp_filter_rtp(struct Curl_easy *data,
            * it from an earlier call. We cannot un-consume it and have
            * to write it directly as BODY data */
           result = rtp_write_body_junk(data, rtspc,
-                                       Curl_dyn_ptr(&rtspc->buf), 1);
+                                       curlx_dyn_ptr(&rtspc->buf), 1);
           if(result)
             goto out;
         }
@@ -768,12 +768,12 @@ static CURLcode rtsp_filter_rtp(struct Curl_easy *data,
           /* count the '$' as skip and continue */
           skip_len = 1;
         }
-        Curl_dyn_free(&rtspc->buf);
+        curlx_dyn_free(&rtspc->buf);
         break;
       }
       /* a valid channel, so we expect this to be a real RTP message */
       rtspc->rtp_channel = (unsigned char)buf[0];
-      if(Curl_dyn_addn(&rtspc->buf, buf, 1)) {
+      if(curlx_dyn_addn(&rtspc->buf, buf, 1)) {
         result = CURLE_OUT_OF_MEMORY;
         goto out;
       }
@@ -785,10 +785,10 @@ static CURLcode rtsp_filter_rtp(struct Curl_easy *data,
     }
 
     case RTP_PARSE_LEN: {
-      size_t rtp_len = Curl_dyn_len(&rtspc->buf);
+      size_t rtp_len = curlx_dyn_len(&rtspc->buf);
       const char *rtp_buf;
       DEBUGASSERT(rtp_len >= 2 && rtp_len < 4);
-      if(Curl_dyn_addn(&rtspc->buf, buf, 1)) {
+      if(curlx_dyn_addn(&rtspc->buf, buf, 1)) {
         result = CURLE_OUT_OF_MEMORY;
         goto out;
       }
@@ -797,19 +797,19 @@ static CURLcode rtsp_filter_rtp(struct Curl_easy *data,
       --blen;
       if(rtp_len == 2)
         break;
-      rtp_buf = Curl_dyn_ptr(&rtspc->buf);
+      rtp_buf = curlx_dyn_ptr(&rtspc->buf);
       rtspc->rtp_len = RTP_PKT_LENGTH(rtp_buf) + 4;
       rtspc->state = RTP_PARSE_DATA;
       break;
     }
 
     case RTP_PARSE_DATA: {
-      size_t rtp_len = Curl_dyn_len(&rtspc->buf);
+      size_t rtp_len = curlx_dyn_len(&rtspc->buf);
       size_t needed;
       DEBUGASSERT(rtp_len < rtspc->rtp_len);
       needed = rtspc->rtp_len - rtp_len;
       if(needed <= blen) {
-        if(Curl_dyn_addn(&rtspc->buf, buf, needed)) {
+        if(curlx_dyn_addn(&rtspc->buf, buf, needed)) {
           result = CURLE_OUT_OF_MEMORY;
           goto out;
         }
@@ -819,15 +819,15 @@ static CURLcode rtsp_filter_rtp(struct Curl_easy *data,
         /* complete RTP message in buffer */
         DEBUGF(infof(data, "RTP write channel %d rtp_len %zu",
                      rtspc->rtp_channel, rtspc->rtp_len));
-        result = rtp_client_write(data, Curl_dyn_ptr(&rtspc->buf),
+        result = rtp_client_write(data, curlx_dyn_ptr(&rtspc->buf),
                                   rtspc->rtp_len);
-        Curl_dyn_free(&rtspc->buf);
+        curlx_dyn_free(&rtspc->buf);
         rtspc->state = RTP_PARSE_SKIP;
         if(result)
           goto out;
       }
       else {
-        if(Curl_dyn_addn(&rtspc->buf, buf, blen)) {
+        if(curlx_dyn_addn(&rtspc->buf, buf, blen)) {
           result = CURLE_OUT_OF_MEMORY;
           goto out;
         }
@@ -987,8 +987,8 @@ CURLcode Curl_rtsp_parseheader(struct Curl_easy *data, const char *header)
     const char *p = &header[5];
     if(!rtsp)
       return CURLE_FAILED_INIT;
-    Curl_str_passblanks(&p);
-    if(Curl_str_number(&p, &CSeq, LONG_MAX)) {
+    curlx_str_passblanks(&p);
+    if(curlx_str_number(&p, &CSeq, LONG_MAX)) {
       failf(data, "Unable to read the CSeq header: [%s]", header);
       return CURLE_RTSP_CSEQ_ERROR;
     }
@@ -1001,7 +1001,7 @@ CURLcode Curl_rtsp_parseheader(struct Curl_easy *data, const char *header)
 
     /* Find the first non-space letter */
     start = header + 8;
-    Curl_str_passblanks(&start);
+    curlx_str_passblanks(&start);
 
     if(!*start) {
       failf(data, "Got a blank Session ID");
@@ -1059,16 +1059,16 @@ CURLcode rtsp_parse_transport(struct Curl_easy *data, const char *transport)
   const char *start, *end;
   start = transport;
   while(start && *start) {
-    Curl_str_passblanks(&start);
+    curlx_str_passblanks(&start);
     end = strchr(start, ';');
     if(checkprefix("interleaved=", start)) {
       curl_off_t chan1, chan2, chan;
       const char *p = start + 12;
-      if(!Curl_str_number(&p, &chan1, 255)) {
+      if(!curlx_str_number(&p, &chan1, 255)) {
         unsigned char *rtp_channel_mask = data->state.rtp_channel_mask;
         chan2 = chan1;
-        if(!Curl_str_single(&p, '-')) {
-          if(Curl_str_number(&p, &chan2, 255)) {
+        if(!curlx_str_single(&p, '-')) {
+          if(curlx_str_number(&p, &chan2, 255)) {
             infof(data, "Unable to read the interleaved parameter from "
                   "Transport header: [%s]", transport);
             chan2 = chan1;
index 23280c6d989e783b2df98dfd083a261374b0f14b..ee239b7321761d1fb985fae838eaa9fa3d6c4009 100644 (file)
@@ -45,8 +45,8 @@
 #include "urldata.h"
 #include "connect.h"
 #include "select.h"
-#include "timediff.h"
-#include "warnless.h"
+#include "curlx/timediff.h"
+#include "curlx/warnless.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
 #include "curl_memory.h"
@@ -197,7 +197,7 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
     return Curl_wait_ms(timeout_ms);
   }
 
-  /* Avoid initial timestamp, avoid Curl_now() call, when elapsed
+  /* Avoid initial timestamp, avoid curlx_now() call, when elapsed
      time in this function does not need to be measured. This happens
      when function is called with a zero timeout or a negative timeout
      value indicating a blocking call should be performed. */
@@ -292,7 +292,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
     return Curl_wait_ms(timeout_ms);
   }
 
-  /* Avoid initial timestamp, avoid Curl_now() call, when elapsed
+  /* Avoid initial timestamp, avoid curlx_now() call, when elapsed
      time in this function does not need to be measured. This happens
      when function is called with a zero timeout or a negative timeout
      value indicating a blocking call should be performed. */
index 59da44b2706f6b46c54f76fa6678a692bb56c452..feb4598b063425f952a1a0fdefc67a8b25ac5919 100644 (file)
@@ -52,7 +52,7 @@
 #include "strdup.h"
 #include "http2.h"
 #include "progress.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "ws.h"
 
 /* The last 3 #include files should be in this order */
index 394dee1a4f1775bb4ff7d7ac0bf9f54112680d65..aa8043dc9609c574034414fe3000315baa92f2fc 100644 (file)
@@ -43,7 +43,7 @@
 #include "strcase.h"
 #include "share.h"
 #include "vtls/vtls.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "sendf.h"
 #include "http2.h"
 #include "setopt.h"
index 44be8f9eee62a9939b8872717d0827796cd24aec..d73e0ef093796e80a08252aac3e87650e859c3ac 100644 (file)
@@ -28,7 +28,7 @@
 #if !defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) \
   || defined(USE_LIBSSH2) || defined(USE_SSL)
 
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "curl_sha256.h"
 #include "curl_hmac.h"
 
index 81f58c857cb305b1d43a716d79a6cf2c6d36cbe7..4ed30ce97ee0dbcbda188a01321945bf06d866ee 100644 (file)
@@ -78,9 +78,9 @@
 #include "curl_gethostname.h"
 #include "bufref.h"
 #include "curl_sasl.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "idn.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -220,7 +220,7 @@ static bool smtp_endofresp(struct Curl_easy *data, struct connectdata *conn,
     result = TRUE;
     memcpy(tmpline, line, (len == 5 ? 5 : 3));
     tmpline[len == 5 ? 5 : 3 ] = 0;
-    if(Curl_str_number(&p, &code, len == 5 ? 99999 : 999))
+    if(curlx_str_number(&p, &code, len == 5 ? 99999 : 999))
       return FALSE;
     *resp = (int) code;
 
@@ -246,7 +246,7 @@ static bool smtp_endofresp(struct Curl_easy *data, struct connectdata *conn,
  */
 static CURLcode smtp_get_message(struct Curl_easy *data, struct bufref *out)
 {
-  char *message = Curl_dyn_ptr(&data->conn->proto.smtpc.pp.recvbuf);
+  char *message = curlx_dyn_ptr(&data->conn->proto.smtpc.pp.recvbuf);
   size_t len = data->conn->proto.smtpc.pp.nfinal;
 
   if(len > 4) {
@@ -884,7 +884,7 @@ static CURLcode smtp_state_ehlo_resp(struct Curl_easy *data,
 {
   CURLcode result = CURLE_OK;
   struct smtp_conn *smtpc = &conn->proto.smtpc;
-  const char *line = Curl_dyn_ptr(&smtpc->pp.recvbuf);
+  const char *line = curlx_dyn_ptr(&smtpc->pp.recvbuf);
   size_t len = smtpc->pp.nfinal;
 
   (void)instate; /* no use for this yet */
@@ -1034,7 +1034,7 @@ static CURLcode smtp_state_command_resp(struct Curl_easy *data, int smtpcode,
 {
   CURLcode result = CURLE_OK;
   struct SMTP *smtp = data->req.p.smtp;
-  char *line = Curl_dyn_ptr(&data->conn->proto.smtpc.pp.recvbuf);
+  char *line = curlx_dyn_ptr(&data->conn->proto.smtpc.pp.recvbuf);
   size_t len = data->conn->proto.smtpc.pp.nfinal;
 
   (void)instate; /* no use for this yet */
index cfca37bf131f89979e6f54146a3471fd67e23182..ffe5143e9c14beb8634449466146fed1a50f995f 100644 (file)
@@ -129,7 +129,7 @@ int Curl_socketpair(int domain, int type, int protocol,
 #endif /* !_WIN32 */
 
 #include "nonblock.h" /* for curlx_nonblock */
-#include "timeval.h"  /* needed before select.h */
+#include "curlx/timeval.h"  /* needed before select.h */
 #include "select.h"   /* for Curl_poll */
 
 /* The last 3 #include files should be in this order */
@@ -203,7 +203,7 @@ int Curl_socketpair(int domain, int type, int protocol,
   if(socks[1] == CURL_SOCKET_BAD)
     goto error;
   else {
-    struct curltime start = Curl_now();
+    struct curltime start = curlx_now();
     char rnd[9];
     char check[sizeof(rnd)];
     char *p = &check[0];
@@ -227,7 +227,7 @@ int Curl_socketpair(int domain, int type, int protocol,
       if(nread == -1) {
         int sockerr = SOCKERRNO;
         /* Do not block forever */
-        if(Curl_timediff(Curl_now(), start) > (60 * 1000))
+        if(curlx_timediff(curlx_now(), start) > (60 * 1000))
           goto error;
         if(
 #ifdef USE_WINSOCK
index b6bbfacc8f5c93215ee3e78547d40f3cf5ba0038..1d0f4d97c0952950ac3e16beae456927e3e04708 100644 (file)
@@ -38,7 +38,7 @@
 #include "select.h"
 #include "cfilters.h"
 #include "connect.h"
-#include "timeval.h"
+#include "curlx/timeval.h"
 #include "socks.h"
 #include "multiif.h" /* for getsock macros */
 #include "inet_pton.h"
index 776dbdae80a715dbb472a16aab23d8cddaaedf10..697e301b7729195ab2bca3664bd1a2a1ec694564 100644 (file)
@@ -32,9 +32,9 @@
 #include "sendf.h"
 #include "cfilters.h"
 #include "connect.h"
-#include "timeval.h"
+#include "curlx/timeval.h"
 #include "socks.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "strdup.h"
 
 /* The last 3 #include files should be in this order */
@@ -65,7 +65,7 @@ static int check_gss_err(struct Curl_easy *data,
     gss_buffer_desc status_string = GSS_C_EMPTY_BUFFER;
     struct dynbuf dbuf;
 
-    Curl_dyn_init(&dbuf, MAX_GSS_LEN);
+    curlx_dyn_init(&dbuf, MAX_GSS_LEN);
     msg_ctx = 0;
     while(!msg_ctx) {
       /* convert major status code (GSS-API error) to text */
@@ -74,7 +74,7 @@ static int check_gss_err(struct Curl_easy *data,
                                     GSS_C_NULL_OID,
                                     &msg_ctx, &status_string);
       if(maj_stat == GSS_S_COMPLETE) {
-        if(Curl_dyn_addn(&dbuf, status_string.value,
+        if(curlx_dyn_addn(&dbuf, status_string.value,
                          status_string.length))
           return 1; /* error */
         gss_release_buffer(&min_stat, &status_string);
@@ -82,7 +82,7 @@ static int check_gss_err(struct Curl_easy *data,
       }
       gss_release_buffer(&min_stat, &status_string);
     }
-    if(Curl_dyn_addn(&dbuf, ".\n", 2))
+    if(curlx_dyn_addn(&dbuf, ".\n", 2))
       return 1; /* error */
     msg_ctx = 0;
     while(!msg_ctx) {
@@ -92,7 +92,7 @@ static int check_gss_err(struct Curl_easy *data,
                                     GSS_C_NULL_OID,
                                     &msg_ctx, &status_string);
       if(maj_stat == GSS_S_COMPLETE) {
-        if(Curl_dyn_addn(&dbuf, status_string.value,
+        if(curlx_dyn_addn(&dbuf, status_string.value,
                          status_string.length))
           return 1; /* error */
         gss_release_buffer(&min_stat, &status_string);
@@ -100,8 +100,9 @@ static int check_gss_err(struct Curl_easy *data,
       }
       gss_release_buffer(&min_stat, &status_string);
     }
-    failf(data, "GSS-API error: %s failed: %s", function, Curl_dyn_ptr(&dbuf));
-    Curl_dyn_free(&dbuf);
+    failf(data, "GSS-API error: %s failed: %s", function,
+          curlx_dyn_ptr(&dbuf));
+    curlx_dyn_free(&dbuf);
     return 1;
   }
 
index b646139f6bcd10d01effe47ce5fbffba0622206d..f8f8520352016006c8b19bc4223576aa8d75dbbf 100644 (file)
 #include "cfilters.h"
 #include "connect.h"
 #include "strerror.h"
-#include "timeval.h"
+#include "curlx/timeval.h"
 #include "socks.h"
 #include "curl_sspi.h"
 #include "curl_multibyte.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "strdup.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
index 580efbde7501ea172c91d99169f15e996594eebc..16d7d72562c21ea0b92f0a9c90713d071d42aa03 100644 (file)
@@ -52,7 +52,7 @@ CURLcode Curl_speedcheck(struct Curl_easy *data,
         data->state.keeps_speed = now;
       else {
         /* how long has it been under the limit */
-        timediff_t howlong = Curl_timediff(now, data->state.keeps_speed);
+        timediff_t howlong = curlx_timediff(now, data->state.keeps_speed);
 
         if(howlong >= data->set.low_speed_time * 1000) {
           /* too long */
index 8b116f15289d5ad61c86bbdc70426e54cda82ec9..f54365cadfacba71424a7b72971fde42dbec3589 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "curl_setup.h"
 
-#include "timeval.h"
+#include "curlx/timeval.h"
 struct Curl_easy;
 void Curl_speedinit(struct Curl_easy *data);
 CURLcode Curl_speedcheck(struct Curl_easy *data,
index 3f2bae0238743acfd0333f55293c578f7bde1993..7a0e419ce68a2d247f8809a0a6216b0f79d2100a 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "curl_setup.h"
 
-#include "timeval.h"
+#include "curlx/timeval.h"
 #include "splay.h"
 
 /*
@@ -34,7 +34,7 @@
  *  zero          : when i is equal   to   j
  *  positive when : when i is larger  than j
  */
-#define compare(i,j) Curl_timediff_us(i,j)
+#define compare(i,j) curlx_timediff_us(i,j)
 
 /*
  * Splay using the key i (which may or may not be in the tree.) The starting
index b8c9360e5734367514989e4397284a5282183eeb..ccc3781ec16780d8c38e3df98e8611720ef04661 100644 (file)
@@ -24,7 +24,7 @@
  *
  ***************************************************************************/
 #include "curl_setup.h"
-#include "timeval.h"
+#include "curlx/timeval.h"
 
 /* only use function calls to access this struct */
 struct Curl_tree {
index 564b197e5db85dca9bf8f7f2d93dfdec402ed87e..922bb9c5c983761f30156b8b3f4fef013db29034 100644 (file)
@@ -866,7 +866,7 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
 #ifndef UNDER_CE
   /* 'sys_nerr' is the maximum errno number, it is not widely portable */
   if(err >= 0 && err < sys_nerr)
-    msnprintf(buf, buflen, "%s", sys_errlist[err]);
+    curl_msnprintf(buf, buflen, "%s", sys_errlist[err]);
   else
 #endif
   {
@@ -875,7 +875,7 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
        !get_winsock_error(err, buf, buflen) &&
 #endif
        !get_winapi_error(err, buf, buflen))
-      msnprintf(buf, buflen, "Unknown error %d (%#x)", err, err);
+      curl_msnprintf(buf, buflen, "Unknown error %d (%#x)", err, err);
   }
 #else /* not Windows coming up */
 
@@ -887,7 +887,7 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
   */
   if(0 != strerror_r(err, buf, buflen)) {
     if('\0' == buf[0])
-      msnprintf(buf, buflen, "Unknown error %d", err);
+      curl_msnprintf(buf, buflen, "Unknown error %d", err);
   }
 #elif defined(HAVE_STRERROR_R) && defined(HAVE_GLIBC_STRERROR_R)
  /*
@@ -899,18 +899,18 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
     char buffer[256];
     char *msg = strerror_r(err, buffer, sizeof(buffer));
     if(msg)
-      msnprintf(buf, buflen, "%s", msg);
+      curl_msnprintf(buf, buflen, "%s", msg);
     else
-      msnprintf(buf, buflen, "Unknown error %d", err);
+      curl_msnprintf(buf, buflen, "Unknown error %d", err);
   }
 #else
   {
     /* !checksrc! disable BANNEDFUNC 1 */
     const char *msg = strerror(err);
     if(msg)
-      msnprintf(buf, buflen, "%s", msg);
+      curl_msnprintf(buf, buflen, "%s", msg);
     else
-      msnprintf(buf, buflen, "Unknown error %d", err);
+      curl_msnprintf(buf, buflen, "Unknown error %d", err);
   }
 #endif
 
@@ -954,7 +954,7 @@ const char *curlx_winapi_strerror(DWORD err, char *buf, size_t buflen)
 
 #ifndef CURL_DISABLE_VERBOSE_STRINGS
   if(!get_winapi_error((int)err, buf, buflen)) {
-    msnprintf(buf, buflen, "Unknown error %lu (0x%08lX)", err, err);
+    curl_msnprintf(buf, buflen, "Unknown error %lu (0x%08lX)", err, err);
   }
 #else
   {
@@ -1090,18 +1090,18 @@ const char *Curl_sspi_strerror(int err, char *buf, size_t buflen)
   }
 
   if(err == SEC_E_ILLEGAL_MESSAGE) {
-    msnprintf(buf, buflen,
-              "SEC_E_ILLEGAL_MESSAGE (0x%08X) - This error usually occurs "
-              "when a fatal SSL/TLS alert is received (e.g. handshake failed)."
-              " More detail may be available in the Windows System event log.",
-              err);
+    curl_msnprintf(buf, buflen,
+                   "SEC_E_ILLEGAL_MESSAGE (0x%08X) - This error usually "
+                   "occurs when a fatal SSL/TLS alert is received (e.g. "
+                   "handshake failed). More detail may be available in "
+                   "the Windows System event log.", err);
   }
   else {
     char msgbuf[256];
     if(get_winapi_error(err, msgbuf, sizeof(msgbuf)))
-      msnprintf(buf, buflen, "%s (0x%08X) - %s", txt, err, msgbuf);
+      curl_msnprintf(buf, buflen, "%s (0x%08X) - %s", txt, err, msgbuf);
     else
-      msnprintf(buf, buflen, "%s (0x%08X)", txt, err);
+      curl_msnprintf(buf, buflen, "%s (0x%08X)", txt, err);
   }
 
 #else
index 7a9551d3f61835973d3e3647b3ddd4c9d96dcbeb..254e15d4daad65a5861d5214cd810cb622bafa02 100644 (file)
 #include "system_win32.h"
 #include "version_win32.h"
 #include "curl_sspi.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 
 /* The last #include files should be: */
 #include "curl_memory.h"
 #include "memdebug.h"
 
-LARGE_INTEGER Curl_freq;
-bool Curl_isVistaOrGreater;
-
 /* Handle of iphlpapp.dll */
 static HMODULE s_hIpHlpApiDll = NULL;
 
index f35298ab7ce474096f84eacaed160f6ccc536426..bc88a5a567f7d99a0aa0c3800df32e2f69d86290 100644 (file)
@@ -57,8 +57,8 @@
 #include "arpa_telnet.h"
 #include "select.h"
 #include "strcase.h"
-#include "warnless.h"
-#include "strparse.h"
+#include "curlx/warnless.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -208,7 +208,7 @@ CURLcode init_telnet(struct Curl_easy *data)
   if(!tn)
     return CURLE_OUT_OF_MEMORY;
 
-  Curl_dyn_init(&tn->out, 0xffff);
+  curlx_dyn_init(&tn->out, 0xffff);
   data->req.p.telnet = tn; /* make us known */
 
   tn->telrcv_state = CURL_TS_DATA;
@@ -866,9 +866,9 @@ static CURLcode check_telnet_options(struct Curl_easy *data)
           const char *p = arg;
           curl_off_t x = 0;
           curl_off_t y = 0;
-          if(Curl_str_number(&p, &x, 0xffff) ||
-             Curl_str_single(&p, 'x') ||
-             Curl_str_number(&p, &y, 0xffff)) {
+          if(curlx_str_number(&p, &x, 0xffff) ||
+             curlx_str_single(&p, 'x') ||
+             curlx_str_number(&p, &y, 0xffff)) {
             failf(data, "Syntax error in telnet option: %s", head->data);
             result = CURLE_SETOPT_OPTION_SYNTAX;
           }
@@ -1236,17 +1236,17 @@ static CURLcode send_telnet_data(struct Curl_easy *data,
 
   if(memchr(buffer, CURL_IAC, nread)) {
     /* only use the escape buffer when necessary */
-    Curl_dyn_reset(&tn->out);
+    curlx_dyn_reset(&tn->out);
 
     for(i = 0; i < (size_t)nread && !result; i++) {
-      result = Curl_dyn_addn(&tn->out, &buffer[i], 1);
+      result = curlx_dyn_addn(&tn->out, &buffer[i], 1);
       if(!result && ((unsigned char)buffer[i] == CURL_IAC))
         /* IAC is FF in hex */
-        result = Curl_dyn_addn(&tn->out, "\xff", 1);
+        result = curlx_dyn_addn(&tn->out, "\xff", 1);
     }
 
-    outlen = Curl_dyn_len(&tn->out);
-    outbuf = Curl_dyn_uptr(&tn->out);
+    outlen = curlx_dyn_len(&tn->out);
+    outbuf = curlx_dyn_uptr(&tn->out);
   }
   else {
     outlen = (size_t)nread;
@@ -1286,7 +1286,7 @@ static CURLcode telnet_done(struct Curl_easy *data,
 
   curl_slist_free_all(tn->telnet_vars);
   tn->telnet_vars = NULL;
-  Curl_dyn_free(&tn->out);
+  curlx_dyn_free(&tn->out);
   return CURLE_OK;
 }
 
@@ -1497,8 +1497,8 @@ static CURLcode telnet_do(struct Curl_easy *data, bool *done)
     }
 
     if(data->set.timeout) {
-      now = Curl_now();
-      if(Curl_timediff(now, conn->created) >= data->set.timeout) {
+      now = curlx_now();
+      if(curlx_timediff(now, conn->created) >= data->set.timeout) {
         failf(data, "Time-out");
         result = CURLE_OPERATION_TIMEDOUT;
         keepon = FALSE;
@@ -1618,8 +1618,8 @@ static CURLcode telnet_do(struct Curl_easy *data, bool *done)
     } /* poll switch statement */
 
     if(data->set.timeout) {
-      now = Curl_now();
-      if(Curl_timediff(now, conn->created) >= data->set.timeout) {
+      now = curlx_now();
+      if(curlx_timediff(now, conn->created) >= data->set.timeout) {
         failf(data, "Time-out");
         result = CURLE_OPERATION_TIMEDOUT;
         keepon = FALSE;
index 24ce9af98368a52bc0ead5a04a7d889953a042c2..e9f4e68eccb011203ca9db34f8ede5250829ce0d 100644 (file)
@@ -62,7 +62,7 @@
 #include "speedcheck.h"
 #include "select.h"
 #include "escape.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -332,7 +332,7 @@ static CURLcode tftp_parse_option_ack(struct tftp_conn *state,
 
     if(checkprefix(TFTP_OPTION_BLKSIZE, option)) {
       curl_off_t blksize;
-      if(Curl_str_number(&value, &blksize, TFTP_BLKSIZE_MAX)) {
+      if(curlx_str_number(&value, &blksize, TFTP_BLKSIZE_MAX)) {
         failf(data, "%s (%d)", "blksize is larger than max supported",
               TFTP_BLKSIZE_MAX);
         return CURLE_TFTP_ILLEGAL;
@@ -364,7 +364,7 @@ static CURLcode tftp_parse_option_ack(struct tftp_conn *state,
       /* tsize should be ignored on upload: Who cares about the size of the
          remote file? */
       if(!data->state.upload &&
-         !Curl_str_number(&value, &tsize, CURL_OFF_T_MAX)) {
+         !curlx_str_number(&value, &tsize, CURL_OFF_T_MAX)) {
         if(!tsize) {
           failf(data, "invalid tsize -:%s:- value in OACK packet", value);
           return CURLE_TFTP_ILLEGAL;
@@ -1277,7 +1277,7 @@ static CURLcode tftp_doing(struct Curl_easy *data, bool *dophase_done)
     if(Curl_pgrsUpdate(data))
       result = CURLE_ABORTED_BY_CALLBACK;
     else
-      result = Curl_speedcheck(data, Curl_now());
+      result = Curl_speedcheck(data, curlx_now());
   }
   return result;
 }
index 754bc2cda999735ade1f66842f6455d1049018c9..ef7d7f19af4b1a3f5acc191169ef7e30829a77da 100644 (file)
@@ -470,13 +470,13 @@ CURLcode Curl_sendrecv(struct Curl_easy *data, struct curltime *nowp)
         failf(data, "Operation timed out after %" FMT_TIMEDIFF_T
               " milliseconds with %" FMT_OFF_T " out of %"
               FMT_OFF_T " bytes received",
-              Curl_timediff(*nowp, data->progress.t_startsingle),
+              curlx_timediff(*nowp, data->progress.t_startsingle),
               k->bytecount, k->size);
       }
       else {
         failf(data, "Operation timed out after %" FMT_TIMEDIFF_T
               " milliseconds with %" FMT_OFF_T " bytes received",
-              Curl_timediff(*nowp, data->progress.t_startsingle),
+              curlx_timediff(*nowp, data->progress.t_startsingle),
               k->bytecount);
       }
       result = CURLE_OPERATION_TIMEDOUT;
index c0274e62826b355ef87a4ea1debd9d86f0494c99..02b386f0551ceafef1c7b5a5bc861f25ca861ae9 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -83,7 +83,7 @@
 #include "multiif.h"
 #include "easyif.h"
 #include "speedcheck.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 #include "getinfo.h"
 #include "pop3.h"
 #include "urlapi-int.h"
 #include "strdup.h"
 #include "setopt.h"
 #include "altsvc.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 #include "headers.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
 #include "curl_memory.h"
@@ -272,7 +272,7 @@ CURLcode Curl_close(struct Curl_easy **datap)
   data->state.referer = NULL;
 
   up_free(data);
-  Curl_dyn_free(&data->state.headerb);
+  curlx_dyn_free(&data->state.headerb);
   Curl_flush_cookies(data, TRUE);
 #ifndef CURL_DISABLE_ALTSVC
   Curl_altsvc_save(data, data->asi, data->set.str[STRING_ALTSVC]);
@@ -533,8 +533,8 @@ CURLcode Curl_open(struct Curl_easy **curl)
   data->state.current_speed = -1; /* init to negative == impossible */
 
   Curl_hash_init(&data->meta_hash, 23,
-                 Curl_hash_str, Curl_str_key_compare, easy_meta_freeentry);
-  Curl_dyn_init(&data->state.headerb, CURL_MAX_HTTP_HEADER);
+                 Curl_hash_str, curlx_str_key_compare, easy_meta_freeentry);
+  curlx_dyn_init(&data->state.headerb, CURL_MAX_HTTP_HEADER);
   Curl_req_init(&data->req);
   Curl_initinfo(data);
 #ifndef CURL_DISABLE_HTTP
@@ -545,7 +545,7 @@ CURLcode Curl_open(struct Curl_easy **curl)
   result = Curl_init_userdefined(data);
 
   if(result) {
-    Curl_dyn_free(&data->state.headerb);
+    curlx_dyn_free(&data->state.headerb);
     Curl_freeset(data);
     Curl_req_free(&data->req, data);
     Curl_hash_destroy(&data->meta_hash);
@@ -680,7 +680,7 @@ static bool conn_maxage(struct Curl_easy *data,
 {
   timediff_t idletime, lifetime;
 
-  idletime = Curl_timediff(now, conn->lastused);
+  idletime = curlx_timediff(now, conn->lastused);
   idletime /= 1000; /* integer seconds is fine */
 
   if(idletime > data->set.maxage_conn) {
@@ -689,7 +689,7 @@ static bool conn_maxage(struct Curl_easy *data,
     return TRUE;
   }
 
-  lifetime = Curl_timediff(now, conn->created);
+  lifetime = curlx_timediff(now, conn->created);
   lifetime /= 1000; /* integer seconds is fine */
 
   if(data->set.maxlifetime_conn && lifetime > data->set.maxlifetime_conn) {
@@ -717,7 +717,7 @@ bool Curl_conn_seems_dead(struct connectdata *conn,
     bool dead;
     struct curltime now;
     if(!pnow) {
-      now = Curl_now();
+      now = curlx_now();
       pnow = &now;
     }
 
@@ -775,7 +775,7 @@ CURLcode Curl_conn_upkeep(struct Curl_easy *data,
                           struct curltime *now)
 {
   CURLcode result = CURLE_OK;
-  if(Curl_timediff(*now, conn->keepalive) <= data->set.upkeep_interval_ms)
+  if(curlx_timediff(*now, conn->keepalive) <= data->set.upkeep_interval_ms)
     return result;
 
   /* briefly attach for action */
@@ -1321,7 +1321,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
   connclose(conn, "Default to force-close");
 
   /* Store creation time to help future close decision making */
-  conn->created = Curl_now();
+  conn->created = curlx_now();
 
   /* Store current time to give a baseline to keepalive connection times. */
   conn->keepalive = conn->created;
@@ -1677,7 +1677,7 @@ static void zonefrom_url(CURLU *uh, struct Curl_easy *data,
   if(!uc && zoneid) {
     const char *p = zoneid;
     curl_off_t scope;
-    if(!Curl_str_number(&p, &scope, UINT_MAX))
+    if(!curlx_str_number(&p, &scope, UINT_MAX))
       /* A plain number, use it directly as a scope id. */
       conn->scope_id = (unsigned int)scope;
 #ifdef HAVE_IF_NAMETOINDEX
@@ -1920,7 +1920,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
       port = data->set.use_port;
     else {
       const char *p = data->state.up.port;
-      if(Curl_str_number(&p, &port, 0xffff))
+      if(curlx_str_number(&p, &port, 0xffff))
         valid = FALSE;
     }
     if(valid)
@@ -2254,7 +2254,7 @@ static CURLcode parse_proxy(struct Curl_easy *data,
   if(portptr) {
     curl_off_t num;
     const char *p = portptr;
-    if(!Curl_str_number(&p, &num, 0xffff))
+    if(!curlx_str_number(&p, &num, 0xffff))
       port = (int)num;
     free(portptr);
   }
@@ -2898,7 +2898,7 @@ static CURLcode parse_connect_to_host_port(struct Curl_easy *data,
     if(*host_portno) {
       curl_off_t portparse;
       const char *p = host_portno;
-      if(Curl_str_number(&p, &portparse, 0xffff)) {
+      if(curlx_str_number(&p, &portparse, 0xffff)) {
         failf(data, "No valid port number in connect to host string (%s)",
               host_portno);
         result = CURLE_SETOPT_OPTION_SYNTAX;
@@ -2976,7 +2976,7 @@ static CURLcode parse_connect_to_string(struct Curl_easy *data,
       char *ptr_next = strchr(ptr, ':');
       if(ptr_next) {
         curl_off_t port_to_match;
-        if(!Curl_str_number(&ptr, &port_to_match, 0xffff) &&
+        if(!curlx_str_number(&ptr, &port_to_match, 0xffff) &&
            (port_to_match == (curl_off_t)conn->remote_port))
           port_match = TRUE;
         ptr = ptr_next + 1;
@@ -3232,7 +3232,7 @@ static CURLcode resolve_server(struct Curl_easy *data,
   else if(result == CURLE_OPERATION_TIMEDOUT) {
     failf(data, "Failed to resolve %s '%s' with timeout after %"
           FMT_TIMEDIFF_T " ms", peertype, ehost->dispname,
-          Curl_timediff(Curl_now(), data->progress.t_startsingle));
+          curlx_timediff(curlx_now(), data->progress.t_startsingle));
     return CURLE_OPERATION_TIMEDOUT;
   }
   else if(result) {
@@ -3383,7 +3383,7 @@ static CURLcode create_conn(struct Curl_easy *data,
 
   /* Do the unfailable inits first, before checks that may early return */
   Curl_hash_init(&conn->meta_hash, 23,
-               Curl_hash_str, Curl_str_key_compare, conn_meta_freeentry);
+               Curl_hash_str, curlx_str_key_compare, conn_meta_freeentry);
 
   /* GSSAPI related inits */
   Curl_sec_conn_init(conn);
index a30d60420becffdd3c85feea9e16baaf781be2b3..73292b1dcc7868f3cd5306d9688c41d91b789ac0 100644 (file)
@@ -34,7 +34,7 @@
 #include "inet_ntop.h"
 #include "strdup.h"
 #include "idn.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 #include "curl_memrchr.h"
 
 /* The last 3 #include files should be in this order */
@@ -151,24 +151,24 @@ static CURLUcode urlencode_str(struct dynbuf *o, const char *url,
 
     /* output the first piece as-is */
     n = (const char *)host_sep - url;
-    result = Curl_dyn_addn(o, url, n);
+    result = curlx_dyn_addn(o, url, n);
     len -= n;
   }
 
   for(iptr = host_sep; len && !result; iptr++, len--) {
     if(*iptr == ' ') {
       if(left)
-        result = Curl_dyn_addn(o, "%20", 3);
+        result = curlx_dyn_addn(o, "%20", 3);
       else
-        result = Curl_dyn_addn(o, "+", 1);
+        result = curlx_dyn_addn(o, "+", 1);
     }
     else if((*iptr < ' ') || (*iptr >= 0x7f)) {
       unsigned char out[3]={'%'};
       Curl_hexbyte(&out[1], *iptr, TRUE);
-      result = Curl_dyn_addn(o, out, 3);
+      result = curlx_dyn_addn(o, out, 3);
     }
     else {
-      result = Curl_dyn_addn(o, iptr, 1);
+      result = curlx_dyn_addn(o, iptr, 1);
       if(*iptr == '?')
         left = FALSE;
     }
@@ -288,17 +288,17 @@ static CURLUcode redirect_url(const char *base, const char *relurl,
   prelen = cutoff ? (size_t)(cutoff - base) : strlen(base);
 
   /* build new URL */
-  Curl_dyn_init(&urlbuf, CURL_MAX_INPUT_LENGTH);
+  curlx_dyn_init(&urlbuf, CURL_MAX_INPUT_LENGTH);
 
-  if(!Curl_dyn_addn(&urlbuf, base, prelen) &&
+  if(!curlx_dyn_addn(&urlbuf, base, prelen) &&
      !urlencode_str(&urlbuf, useurl, strlen(useurl), !host_changed, FALSE)) {
-    uc = parseurl_and_replace(Curl_dyn_ptr(&urlbuf), u,
+    uc = parseurl_and_replace(curlx_dyn_ptr(&urlbuf), u,
                               flags & ~CURLU_PATH_AS_IS);
   }
   else
     uc = CURLUE_OUT_OF_MEMORY;
 
-  Curl_dyn_free(&urlbuf);
+  curlx_dyn_free(&urlbuf);
   return uc;
 }
 
@@ -417,7 +417,7 @@ UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host,
                                    bool has_scheme)
 {
   const char *portptr;
-  char *hostname = Curl_dyn_ptr(host);
+  char *hostname = curlx_dyn_ptr(host);
   /*
    * Find the end of an IPv6 address on the ']' ending bracket.
    */
@@ -448,12 +448,12 @@ UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host,
        Do not do it if the URL has no scheme, to make something that looks like
        a scheme not work!
     */
-    Curl_dyn_setlen(host, keep);
+    curlx_dyn_setlen(host, keep);
     portptr++;
     if(!*portptr)
       return has_scheme ? CURLUE_OK : CURLUE_BAD_PORT_NUMBER;
 
-    if(Curl_str_number(&portptr, &port, 0xffff) || *portptr)
+    if(curlx_str_number(&portptr, &port, 0xffff) || *portptr)
       return CURLUE_BAD_PORT_NUMBER;
 
     u->portnum = (unsigned short) port;
@@ -565,7 +565,7 @@ static int ipv4_normalize(struct dynbuf *host)
 {
   bool done = FALSE;
   int n = 0;
-  const char *c = Curl_dyn_ptr(host);
+  const char *c = curlx_dyn_ptr(host);
   unsigned int parts[4] = {0, 0, 0, 0};
   CURLcode result = CURLE_OK;
 
@@ -578,13 +578,13 @@ static int ipv4_normalize(struct dynbuf *host)
     if(*c == '0') {
       if(c[1] == 'x') {
         c += 2; /* skip the prefix */
-        rc = Curl_str_hex(&c, &l, UINT_MAX);
+        rc = curlx_str_hex(&c, &l, UINT_MAX);
       }
       else
-        rc = Curl_str_octal(&c, &l, UINT_MAX);
+        rc = curlx_str_octal(&c, &l, UINT_MAX);
     }
     else
-      rc = Curl_str_number(&c, &l, UINT_MAX);
+      rc = curlx_str_number(&c, &l, UINT_MAX);
 
     if(rc)
       return HOST_NAME;
@@ -610,44 +610,44 @@ static int ipv4_normalize(struct dynbuf *host)
 
   switch(n) {
   case 0: /* a -- 32 bits */
-    Curl_dyn_reset(host);
+    curlx_dyn_reset(host);
 
-    result = Curl_dyn_addf(host, "%u.%u.%u.%u",
-                           (parts[0] >> 24),
-                           ((parts[0] >> 16) & 0xff),
-                           ((parts[0] >> 8) & 0xff),
-                           (parts[0] & 0xff));
+    result = curlx_dyn_addf(host, "%u.%u.%u.%u",
+                            (parts[0] >> 24),
+                            ((parts[0] >> 16) & 0xff),
+                            ((parts[0] >> 8) & 0xff),
+                            (parts[0] & 0xff));
     break;
   case 1: /* a.b -- 8.24 bits */
     if((parts[0] > 0xff) || (parts[1] > 0xffffff))
       return HOST_NAME;
-    Curl_dyn_reset(host);
-    result = Curl_dyn_addf(host, "%u.%u.%u.%u",
-                           (parts[0]),
-                           ((parts[1] >> 16) & 0xff),
-                           ((parts[1] >> 8) & 0xff),
-                           (parts[1] & 0xff));
+    curlx_dyn_reset(host);
+    result = curlx_dyn_addf(host, "%u.%u.%u.%u",
+                            (parts[0]),
+                            ((parts[1] >> 16) & 0xff),
+                            ((parts[1] >> 8) & 0xff),
+                            (parts[1] & 0xff));
     break;
   case 2: /* a.b.c -- 8.8.16 bits */
     if((parts[0] > 0xff) || (parts[1] > 0xff) || (parts[2] > 0xffff))
       return HOST_NAME;
-    Curl_dyn_reset(host);
-    result = Curl_dyn_addf(host, "%u.%u.%u.%u",
-                           (parts[0]),
-                           (parts[1]),
-                           ((parts[2] >> 8) & 0xff),
-                           (parts[2] & 0xff));
+    curlx_dyn_reset(host);
+    result = curlx_dyn_addf(host, "%u.%u.%u.%u",
+                            (parts[0]),
+                            (parts[1]),
+                            ((parts[2] >> 8) & 0xff),
+                            (parts[2] & 0xff));
     break;
   case 3: /* a.b.c.d -- 8.8.8.8 bits */
     if((parts[0] > 0xff) || (parts[1] > 0xff) || (parts[2] > 0xff) ||
        (parts[3] > 0xff))
       return HOST_NAME;
-    Curl_dyn_reset(host);
-    result = Curl_dyn_addf(host, "%u.%u.%u.%u",
-                           (parts[0]),
-                           (parts[1]),
-                           (parts[2]),
-                           (parts[3]));
+    curlx_dyn_reset(host);
+    result = curlx_dyn_addf(host, "%u.%u.%u.%u",
+                            (parts[0]),
+                            (parts[1]),
+                            (parts[2]),
+                            (parts[3]));
     break;
   }
   if(result)
@@ -659,7 +659,7 @@ static int ipv4_normalize(struct dynbuf *host)
 static CURLUcode urldecode_host(struct dynbuf *host)
 {
   char *per = NULL;
-  const char *hostname = Curl_dyn_ptr(host);
+  const char *hostname = curlx_dyn_ptr(host);
   per = strchr(hostname, '%');
   if(!per)
     /* nothing to decode */
@@ -672,8 +672,8 @@ static CURLUcode urldecode_host(struct dynbuf *host)
                                      REJECT_CTRL);
     if(result)
       return CURLUE_BAD_HOSTNAME;
-    Curl_dyn_reset(host);
-    result = Curl_dyn_addn(host, decoded, dlen);
+    curlx_dyn_reset(host);
+    result = curlx_dyn_addn(host, decoded, dlen);
     free(decoded);
     if(result)
       return cc2cu(result);
@@ -699,7 +699,7 @@ static CURLUcode parse_authority(struct Curl_URL *u,
   if(uc)
     goto out;
 
-  result = Curl_dyn_addn(host, auth + offset, authlen - offset);
+  result = curlx_dyn_addn(host, auth + offset, authlen - offset);
   if(result) {
     uc = cc2cu(result);
     goto out;
@@ -709,19 +709,19 @@ static CURLUcode parse_authority(struct Curl_URL *u,
   if(uc)
     goto out;
 
-  if(!Curl_dyn_len(host))
+  if(!curlx_dyn_len(host))
     return CURLUE_NO_HOST;
 
   switch(ipv4_normalize(host)) {
   case HOST_IPV4:
     break;
   case HOST_IPV6:
-    uc = ipv6_parse(u, Curl_dyn_ptr(host), Curl_dyn_len(host));
+    uc = ipv6_parse(u, curlx_dyn_ptr(host), curlx_dyn_len(host));
     break;
   case HOST_NAME:
     uc = urldecode_host(host);
     if(!uc)
-      uc = hostname_check(u, Curl_dyn_ptr(host), Curl_dyn_len(host));
+      uc = hostname_check(u, curlx_dyn_ptr(host), curlx_dyn_len(host));
     break;
   case HOST_ERROR:
     uc = CURLUE_OUT_OF_MEMORY;
@@ -742,15 +742,15 @@ CURLUcode Curl_url_set_authority(CURLU *u, const char *authority)
   struct dynbuf host;
 
   DEBUGASSERT(authority);
-  Curl_dyn_init(&host, CURL_MAX_INPUT_LENGTH);
+  curlx_dyn_init(&host, CURL_MAX_INPUT_LENGTH);
 
   result = parse_authority(u, authority, strlen(authority),
                            CURLU_DISALLOW_USER, &host, !!u->scheme);
   if(result)
-    Curl_dyn_free(&host);
+    curlx_dyn_free(&host);
   else {
     free(u->host);
-    u->host = Curl_dyn_ptr(&host);
+    u->host = curlx_dyn_ptr(&host);
   }
   return result;
 }
@@ -804,7 +804,7 @@ UNITTEST int dedotdotify(const char *input, size_t clen, char **outp)
   if(clen < 2)
     return 0;
 
-  Curl_dyn_init(&out, clen + 1);
+  curlx_dyn_init(&out, clen + 1);
 
   /*  A. If the input buffer begins with a prefix of "../" or "./", then
       remove that prefix from the input buffer; otherwise, */
@@ -844,7 +844,7 @@ UNITTEST int dedotdotify(const char *input, size_t clen, char **outp)
           the input buffer; otherwise, */
       if(is_dot(&p, &blen)) {
         if(!blen) { /* /. */
-          result = Curl_dyn_addn(&out, "/", 1);
+          result = curlx_dyn_addn(&out, "/", 1);
           break;
         }
         else if(ISSLASH(*p)) { /* /./ */
@@ -859,13 +859,13 @@ UNITTEST int dedotdotify(const char *input, size_t clen, char **outp)
             preceding "/" (if any) from the output buffer; otherwise, */
         else if(is_dot(&p, &blen) && (ISSLASH(*p) || !blen)) {
           /* remove the last segment from the output buffer */
-          size_t len = Curl_dyn_len(&out);
+          size_t len = curlx_dyn_len(&out);
           if(len) {
-            char *ptr = Curl_dyn_ptr(&out);
+            char *ptr = curlx_dyn_ptr(&out);
             char *last = memrchr(ptr, '/', len);
             if(last)
               /* trim the output at the slash */
-              Curl_dyn_setlen(&out, last - ptr);
+              curlx_dyn_setlen(&out, last - ptr);
           }
 
           if(blen) { /* /../ */
@@ -873,7 +873,7 @@ UNITTEST int dedotdotify(const char *input, size_t clen, char **outp)
             clen = blen;
             continue;
           }
-          result = Curl_dyn_addn(&out, "/", 1);
+          result = curlx_dyn_addn(&out, "/", 1);
           break;
         }
       }
@@ -884,14 +884,14 @@ UNITTEST int dedotdotify(const char *input, size_t clen, char **outp)
         any subsequent characters up to, but not including, the next "/"
         character or the end of the input buffer. */
 
-    result = Curl_dyn_addn(&out, input, 1);
+    result = curlx_dyn_addn(&out, input, 1);
     input++;
     clen--;
   }
 end:
   if(!result) {
-    if(Curl_dyn_len(&out))
-      *outp = Curl_dyn_ptr(&out);
+    if(curlx_dyn_len(&out))
+      *outp = curlx_dyn_ptr(&out);
     else {
       *outp = strdup("");
       if(!*outp)
@@ -916,7 +916,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
 
   DEBUGASSERT(url);
 
-  Curl_dyn_init(&host, CURL_MAX_INPUT_LENGTH);
+  curlx_dyn_init(&host, CURL_MAX_INPUT_LENGTH);
 
   result = Curl_junkscan(url, &urllen, !!(flags & CURLU_ALLOW_SPACE));
   if(result)
@@ -996,7 +996,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
 
           len = path - ptr;
           if(len) {
-            CURLcode code = Curl_dyn_addn(&host, ptr, len);
+            CURLcode code = curlx_dyn_addn(&host, ptr, len);
             if(code) {
               result = cc2cu(code);
               goto fail;
@@ -1020,7 +1020,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
 
     if(!uncpath)
       /* no host for file: URLs by default */
-      Curl_dyn_reset(&host);
+      curlx_dyn_reset(&host);
 
 #if !defined(_WIN32) && !defined(MSDOS) && !defined(__CYGWIN__)
     /* Do not allow Windows drive letters when not in Windows.
@@ -1106,7 +1106,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
         goto fail;
 
       if((flags & CURLU_GUESS_SCHEME) && !schemep) {
-        const char *hostname = Curl_dyn_ptr(&host);
+        const char *hostname = curlx_dyn_ptr(&host);
         /* legacy curl-style guess based on hostname */
         if(checkprefix("ftp.", hostname))
           schemep = "ftp";
@@ -1133,7 +1133,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
     }
     else if(flags & CURLU_NO_AUTHORITY) {
       /* allowed to be empty. */
-      if(Curl_dyn_add(&host, "")) {
+      if(curlx_dyn_add(&host, "")) {
         result = CURLUE_OUT_OF_MEMORY;
         goto fail;
       }
@@ -1152,11 +1152,11 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
       /* skip the leading '#' in the copy but include the terminating null */
       if(flags & CURLU_URLENCODE) {
         struct dynbuf enc;
-        Curl_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
+        curlx_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
         result = urlencode_str(&enc, fragment + 1, fraglen - 1, TRUE, FALSE);
         if(result)
           goto fail;
-        u->fragment = Curl_dyn_ptr(&enc);
+        u->fragment = curlx_dyn_ptr(&enc);
       }
       else {
         u->fragment = Curl_memdup0(fragment + 1, fraglen - 1);
@@ -1179,12 +1179,12 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
     if(qlen > 1) {
       if(flags & CURLU_URLENCODE) {
         struct dynbuf enc;
-        Curl_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
+        curlx_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
         /* skip the leading question mark */
         result = urlencode_str(&enc, query + 1, qlen - 1, TRUE, TRUE);
         if(result)
           goto fail;
-        u->query = Curl_dyn_ptr(&enc);
+        u->query = curlx_dyn_ptr(&enc);
       }
       else {
         u->query = Curl_memdup0(query + 1, qlen - 1);
@@ -1206,12 +1206,12 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
 
   if(pathlen && (flags & CURLU_URLENCODE)) {
     struct dynbuf enc;
-    Curl_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
+    curlx_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
     result = urlencode_str(&enc, path, pathlen, TRUE, FALSE);
     if(result)
       goto fail;
-    pathlen = Curl_dyn_len(&enc);
-    path = u->path = Curl_dyn_ptr(&enc);
+    pathlen = curlx_dyn_len(&enc);
+    path = u->path = curlx_dyn_ptr(&enc);
   }
 
   if(pathlen <= 1) {
@@ -1246,11 +1246,11 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
     }
   }
 
-  u->host = Curl_dyn_ptr(&host);
+  u->host = curlx_dyn_ptr(&host);
 
   return result;
 fail:
-  Curl_dyn_free(&host);
+  curlx_dyn_free(&host);
   free_urlhandle(u);
   return result;
 }
@@ -1468,11 +1468,11 @@ CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
           /* make it '[ host %25 zoneid ]' */
           struct dynbuf enc;
           size_t hostlen = strlen(u->host);
-          Curl_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
-          if(Curl_dyn_addf(&enc, "%.*s%%25%s]", (int)hostlen - 1, u->host,
-                           u->zoneid))
+          curlx_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
+          if(curlx_dyn_addf(&enc, "%.*s%%25%s]", (int)hostlen - 1, u->host,
+                            u->zoneid))
             return CURLUE_OUT_OF_MEMORY;
-          allochost = Curl_dyn_ptr(&enc);
+          allochost = curlx_dyn_ptr(&enc);
         }
       }
       else if(urlencode) {
@@ -1569,12 +1569,12 @@ CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
     if(urlencode) {
       struct dynbuf enc;
       CURLUcode uc;
-      Curl_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
+      curlx_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
       uc = urlencode_str(&enc, *part, partlen, TRUE, what == CURLUPART_QUERY);
       if(uc)
         return uc;
       free(*part);
-      *part = Curl_dyn_ptr(&enc);
+      *part = curlx_dyn_ptr(&enc);
     }
     else if(punycode) {
       if(!Curl_is_ASCII_name(u->host)) {
@@ -1733,7 +1733,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
     else {
       char *tmp;
       curl_off_t port;
-      if(Curl_str_number(&part, &port, 0xffff) || *part)
+      if(curlx_str_number(&part, &port, 0xffff) || *part)
         /* weirdly provided number, not good! */
         return CURLUE_BAD_PORT_NUMBER;
       tmp = aprintf("%" CURL_FORMAT_CURL_OFF_T, port);
@@ -1802,10 +1802,10 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
   {
     const char *newp;
     struct dynbuf enc;
-    Curl_dyn_init(&enc, nalloc * 3 + 1 + leadingslash);
+    curlx_dyn_init(&enc, nalloc * 3 + 1 + leadingslash);
 
     if(leadingslash && (part[0] != '/')) {
-      CURLcode result = Curl_dyn_addn(&enc, "/", 1);
+      CURLcode result = curlx_dyn_addn(&enc, "/", 1);
       if(result)
         return cc2cu(result);
     }
@@ -1815,7 +1815,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
       for(i = (const unsigned char *)part; *i; i++) {
         CURLcode result;
         if((*i == ' ') && plusencode) {
-          result = Curl_dyn_addn(&enc, "+", 1);
+          result = curlx_dyn_addn(&enc, "+", 1);
           if(result)
             return CURLUE_OUT_OF_MEMORY;
         }
@@ -1825,14 +1825,14 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
           if((*i == '=') && equalsencode)
             /* only skip the first equals sign */
             equalsencode = FALSE;
-          result = Curl_dyn_addn(&enc, i, 1);
+          result = curlx_dyn_addn(&enc, i, 1);
           if(result)
             return cc2cu(result);
         }
         else {
           unsigned char out[3]={'%'};
           Curl_hexbyte(&out[1], *i, TRUE);
-          result = Curl_dyn_addn(&enc, out, 3);
+          result = curlx_dyn_addn(&enc, out, 3);
           if(result)
             return cc2cu(result);
         }
@@ -1840,10 +1840,10 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
     }
     else {
       char *p;
-      CURLcode result = Curl_dyn_add(&enc, part);
+      CURLcode result = curlx_dyn_add(&enc, part);
       if(result)
         return cc2cu(result);
-      p = Curl_dyn_ptr(&enc);
+      p = curlx_dyn_ptr(&enc);
       while(*p) {
         /* make sure percent encoded are lower case */
         if((*p == '%') && ISXDIGIT(p[1]) && ISXDIGIT(p[2]) &&
@@ -1856,7 +1856,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
           p++;
       }
     }
-    newp = Curl_dyn_ptr(&enc);
+    newp = curlx_dyn_ptr(&enc);
 
     if(appendquery && newp) {
       /* Append the 'newp' string onto the old query. Add a '&' separator if
@@ -1866,29 +1866,29 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
       bool addamperand = querylen && (u->query[querylen -1] != '&');
       if(querylen) {
         struct dynbuf qbuf;
-        Curl_dyn_init(&qbuf, CURL_MAX_INPUT_LENGTH);
+        curlx_dyn_init(&qbuf, CURL_MAX_INPUT_LENGTH);
 
-        if(Curl_dyn_addn(&qbuf, u->query, querylen)) /* add original query */
+        if(curlx_dyn_addn(&qbuf, u->query, querylen)) /* add original query */
           goto nomem;
 
         if(addamperand) {
-          if(Curl_dyn_addn(&qbuf, "&", 1))
+          if(curlx_dyn_addn(&qbuf, "&", 1))
             goto nomem;
         }
-        if(Curl_dyn_add(&qbuf, newp))
+        if(curlx_dyn_add(&qbuf, newp))
           goto nomem;
-        Curl_dyn_free(&enc);
+        curlx_dyn_free(&enc);
         free(*storep);
-        *storep = Curl_dyn_ptr(&qbuf);
+        *storep = curlx_dyn_ptr(&qbuf);
         return CURLUE_OK;
 nomem:
-        Curl_dyn_free(&enc);
+        curlx_dyn_free(&enc);
         return CURLUE_OUT_OF_MEMORY;
       }
     }
 
     else if(what == CURLUPART_HOST) {
-      size_t n = Curl_dyn_len(&enc);
+      size_t n = curlx_dyn_len(&enc);
       if(!n && (flags & CURLU_NO_AUTHORITY)) {
         /* Skip hostname check, it is allowed to be empty. */
       }
@@ -1910,7 +1910,7 @@ nomem:
         else if(hostname_check(u, (char *)CURL_UNCONST(newp), n))
           bad = TRUE;
         if(bad) {
-          Curl_dyn_free(&enc);
+          curlx_dyn_free(&enc);
           return CURLUE_BAD_HOSTNAME;
         }
       }
index ea3cb4b159b84ae0b89171b6cb4a638a7d448f9d..bac416027f379e2e88a78a0461227d5d2203a165 100644 (file)
@@ -145,7 +145,7 @@ typedef unsigned int curl_prot_t;
 #include <netinet/in6.h>
 #endif
 
-#include "timeval.h"
+#include "curlx/timeval.h"
 
 #include <curl/curl.h>
 
@@ -153,7 +153,7 @@ typedef unsigned int curl_prot_t;
 #include "hostip.h"
 #include "hash.h"
 #include "splay.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 #include "dynhds.h"
 #include "request.h"
 #include "netrc.h"
index 4811394e19c8c8e55012574a93983416bdc579e4..719abd196067cb11766530fe9ecae2eec6de7854 100644 (file)
@@ -35,7 +35,7 @@
 #include "../urldata.h"
 
 #include "vauth.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "../sendf.h"
 #include "../curl_printf.h"
 
index d39b69a393e690f87e9ce8b78f83f0e7df42ba96..3586e1012d0a35b841b2f77a42780153043ad3b1 100644 (file)
@@ -34,7 +34,7 @@
 #include "vauth.h"
 #include "../curl_hmac.h"
 #include "../curl_md5.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "../curl_printf.h"
 
 /* The last #include files should be: */
index d0b7687c04b867179be702834f16178b6a9466eb..d99dac194c479516fd37f6555aa067551840c6b8 100644 (file)
 #include "vauth.h"
 #include "digest.h"
 #include "../urldata.h"
-#include "../curl_base64.h"
+#include "../curlx/base64.h"
 #include "../curl_hmac.h"
 #include "../curl_md5.h"
 #include "../curl_sha256.h"
 #include "../curl_sha512_256.h"
 #include "../vtls/vtls.h"
-#include "../warnless.h"
-#include "../strparse.h"
+#include "../curlx/warnless.h"
+#include "../curlx/strparse.h"
 #include "../strcase.h"
 #include "../curl_printf.h"
 #include "../rand.h"
@@ -223,14 +223,14 @@ static CURLcode auth_digest_get_qop_values(const char *options, int *value)
   /* Initialise the output */
   *value = 0;
 
-  while(!Curl_str_until(&options, &out, 32, ',')) {
-    if(Curl_str_casecompare(&out, DIGEST_QOP_VALUE_STRING_AUTH))
+  while(!curlx_str_until(&options, &out, 32, ',')) {
+    if(curlx_str_casecompare(&out, DIGEST_QOP_VALUE_STRING_AUTH))
       *value |= DIGEST_QOP_VALUE_AUTH;
-    else if(Curl_str_casecompare(&out, DIGEST_QOP_VALUE_STRING_AUTH_INT))
+    else if(curlx_str_casecompare(&out, DIGEST_QOP_VALUE_STRING_AUTH_INT))
       *value |= DIGEST_QOP_VALUE_AUTH_INT;
-    else if(Curl_str_casecompare(&out, DIGEST_QOP_VALUE_STRING_AUTH_CONF))
+    else if(curlx_str_casecompare(&out, DIGEST_QOP_VALUE_STRING_AUTH_CONF))
       *value |= DIGEST_QOP_VALUE_AUTH_CONF;
-    if(Curl_str_single(&options, ','))
+    if(curlx_str_single(&options, ','))
       break;
   }
 
@@ -542,13 +542,13 @@ CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
         /* Pass leading spaces */
         while(*token && ISBLANK(*token))
           token++;
-        while(!Curl_str_until(&token, &out, 32, ',')) {
-          if(Curl_str_casecompare(&out, DIGEST_QOP_VALUE_STRING_AUTH))
+        while(!curlx_str_until(&token, &out, 32, ',')) {
+          if(curlx_str_casecompare(&out, DIGEST_QOP_VALUE_STRING_AUTH))
             foundAuth = TRUE;
-          else if(Curl_str_casecompare(&out,
+          else if(curlx_str_casecompare(&out,
                                        DIGEST_QOP_VALUE_STRING_AUTH_INT))
             foundAuthInt = TRUE;
-          if(Curl_str_single(&token, ','))
+          if(curlx_str_single(&token, ','))
             break;
           while(*token && ISBLANK(*token))
             token++;
@@ -699,8 +699,8 @@ static CURLcode auth_create_digest_http_message(
     if(result)
       return result;
 
-    result = Curl_base64_encode(cnoncebuf, sizeof(cnoncebuf),
-                                &cnonce, &cnonce_sz);
+    result = curlx_base64_encode(cnoncebuf, sizeof(cnoncebuf),
+                                 &cnonce, &cnonce_sz);
     if(result)
       return result;
 
index d3e9a23e62956832f4f04b434b110e29145ee1e6..4be8fc916dbf81105ac3ea48954e0281e6914818 100644 (file)
@@ -34,7 +34,7 @@
 #include "vauth.h"
 #include "digest.h"
 #include "../urldata.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "../curl_multibyte.h"
 #include "../sendf.h"
 #include "../strdup.h"
index f9abd952a564ab6689f29f619b048341395fe000..41590ae2f9adde930fbb3603cbcfe8ca71e3afb0 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "vauth.h"
 #include "../urldata.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "../curl_multibyte.h"
 #include "../sendf.h"
 
index 46633ae1e635bc27b08af4bd317aa9b6c959cea5..e433f2f1ae4cbbdfc102912f6a299b72dc9a36f5 100644 (file)
@@ -41,7 +41,7 @@
 #include "../curl_gethostname.h"
 #include "../curl_multibyte.h"
 #include "../curl_md5.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "../rand.h"
 #include "../vtls/vtls.h"
 #include "../strdup.h"
index 0e6651a3afd61c18eb866ea2eedb73251c92b258..ffc216f325969e452216794649d1082f3809f2f1 100644 (file)
@@ -31,7 +31,7 @@
 #include "vauth.h"
 #include "../urldata.h"
 #include "../curl_ntlm_core.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "../curl_multibyte.h"
 #include "../sendf.h"
 #include "../strdup.h"
index dec2d0b2aa1223f7217d1896c3b24f0245795f7a..76e77c6a2f425c362eac70dc92048d644283fd33 100644 (file)
@@ -34,7 +34,7 @@
 #include "../urldata.h"
 
 #include "vauth.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "../curl_printf.h"
 
 /* The last #include files should be: */
index 0b4a7b6d2e060be789a248dcae3c3bccd62d3014..715f6e778c003209e20639ed6900e40f664386f7 100644 (file)
@@ -32,9 +32,9 @@
 
 #include "vauth.h"
 #include "../urldata.h"
-#include "../curl_base64.h"
+#include "../curlx/base64.h"
 #include "../curl_gssapi.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "../curl_multibyte.h"
 #include "../sendf.h"
 
@@ -139,7 +139,7 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
   if(chlg64 && *chlg64) {
     /* Decode the base-64 encoded challenge message */
     if(*chlg64 != '=') {
-      result = Curl_base64_decode(chlg64, &chlg, &chlglen);
+      result = curlx_base64_decode(chlg64, &chlg, &chlglen);
       if(result)
         return result;
     }
@@ -156,10 +156,10 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
   }
 
   /* Set channel binding data if available */
-  if(Curl_dyn_len(&nego->channel_binding_data)) {
+  if(curlx_dyn_len(&nego->channel_binding_data)) {
     memset(&chan, 0, sizeof(struct gss_channel_bindings_struct));
-    chan.application_data.length = Curl_dyn_len(&nego->channel_binding_data);
-    chan.application_data.value = Curl_dyn_ptr(&nego->channel_binding_data);
+    chan.application_data.length = curlx_dyn_len(&nego->channel_binding_data);
+    chan.application_data.value = curlx_dyn_ptr(&nego->channel_binding_data);
     chan_bindings = &chan;
   }
 
@@ -228,9 +228,9 @@ CURLcode Curl_auth_create_spnego_message(struct negotiatedata *nego,
   OM_uint32 minor_status;
 
   /* Base64 encode the already generated response */
-  result = Curl_base64_encode(nego->output_token.value,
-                              nego->output_token.length,
-                              outptr, outlen);
+  result = curlx_base64_encode(nego->output_token.value,
+                               nego->output_token.length,
+                               outptr, outlen);
 
   if(result) {
     gss_release_buffer(&minor_status, &nego->output_token);
index 8603098fc118d32cdd576cc0b8d3c196486da3fe..946be3873fd19edc0602bbb3e927f41d56647334 100644 (file)
@@ -32,8 +32,8 @@
 
 #include "vauth.h"
 #include "../urldata.h"
-#include "../curl_base64.h"
-#include "../warnless.h"
+#include "../curlx/base64.h"
+#include "../curlx/warnless.h"
 #include "../curl_multibyte.h"
 #include "../sendf.h"
 #include "../strerror.h"
@@ -186,7 +186,7 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
   if(chlg64 && *chlg64) {
     /* Decode the base-64 encoded challenge message */
     if(*chlg64 != '=') {
-      result = Curl_base64_decode(chlg64, &chlg, &chlglen);
+      result = curlx_base64_decode(chlg64, &chlg, &chlglen);
       if(result)
         return result;
     }
@@ -308,9 +308,9 @@ CURLcode Curl_auth_create_spnego_message(struct negotiatedata *nego,
                                          char **outptr, size_t *outlen)
 {
   /* Base64 encode the already generated response */
-  CURLcode result = Curl_base64_encode((const char *) nego->output_token,
-                                       nego->output_token_length, outptr,
-                                       outlen);
+  CURLcode result = curlx_base64_encode((const char *) nego->output_token,
+                                        nego->output_token_length, outptr,
+                                        outlen);
   if(!result && (!*outptr || !*outlen)) {
     free(*outptr);
     result = CURLE_REMOTE_ACCESS_DENIED;
index ae3c74672aa3d3b654fa2fe4e6cc9d952b062c93..4baba2708680e1b67d8a5356159798dd5058ff13 100644 (file)
 
 #include <curl/curl.h>
 #include "version_win32.h"
-#include "warnless.h"
+#include "curlx/warnless.h"
 
 /* The last 2 #include files should be in this order */
-#ifdef BUILDING_LIBCURL
 #include "curl_memory.h"
-#endif
 #include "memdebug.h"
 
 /* This Unicode version struct works for VerifyVersionInfoW (OSVERSIONINFOEXW)
index cd85fd5fb965b594281df5db659d8b69403f9824..cbeb6505163327f00b44ab42240ae7086bc6e04d 100644 (file)
@@ -29,7 +29,7 @@
 #include "../urldata.h"
 #include "../hash.h"
 #include "../uint-hash.h"
-#include "../timeval.h"
+#include "../curlx/timeval.h"
 #include "../multiif.h"
 #include "../sendf.h"
 #include "../curl_trc.h"
@@ -901,14 +901,14 @@ static CURLcode cf_msh3_connect(struct Curl_cfilter *cf,
 
   *done = FALSE;
   if(!ctx->qconn) {
-    ctx->connect_started = Curl_now();
+    ctx->connect_started = curlx_now();
     result = cf_connect_start(cf, data);
     if(result)
       goto out;
   }
 
   if(ctx->handshake_complete) {
-    ctx->handshake_at = Curl_now();
+    ctx->handshake_at = curlx_now();
     if(ctx->handshake_succeeded) {
       CURL_TRC_CF(data, cf, "handshake succeeded");
       cf->conn->bits.multiplex = TRUE; /* at least potentially multiplexed */
index 9827a89517ada2555707dfbabc3b72b0f6fe3e70..ed14710cdfd09a9332035fa14e8f407c22d64627 100644 (file)
@@ -58,7 +58,7 @@
 #include "../connect.h"
 #include "../progress.h"
 #include "../strerror.h"
-#include "../dynbuf.h"
+#include "../curlx/dynbuf.h"
 #include "../http1.h"
 #include "../select.h"
 #include "../inet_pton.h"
@@ -71,7 +71,7 @@
 #include "../vtls/vtls_scache.h"
 #include "curl_ngtcp2.h"
 
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 
 /* The last 3 #include files should be in this order */
 #include "../curl_printf.h"
@@ -170,7 +170,7 @@ static void cf_ngtcp2_ctx_init(struct cf_ngtcp2_ctx *ctx)
   ctx->max_stream_window = H3_STREAM_WINDOW_SIZE;
   Curl_bufcp_init(&ctx->stream_bufcp, H3_STREAM_CHUNK_SIZE,
                   H3_STREAM_POOL_SPARES);
-  Curl_dyn_init(&ctx->scratch, CURL_MAX_HTTP_HEADER);
+  curlx_dyn_init(&ctx->scratch, CURL_MAX_HTTP_HEADER);
   Curl_uint_hash_init(&ctx->streams, 63, h3_stream_hash_free);
   ctx->initialized = TRUE;
 }
@@ -181,7 +181,7 @@ static void cf_ngtcp2_ctx_free(struct cf_ngtcp2_ctx *ctx)
     Curl_vquic_tls_cleanup(&ctx->tls);
     vquic_ctx_free(&ctx->q);
     Curl_bufcp_free(&ctx->stream_bufcp);
-    Curl_dyn_free(&ctx->scratch);
+    curlx_dyn_free(&ctx->scratch);
     Curl_uint_hash_destroy(&ctx->streams);
     Curl_ssl_peer_cleanup(&ctx->peer);
   }
@@ -478,14 +478,14 @@ static int cf_ngtcp2_handshake_completed(ngtcp2_conn *tconn, void *user_data)
   if(!ctx || !data)
     return NGHTTP3_ERR_CALLBACK_FAILURE;
 
-  ctx->handshake_at = Curl_now();
+  ctx->handshake_at = curlx_now();
   ctx->tls_handshake_complete = TRUE;
   cf->conn->bits.multiplex = TRUE; /* at least potentially multiplexed */
 
   ctx->tls_vrfy_result = Curl_vquic_tls_verify_peer(&ctx->tls, cf,
                                                     data, &ctx->peer);
   CURL_TRC_CF(data, cf, "handshake complete after %dms",
-             (int)Curl_timediff(ctx->handshake_at, ctx->started_at));
+             (int)curlx_timediff(ctx->handshake_at, ctx->started_at));
   /* In case of earlydata, where we simulate being connected, update
    * the handshake time when we really did connect */
   if(ctx->use_earlydata)
@@ -1101,18 +1101,18 @@ static int cb_h3_recv_header(nghttp3_conn *conn, int64_t sid,
                                      (const char *)h3val.base, h3val.len);
     if(result)
       return -1;
-    Curl_dyn_reset(&ctx->scratch);
-    result = Curl_dyn_addn(&ctx->scratch, STRCONST("HTTP/3 "));
+    curlx_dyn_reset(&ctx->scratch);
+    result = curlx_dyn_addn(&ctx->scratch, STRCONST("HTTP/3 "));
     if(!result)
-      result = Curl_dyn_addn(&ctx->scratch,
-                             (const char *)h3val.base, h3val.len);
+      result = curlx_dyn_addn(&ctx->scratch,
+                              (const char *)h3val.base, h3val.len);
     if(!result)
-      result = Curl_dyn_addn(&ctx->scratch, STRCONST(" \r\n"));
+      result = curlx_dyn_addn(&ctx->scratch, STRCONST(" \r\n"));
     if(!result)
-      h3_xfer_write_resp_hd(cf, data, stream, Curl_dyn_ptr(&ctx->scratch),
-                            Curl_dyn_len(&ctx->scratch), FALSE);
+      h3_xfer_write_resp_hd(cf, data, stream, curlx_dyn_ptr(&ctx->scratch),
+                            curlx_dyn_len(&ctx->scratch), FALSE);
     CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] status: %s",
-                stream_id, Curl_dyn_ptr(&ctx->scratch));
+                stream_id, curlx_dyn_ptr(&ctx->scratch));
     if(result) {
       return -1;
     }
@@ -1122,19 +1122,19 @@ static int cb_h3_recv_header(nghttp3_conn *conn, int64_t sid,
     CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] header: %.*s: %.*s",
                 stream_id, (int)h3name.len, h3name.base,
                 (int)h3val.len, h3val.base);
-    Curl_dyn_reset(&ctx->scratch);
-    result = Curl_dyn_addn(&ctx->scratch,
-                           (const char *)h3name.base, h3name.len);
+    curlx_dyn_reset(&ctx->scratch);
+    result = curlx_dyn_addn(&ctx->scratch,
+                            (const char *)h3name.base, h3name.len);
     if(!result)
-      result = Curl_dyn_addn(&ctx->scratch, STRCONST(": "));
+      result = curlx_dyn_addn(&ctx->scratch, STRCONST(": "));
     if(!result)
-      result = Curl_dyn_addn(&ctx->scratch,
-                             (const char *)h3val.base, h3val.len);
+      result = curlx_dyn_addn(&ctx->scratch,
+                              (const char *)h3val.base, h3val.len);
     if(!result)
-      result = Curl_dyn_addn(&ctx->scratch, STRCONST("\r\n"));
+      result = curlx_dyn_addn(&ctx->scratch, STRCONST("\r\n"));
     if(!result)
-      h3_xfer_write_resp_hd(cf, data, stream, Curl_dyn_ptr(&ctx->scratch),
-                            Curl_dyn_len(&ctx->scratch), FALSE);
+      h3_xfer_write_resp_hd(cf, data, stream, curlx_dyn_ptr(&ctx->scratch),
+                            curlx_dyn_len(&ctx->scratch), FALSE);
   }
   return 0;
 }
@@ -2566,7 +2566,7 @@ static CURLcode cf_ngtcp2_connect(struct Curl_cfilter *cf,
   }
 
   *done = FALSE;
-  now = Curl_now();
+  now = curlx_now();
   pktx_init(&pktx, cf, data);
 
   CF_DATA_SAVE(save, cf, data);
@@ -2669,7 +2669,7 @@ static CURLcode cf_ngtcp2_query(struct Curl_cfilter *cf,
   }
   case CF_QUERY_CONNECT_REPLY_MS:
     if(ctx->q.got_first_byte) {
-      timediff_t ms = Curl_timediff(ctx->q.first_byte_at, ctx->started_at);
+      timediff_t ms = curlx_timediff(ctx->q.first_byte_at, ctx->started_at);
       *pres1 = (ms < INT_MAX) ? (int)ms : INT_MAX;
     }
     else
@@ -2716,7 +2716,7 @@ static bool cf_ngtcp2_conn_is_alive(struct Curl_cfilter *cf,
    * it will close the connection when it expires. */
   rp = ngtcp2_conn_get_remote_transport_params(ctx->qconn);
   if(rp && rp->max_idle_timeout) {
-    timediff_t idletime = Curl_timediff(Curl_now(), ctx->q.last_io);
+    timediff_t idletime = curlx_timediff(curlx_now(), ctx->q.last_io);
     if(idletime > 0 && (uint64_t)idletime > rp->max_idle_timeout)
       goto out;
   }
index 7e718f090e7e9866cfb94148c9c10ea0185fbbf7..39eaf268d56d652f96fc4705805ca2e9a474a527 100644 (file)
@@ -43,7 +43,7 @@
 #include "../connect.h"
 #include "../progress.h"
 #include "../strerror.h"
-#include "../dynbuf.h"
+#include "../curlx/dynbuf.h"
 #include "../http1.h"
 #include "../select.h"
 #include "../inet_pton.h"
@@ -55,8 +55,7 @@
 #include "../vtls/vtls.h"
 #include "../vtls/openssl.h"
 #include "curl_osslq.h"
-
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 
 /* The last 3 #include files should be in this order */
 #include "../curl_printf.h"
@@ -1665,7 +1664,7 @@ static CURLcode h3_send_streams(struct Curl_cfilter *cf,
     if(acked_len > 0 || (eos && !s->send_blocked)) {
       /* Since QUIC buffers the data written internally, we can tell
        * nghttp3 that it can move forward on it */
-      ctx->q.last_io = Curl_now();
+      ctx->q.last_io = curlx_now();
       rv = nghttp3_conn_add_write_offset(ctx->h3.conn, s->id, acked_len);
       if(rv && rv != NGHTTP3_ERR_STREAM_NOT_FOUND) {
         failf(data, "nghttp3_conn_add_write_offset returned error: %s\n",
@@ -1779,7 +1778,7 @@ static CURLcode cf_osslq_connect(struct Curl_cfilter *cf,
   }
 
   *done = FALSE;
-  now = Curl_now();
+  now = curlx_now();
   CF_DATA_SAVE(save, cf, data);
 
   if(!ctx->tls.ossl.ssl) {
@@ -1793,7 +1792,7 @@ static CURLcode cf_osslq_connect(struct Curl_cfilter *cf,
     int readable = SOCKET_READABLE(ctx->q.sockfd, 0);
     if(readable > 0 && (readable & CURL_CSELECT_IN)) {
       ctx->got_first_byte = TRUE;
-      ctx->first_byte_at = Curl_now();
+      ctx->first_byte_at = curlx_now();
     }
   }
 
@@ -1813,7 +1812,7 @@ static CURLcode cf_osslq_connect(struct Curl_cfilter *cf,
     ctx->handshake_at = now;
     ctx->q.last_io = now;
     CURL_TRC_CF(data, cf, "handshake complete after %dms",
-               (int)Curl_timediff(now, ctx->started_at));
+               (int)curlx_timediff(now, ctx->started_at));
     result = cf_osslq_verify_peer(cf, data);
     if(!result) {
       CURL_TRC_CF(data, cf, "peer verified");
@@ -2289,7 +2288,7 @@ static bool cf_osslq_conn_is_alive(struct Curl_cfilter *cf,
       goto out;
     }
     CURL_TRC_CF(data, cf, "negotiated idle timeout: %zums", (size_t)idle_ms);
-    idletime = Curl_timediff(Curl_now(), ctx->q.last_io);
+    idletime = curlx_timediff(curlx_now(), ctx->q.last_io);
     if(idletime > 0 && (uint64_t)idletime > idle_ms)
       goto out;
   }
@@ -2376,7 +2375,7 @@ static CURLcode cf_osslq_query(struct Curl_cfilter *cf,
   }
   case CF_QUERY_CONNECT_REPLY_MS:
     if(ctx->got_first_byte) {
-      timediff_t ms = Curl_timediff(ctx->first_byte_at, ctx->started_at);
+      timediff_t ms = curlx_timediff(ctx->first_byte_at, ctx->started_at);
       *pres1 = (ms < INT_MAX) ? (int)ms : INT_MAX;
     }
     else
index 869a2bc1b0c4806318ab23258f5b5230347baf3e..a1d184fc383d84516ae732c5f38b741573005ea9 100644 (file)
@@ -1452,7 +1452,7 @@ static CURLcode cf_quiche_connect(struct Curl_cfilter *cf,
   if(quiche_conn_is_established(ctx->qconn)) {
     ctx->handshake_at = ctx->q.last_op;
     CURL_TRC_CF(data, cf, "handshake complete after %dms",
-                (int)Curl_timediff(ctx->handshake_at, ctx->started_at));
+                (int)curlx_timediff(ctx->handshake_at, ctx->started_at));
     result = cf_quiche_verify_peer(cf, data);
     if(!result) {
       CURL_TRC_CF(data, cf, "peer verified");
@@ -1580,7 +1580,7 @@ static CURLcode cf_quiche_query(struct Curl_cfilter *cf,
   }
   case CF_QUERY_CONNECT_REPLY_MS:
     if(ctx->q.got_first_byte) {
-      timediff_t ms = Curl_timediff(ctx->q.first_byte_at, ctx->started_at);
+      timediff_t ms = curlx_timediff(ctx->q.first_byte_at, ctx->started_at);
       *pres1 = (ms < INT_MAX) ? (int)ms : INT_MAX;
     }
     else
index 7c112597172403293be14e157df4ab2dcc3fe6e1..b5dc44f8aa90b16695c68bf8bc8ae1e8db1ae474 100644 (file)
@@ -32,7 +32,7 @@
 #endif
 #include "../urldata.h"
 #include "../bufq.h"
-#include "../dynbuf.h"
+#include "../curlx/dynbuf.h"
 #include "../cfilters.h"
 #include "../curl_trc.h"
 #include "curl_msh3.h"
@@ -44,7 +44,7 @@
 #include "vquic.h"
 #include "vquic_int.h"
 #include "../strerror.h"
-#include "../strparse.h"
+#include "../curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "../curl_printf.h"
@@ -95,7 +95,7 @@ CURLcode vquic_ctx_init(struct cf_quic_ctx *qctx)
     const char *p = getenv("CURL_DBG_QUIC_WBLOCK");
     if(p) {
       curl_off_t l;
-      if(!Curl_str_number(&p, &l, 100))
+      if(!curlx_str_number(&p, &l, 100))
         qctx->wblock_percent = (int)l;
     }
   }
@@ -112,7 +112,7 @@ void vquic_ctx_free(struct cf_quic_ctx *qctx)
 
 void vquic_ctx_update_time(struct cf_quic_ctx *qctx)
 {
-  qctx->last_op = Curl_now();
+  qctx->last_op = curlx_now();
 }
 
 static CURLcode send_packet_no_gso(struct Curl_cfilter *cf,
@@ -651,25 +651,25 @@ CURLcode Curl_qlogdir(struct Curl_easy *data,
     struct dynbuf fname;
     CURLcode result;
     unsigned int i;
-    Curl_dyn_init(&fname, DYN_QLOG_NAME);
-    result = Curl_dyn_add(&fname, qlog_dir);
+    curlx_dyn_init(&fname, DYN_QLOG_NAME);
+    result = curlx_dyn_add(&fname, qlog_dir);
     if(!result)
-      result = Curl_dyn_add(&fname, "/");
+      result = curlx_dyn_add(&fname, "/");
     for(i = 0; (i < scidlen) && !result; i++) {
       char hex[3];
       msnprintf(hex, 3, "%02x", scid[i]);
-      result = Curl_dyn_add(&fname, hex);
+      result = curlx_dyn_add(&fname, hex);
     }
     if(!result)
-      result = Curl_dyn_add(&fname, ".sqlog");
+      result = curlx_dyn_add(&fname, ".sqlog");
 
     if(!result) {
-      int qlogfd = open(Curl_dyn_ptr(&fname), O_WRONLY|O_CREAT|CURL_O_BINARY,
+      int qlogfd = open(curlx_dyn_ptr(&fname), O_WRONLY|O_CREAT|CURL_O_BINARY,
                         data->set.new_file_perms);
       if(qlogfd != -1)
         *qlogfdp = qlogfd;
     }
-    Curl_dyn_free(&fname);
+    curlx_dyn_free(&fname);
     if(result)
       return result;
   }
index caff85b6466523d7dee017cea2e6a434808da7b8..117d2e6009f622a3e2d6b8714c42c1b953d86bfb 100644 (file)
@@ -50,13 +50,13 @@ CURLcode Curl_getworkingpath(struct Curl_easy *data,
     return result;
 
   /* new path to switch to in case we need to */
-  Curl_dyn_init(&npath, MAX_SSHPATH_LEN);
+  curlx_dyn_init(&npath, MAX_SSHPATH_LEN);
 
   /* Check for /~/, indicating relative to the user's home directory */
   if((data->conn->handler->protocol & CURLPROTO_SCP) &&
      (working_path_len > 3) && (!memcmp(working_path, "/~/", 3))) {
     /* It is referenced to the home directory, so strip the leading '/~/' */
-    if(Curl_dyn_addn(&npath, &working_path[3], working_path_len - 3)) {
+    if(curlx_dyn_addn(&npath, &working_path[3], working_path_len - 3)) {
       free(working_path);
       return CURLE_OUT_OF_MEMORY;
     }
@@ -64,7 +64,7 @@ CURLcode Curl_getworkingpath(struct Curl_easy *data,
   else if((data->conn->handler->protocol & CURLPROTO_SFTP) &&
           (!strcmp("/~", working_path) ||
            ((working_path_len > 2) && !memcmp(working_path, "/~/", 3)))) {
-    if(Curl_dyn_add(&npath, homedir)) {
+    if(curlx_dyn_add(&npath, homedir)) {
       free(working_path);
       return CURLE_OUT_OF_MEMORY;
     }
@@ -73,24 +73,24 @@ CURLcode Curl_getworkingpath(struct Curl_easy *data,
       const char *p;
       int copyfrom = 3;
       /* Copy a separating '/' if homedir does not end with one */
-      len = Curl_dyn_len(&npath);
-      p = Curl_dyn_ptr(&npath);
+      len = curlx_dyn_len(&npath);
+      p = curlx_dyn_ptr(&npath);
       if(len && (p[len-1] != '/'))
         copyfrom = 2;
 
-      if(Curl_dyn_addn(&npath,
-                       &working_path[copyfrom], working_path_len - copyfrom)) {
+      if(curlx_dyn_addn(&npath, &working_path[copyfrom],
+                        working_path_len - copyfrom)) {
         free(working_path);
         return CURLE_OUT_OF_MEMORY;
       }
     }
   }
 
-  if(Curl_dyn_len(&npath)) {
+  if(curlx_dyn_len(&npath)) {
     free(working_path);
 
     /* store the pointer for the caller to receive */
-    *path = Curl_dyn_ptr(&npath);
+    *path = curlx_dyn_ptr(&npath);
   }
   else
     *path = working_path;
@@ -133,7 +133,7 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, const char *homedir)
   if(!*cp || !homedir)
     return CURLE_QUOTE_ERROR;
 
-  Curl_dyn_init(&out, MAX_PATHLENGTH);
+  curlx_dyn_init(&out, MAX_PATHLENGTH);
 
   /* Ignore leading whitespace */
   cp += strspn(cp, WHITESPACE);
@@ -158,12 +158,12 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, const char *homedir)
           goto fail;
         }
       }
-      result = Curl_dyn_addn(&out, &cp[i], 1);
+      result = curlx_dyn_addn(&out, &cp[i], 1);
       if(result)
         return result;
     }
 
-    if(!Curl_dyn_len(&out))
+    if(!curlx_dyn_len(&out))
       goto fail;
 
     /* return pointer to second parameter if it exists */
@@ -180,23 +180,23 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, const char *homedir)
 
     /* Handling for relative path - prepend home directory */
     if(cp[0] == '/' && cp[1] == '~' && cp[2] == '/') {
-      result = Curl_dyn_add(&out, homedir);
+      result = curlx_dyn_add(&out, homedir);
       if(!result)
-        result = Curl_dyn_addn(&out, "/", 1);
+        result = curlx_dyn_addn(&out, "/", 1);
       if(result)
         return result;
       cp += 3;
     }
     /* Copy path name up until first "whitespace" */
-    result = Curl_dyn_addn(&out, cp, (end - cp));
+    result = curlx_dyn_addn(&out, cp, (end - cp));
     if(result)
       return result;
   }
-  *path = Curl_dyn_ptr(&out);
+  *path = curlx_dyn_ptr(&out);
   return CURLE_OK;
 
 fail:
-  Curl_dyn_free(&out);
+  curlx_dyn_free(&out);
   return CURLE_QUOTE_ERROR;
 }
 
index 7ed4fbe3eaa916c1f6905957b6263b85eb910da9..13a6147be6795d78fd1d9260a5390d2a1ecccc75 100644 (file)
 #include "../inet_ntop.h"
 #include "../parsedate.h"          /* for the week day and month names */
 #include "../sockaddr.h"           /* required for Curl_sockaddr_storage */
-#include "../strparse.h"
+#include "../curlx/strparse.h"
 #include "../multiif.h"
 #include "../select.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "curl_path.h"
 
 #ifdef HAVE_SYS_STAT_H
@@ -1417,7 +1417,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
       break;
 
     case SSH_SFTP_READDIR:
-      Curl_dyn_reset(&sshc->readdir_buf);
+      curlx_dyn_reset(&sshc->readdir_buf);
       if(sshc->readdir_attrs)
         sftp_attributes_free(sshc->readdir_attrs);
 
@@ -1447,7 +1447,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
 
         }
         else {
-          if(Curl_dyn_add(&sshc->readdir_buf, sshc->readdir_longentry)) {
+          if(curlx_dyn_add(&sshc->readdir_buf, sshc->readdir_longentry)) {
             sshc->actualcode = CURLE_OUT_OF_MEMORY;
             state(data, SSH_STOP);
             break;
@@ -1515,8 +1515,8 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
 
       Curl_safefree(sshc->readdir_linkPath);
 
-      if(Curl_dyn_addf(&sshc->readdir_buf, " -> %s",
-                       sshc->readdir_filename)) {
+      if(curlx_dyn_addf(&sshc->readdir_buf, " -> %s",
+                        sshc->readdir_filename)) {
         sshc->actualcode = CURLE_OUT_OF_MEMORY;
         break;
       }
@@ -1529,12 +1529,12 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
       state(data, SSH_SFTP_READDIR_BOTTOM);
       FALLTHROUGH();
     case SSH_SFTP_READDIR_BOTTOM:
-      if(Curl_dyn_addn(&sshc->readdir_buf, "\n", 1))
+      if(curlx_dyn_addn(&sshc->readdir_buf, "\n", 1))
         result = CURLE_OUT_OF_MEMORY;
       else
         result = Curl_client_write(data, CLIENTWRITE_BODY,
-                                   Curl_dyn_ptr(&sshc->readdir_buf),
-                                   Curl_dyn_len(&sshc->readdir_buf));
+                                   curlx_dyn_ptr(&sshc->readdir_buf),
+                                   curlx_dyn_len(&sshc->readdir_buf));
 
       ssh_string_free_char(sshc->readdir_tmp);
       sshc->readdir_tmp = NULL;
@@ -1609,13 +1609,13 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
           const char *p = data->state.range;
           int from_t, to_t;
 
-          from_t = Curl_str_number(&p, &from, CURL_OFF_T_MAX);
+          from_t = curlx_str_number(&p, &from, CURL_OFF_T_MAX);
           if(from_t == STRE_OVERFLOW)
             return CURLE_RANGE_ERROR;
-          Curl_str_passblanks(&p);
-          (void)Curl_str_single(&p, '-');
+          curlx_str_passblanks(&p);
+          (void)curlx_str_single(&p, '-');
 
-          to_t = Curl_str_numblanks(&p, &to);
+          to_t = curlx_str_numblanks(&p, &to);
           if(to_t == STRE_OVERFLOW)
             return CURLE_RANGE_ERROR;
 
@@ -2044,7 +2044,7 @@ static CURLcode myssh_block_statemach(struct Curl_easy *data,
   while((sshc->state != SSH_STOP) && !result) {
     bool block;
     timediff_t left = 1000;
-    struct curltime now = Curl_now();
+    struct curltime now = curlx_now();
 
     result = myssh_statemach_act(data, &block);
     if(result)
@@ -2087,7 +2087,7 @@ static CURLcode myssh_setup_connection(struct Curl_easy *data,
   struct ssh_conn *sshc = &conn->proto.sshc;
 
   if(!sshc->initialised) {
-    Curl_dyn_init(&sshc->readdir_buf, CURL_PATH_MAX * 2);
+    curlx_dyn_init(&sshc->readdir_buf, CURL_PATH_MAX * 2);
     sshc->initialised = TRUE;
   }
 
@@ -2338,7 +2338,7 @@ static void sshc_cleanup(struct ssh_conn *sshc, struct Curl_easy *data)
     Curl_safefree(sshc->rsa);
     Curl_safefree(sshc->quote_path1);
     Curl_safefree(sshc->quote_path2);
-    Curl_dyn_free(&sshc->readdir_buf);
+    curlx_dyn_free(&sshc->readdir_buf);
     Curl_safefree(sshc->readdir_linkPath);
     SSH_STRING_FREE_CHAR(sshc->homedir);
     sshc->initialised = FALSE;
@@ -2893,7 +2893,7 @@ static void sftp_quote_stat(struct Curl_easy *data)
   if(!strncmp(cmd, "chgrp", 5)) {
     const char *p = sshc->quote_path1;
     curl_off_t gid;
-    (void)Curl_str_number(&p, &gid, UINT_MAX);
+    (void)curlx_str_number(&p, &gid, UINT_MAX);
     sshc->quote_attrs->gid = (uint32_t)gid;
     if(sshc->quote_attrs->gid == 0 && !ISDIGIT(sshc->quote_path1[0]) &&
        !sshc->acceptfail) {
@@ -2910,7 +2910,7 @@ static void sftp_quote_stat(struct Curl_easy *data)
   else if(!strncmp(cmd, "chmod", 5)) {
     curl_off_t perms;
     const char *p = sshc->quote_path1;
-    if(Curl_str_octal(&p, &perms, 07777)) {
+    if(curlx_str_octal(&p, &perms, 07777)) {
       Curl_safefree(sshc->quote_path1);
       Curl_safefree(sshc->quote_path2);
       failf(data, "Syntax error: chmod permissions not a number");
@@ -2925,7 +2925,7 @@ static void sftp_quote_stat(struct Curl_easy *data)
   else if(!strncmp(cmd, "chown", 5)) {
     const char *p = sshc->quote_path1;
     curl_off_t uid;
-    (void)Curl_str_number(&p, &uid, UINT_MAX);
+    (void)curlx_str_number(&p, &uid, UINT_MAX);
     if(sshc->quote_attrs->uid == 0 && !ISDIGIT(sshc->quote_path1[0]) &&
        !sshc->acceptfail) {
       Curl_safefree(sshc->quote_path1);
index ce95e8ddf9fde90e4ddb0e8d5b8e639deeb47f4c..19a80f127d7cd5d2cbed9a7ffdf2024b167b6c76 100644 (file)
 #include "../sockaddr.h" /* required for Curl_sockaddr_storage */
 #include "../multiif.h"
 #include "../select.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "curl_path.h"
-#include "../strparse.h"
-#include "../curl_base64.h" /* for base64 encoding/decoding */
+#include "../curlx/strparse.h"
+#include "../curlx/base64.h" /* for base64 encoding/decoding */
 #include "../curl_sha256.h"
 
 /* The last 3 #include files should be in this order */
@@ -635,8 +635,8 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data)
 
     /* The length of fingerprint is 32 bytes for SHA256.
      * See libssh2_hostkey_hash documentation. */
-    if(Curl_base64_encode(fingerprint, 32, &fingerprint_b64,
-                          &fingerprint_b64_len) != CURLE_OK) {
+    if(curlx_base64_encode(fingerprint, 32, &fingerprint_b64,
+                           &fingerprint_b64_len) != CURLE_OK) {
       state(data, SSH_SESSION_FREE);
       sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
       return sshc->actualcode;
@@ -1371,7 +1371,7 @@ sftp_quote_stat(struct Curl_easy *data,
   if(!strncmp(cmd, "chgrp", 5)) {
     const char *p = sshc->quote_path1;
     curl_off_t gid;
-    (void)Curl_str_number(&p, &gid, ULONG_MAX);
+    (void)curlx_str_number(&p, &gid, ULONG_MAX);
     sshp->quote_attrs.gid = (unsigned long)gid;
     sshp->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID;
     if(sshp->quote_attrs.gid == 0 && !ISDIGIT(sshc->quote_path1[0]) &&
@@ -1384,7 +1384,7 @@ sftp_quote_stat(struct Curl_easy *data,
     curl_off_t perms;
     const char *p = sshc->quote_path1;
     /* permissions are octal */
-    if(Curl_str_octal(&p, &perms, 07777)) {
+    if(curlx_str_octal(&p, &perms, 07777)) {
       failf(data, "Syntax error: chmod permissions not a number");
       goto fail;
     }
@@ -1395,7 +1395,7 @@ sftp_quote_stat(struct Curl_easy *data,
   else if(!strncmp(cmd, "chown", 5)) {
     const char *p = sshc->quote_path1;
     curl_off_t uid;
-    (void)Curl_str_number(&p, &uid, ULONG_MAX);
+    (void)curlx_str_number(&p, &uid, ULONG_MAX);
     sshp->quote_attrs.uid = (unsigned long)uid;
     sshp->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID;
     if(sshp->quote_attrs.uid == 0 && !ISDIGIT(sshc->quote_path1[0]) &&
@@ -1478,13 +1478,13 @@ sftp_download_stat(struct Curl_easy *data,
       const char *p = data->state.range;
       int to_t, from_t;
 
-      from_t = Curl_str_number(&p, &from, CURL_OFF_T_MAX);
+      from_t = curlx_str_number(&p, &from, CURL_OFF_T_MAX);
       if(from_t == STRE_OVERFLOW)
         return CURLE_RANGE_ERROR;
-      Curl_str_passblanks(&p);
-      (void)Curl_str_single(&p, '-');
+      curlx_str_passblanks(&p);
+      (void)curlx_str_single(&p, '-');
 
-      to_t = Curl_str_numblanks(&p, &to);
+      to_t = curlx_str_numblanks(&p, &to);
       if(to_t == STRE_OVERFLOW)
         return CURLE_RANGE_ERROR;
       if((to_t == STRE_NO_NUM) /* no "to" value given */
@@ -1598,14 +1598,14 @@ static CURLcode sftp_readdir(struct Curl_easy *data,
         return result;
     }
     else {
-      result = Curl_dyn_add(&sshp->readdir, sshp->readdir_longentry);
+      result = curlx_dyn_add(&sshp->readdir, sshp->readdir_longentry);
 
       if(!result) {
         if((sshp->readdir_attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) &&
            ((sshp->readdir_attrs.permissions & LIBSSH2_SFTP_S_IFMT) ==
             LIBSSH2_SFTP_S_IFLNK)) {
-          result = Curl_dyn_addf(&sshp->readdir_link, "%s%s", sshp->path,
-                                 sshp->readdir_filename);
+          result = curlx_dyn_addf(&sshp->readdir_link, "%s%s", sshp->path,
+                                  sshp->readdir_filename);
           state(data, SSH_SFTP_READDIR_LINK);
         }
         else {
@@ -2440,18 +2440,19 @@ static CURLcode ssh_statemachine(struct Curl_easy *data, bool *block)
     case SSH_SFTP_READDIR_LINK:
       rc =
         libssh2_sftp_symlink_ex(sshc->sftp_session,
-                                Curl_dyn_ptr(&sshp->readdir_link),
+                                curlx_dyn_ptr(&sshp->readdir_link),
                                 (unsigned int)
-                                  Curl_dyn_len(&sshp->readdir_link),
+                                curlx_dyn_len(&sshp->readdir_link),
                                 sshp->readdir_filename,
                                 CURL_PATH_MAX, LIBSSH2_SFTP_READLINK);
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
       }
-      Curl_dyn_free(&sshp->readdir_link);
+      curlx_dyn_free(&sshp->readdir_link);
 
       /* append filename and extra output */
-      result = Curl_dyn_addf(&sshp->readdir, " -> %s", sshp->readdir_filename);
+      result = curlx_dyn_addf(&sshp->readdir, " -> %s",
+                              sshp->readdir_filename);
 
       if(result) {
         state(data, SSH_SFTP_CLOSE);
@@ -2463,18 +2464,18 @@ static CURLcode ssh_statemachine(struct Curl_easy *data, bool *block)
       break;
 
     case SSH_SFTP_READDIR_BOTTOM:
-      result = Curl_dyn_addn(&sshp->readdir, "\n", 1);
+      result = curlx_dyn_addn(&sshp->readdir, "\n", 1);
       if(!result)
         result = Curl_client_write(data, CLIENTWRITE_BODY,
-                                   Curl_dyn_ptr(&sshp->readdir),
-                                   Curl_dyn_len(&sshp->readdir));
+                                   curlx_dyn_ptr(&sshp->readdir),
+                                   curlx_dyn_len(&sshp->readdir));
 
       if(result) {
-        Curl_dyn_free(&sshp->readdir);
+        curlx_dyn_free(&sshp->readdir);
         state(data, SSH_STOP);
       }
       else {
-        Curl_dyn_reset(&sshp->readdir);
+        curlx_dyn_reset(&sshp->readdir);
         state(data, SSH_SFTP_READDIR);
       }
       break;
@@ -2963,12 +2964,12 @@ static CURLcode ssh_block_statemach(struct Curl_easy *data,
 {
   struct ssh_conn *sshc = &conn->proto.sshc;
   CURLcode result = CURLE_OK;
-  struct curltime dis = Curl_now();
+  struct curltime dis = curlx_now();
 
   while((sshc->state != SSH_STOP) && !result) {
     bool block;
     timediff_t left = 1000;
-    struct curltime now = Curl_now();
+    struct curltime now = curlx_now();
 
     result = ssh_statemachine(data, &block);
     if(result)
@@ -2988,7 +2989,7 @@ static CURLcode ssh_block_statemach(struct Curl_easy *data,
         return CURLE_OPERATION_TIMEDOUT;
       }
     }
-    else if(Curl_timediff(now, dis) > 1000) {
+    else if(curlx_timediff(now, dis) > 1000) {
       /* disconnect timeout */
       failf(data, "Disconnect timed out");
       result = CURLE_OK;
@@ -3033,8 +3034,8 @@ static CURLcode ssh_setup_connection(struct Curl_easy *data,
   if(!ssh)
     return CURLE_OUT_OF_MEMORY;
 
-  Curl_dyn_init(&ssh->readdir, CURL_PATH_MAX * 2);
-  Curl_dyn_init(&ssh->readdir_link, CURL_PATH_MAX);
+  curlx_dyn_init(&ssh->readdir, CURL_PATH_MAX * 2);
+  curlx_dyn_init(&ssh->readdir_link, CURL_PATH_MAX);
 
   return CURLE_OK;
 }
@@ -3460,8 +3461,8 @@ static CURLcode ssh_done(struct Curl_easy *data, CURLcode status)
     result = status;
 
   Curl_safefree(sshp->path);
-  Curl_dyn_free(&sshp->readdir);
-  Curl_dyn_free(&sshp->readdir_link);
+  curlx_dyn_free(&sshp->readdir);
+  curlx_dyn_free(&sshp->readdir_link);
 
   if(Curl_pgrsDone(data))
     return CURLE_ABORTED_BY_CALLBACK;
index 2b81e569698ec2a3aa6db205d1c22cd766dd81ac..1bee2836a86b31c27d6a0fdf7aa678a1fb216546 100644 (file)
@@ -38,7 +38,7 @@
 #include "../speedcheck.h"
 #include "../select.h"
 #include "../multiif.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "../strdup.h"
 
 /* The last 3 #include files should be in this order */
@@ -998,7 +998,7 @@ static CURLcode wssh_block_statemach(struct Curl_easy *data,
   while((sshc->state != SSH_STOP) && !result) {
     bool block;
     timediff_t left = 1000;
-    struct curltime now = Curl_now();
+    struct curltime now = curlx_now();
 
     result = wssh_statemach_act(data, &block);
     if(result)
index 8d13312648e3321d4d34e30a15b712a60f133f69..17051ca069a98de90f8476fb2fc2dc98a5452b09 100644 (file)
@@ -55,7 +55,7 @@
 #include "../select.h"
 #include "../strcase.h"
 #include "../strdup.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "x509asn1.h"
 #include "../multiif.h"
 #include "../curl_printf.h"
@@ -426,7 +426,7 @@ CURLcode Curl_gtls_shared_creds_create(struct Curl_easy *data,
   }
 
   shared->refcount = 1;
-  shared->time = Curl_now();
+  shared->time = curlx_now();
   *pcreds = shared;
   return CURLE_OK;
 }
@@ -540,8 +540,8 @@ static bool gtls_shared_creds_expired(const struct Curl_easy *data,
                                       const struct gtls_shared_creds *sc)
 {
   const struct ssl_general_config *cfg = &data->set.general_ssl;
-  struct curltime now = Curl_now();
-  timediff_t elapsed_ms = Curl_timediff(now, sc->time);
+  struct curltime now = curlx_now();
+  timediff_t elapsed_ms = curlx_timediff(now, sc->time);
   timediff_t timeout_ms = cfg->ca_cache_timeout * (timediff_t)1000;
 
   if(timeout_ms < 0)
@@ -794,18 +794,18 @@ static CURLcode gtls_set_priority(struct Curl_cfilter *cf,
   CURLcode result = CURLE_OK;
   int rc;
 
-  Curl_dyn_init(&buf, 4096);
+  curlx_dyn_init(&buf, 4096);
 
 #ifdef USE_GNUTLS_SRP
   if(conn_config->username) {
     /* Only add SRP to the cipher list if SRP is requested. Otherwise
      * GnuTLS will disable TLS 1.3 support. */
-    result = Curl_dyn_add(&buf, priority);
+    result = curlx_dyn_add(&buf, priority);
     if(!result)
-      result = Curl_dyn_add(&buf, ":" GNUTLS_SRP);
+      result = curlx_dyn_add(&buf, ":" GNUTLS_SRP);
     if(result)
       goto out;
-    priority = Curl_dyn_ptr(&buf);
+    priority = curlx_dyn_ptr(&buf);
   }
 #endif
 
@@ -814,15 +814,15 @@ static CURLcode gtls_set_priority(struct Curl_cfilter *cf,
        (conn_config->cipher_list[0] == '-') ||
        (conn_config->cipher_list[0] == '!')) {
        /* add it to out own */
-      if(!Curl_dyn_len(&buf)) {  /* not added yet */
-        result = Curl_dyn_add(&buf, priority);
+      if(!curlx_dyn_len(&buf)) {  /* not added yet */
+        result = curlx_dyn_add(&buf, priority);
         if(result)
           goto out;
       }
-      result = Curl_dyn_addf(&buf, ":%s", conn_config->cipher_list);
+      result = curlx_dyn_addf(&buf, ":%s", conn_config->cipher_list);
       if(result)
         goto out;
-      priority = Curl_dyn_ptr(&buf);
+      priority = curlx_dyn_ptr(&buf);
     }
     else /* replace our own completely */
       priority = conn_config->cipher_list;
@@ -836,7 +836,7 @@ static CURLcode gtls_set_priority(struct Curl_cfilter *cf,
   }
 
 out:
-  Curl_dyn_free(&buf);
+  curlx_dyn_free(&buf);
   return result;
 }
 
index 7366813437b24aae0c5bbc38acefea3fb6a5fb9d..35af9db1398198cf3b5c9a918b7a0e123c784112 100644 (file)
@@ -30,7 +30,7 @@
 #ifdef USE_GNUTLS
 
 #include <gnutls/gnutls.h>
-#include "../timeval.h"
+#include "../curlx/timeval.h"
 
 #ifdef HAVE_GNUTLS_SRP
 /* the function exists */
index 90f1f463cd8397a6064e9076c02c8e186c0d6beb..e0baaff9ed82b6728c5e2808016d292971cfda8b 100644 (file)
@@ -62,7 +62,7 @@
 #include "../strcase.h"
 #include "hostcheck.h"
 #include "../multiif.h"
-#include "../strparse.h"
+#include "../curlx/strparse.h"
 #include "../strdup.h"
 #include "../strerror.h"
 #include "../curl_printf.h"
 static void ossl_provider_cleanup(struct Curl_easy *data);
 #endif
 
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 
 /* The last #include files should be: */
 #include "../curl_memory.h"
@@ -992,13 +992,13 @@ static CURLcode ossl_seed(struct Curl_easy *data)
     size_t len = sizeof(randb);
     size_t i, i_max;
     for(i = 0, i_max = len / sizeof(struct curltime); i < i_max; ++i) {
-      struct curltime tv = Curl_now();
+      struct curltime tv = curlx_now();
       Curl_wait_ms(1);
       tv.tv_sec *= (time_t)i + 1;
       tv.tv_usec *= (int)i + 2;
-      tv.tv_sec ^= ((Curl_now().tv_sec + (time_t)Curl_now().tv_usec) *
+      tv.tv_sec ^= ((curlx_now().tv_sec + (time_t)curlx_now().tv_usec) *
                     (time_t)(i + 3)) << 8;
-      tv.tv_usec ^= (int) ((Curl_now().tv_sec + (time_t)Curl_now().tv_usec) *
+      tv.tv_usec ^= (int) ((curlx_now().tv_sec + (time_t)curlx_now().tv_usec) *
                            (time_t)(i + 4)) << 16;
       memcpy(&randb[i * sizeof(struct curltime)], &tv,
              sizeof(struct curltime));
@@ -1774,11 +1774,11 @@ static CURLcode x509_name_oneline(X509_NAME *a, struct dynbuf *d)
   CURLcode result = CURLE_OUT_OF_MEMORY;
 
   if(bio_out) {
-    Curl_dyn_reset(d);
+    curlx_dyn_reset(d);
     rc = X509_NAME_print_ex(bio_out, a, 0, XN_FLAG_SEP_SPLUS_SPC);
     if(rc != -1) {
       BIO_get_mem_ptr(bio_out, &biomem);
-      result = Curl_dyn_addn(d, biomem->data, biomem->length);
+      result = curlx_dyn_addn(d, biomem->data, biomem->length);
       BIO_free(bio_out);
     }
   }
@@ -1992,16 +1992,16 @@ static CURLcode ossl_set_provider(struct Curl_easy *data, const char *iname)
     ossl_provider_cleanup(data);
     return CURLE_OK;
   }
-  if(Curl_str_until(&iname, &prov, MAX_PROVIDER_LEN, ':'))
+  if(curlx_str_until(&iname, &prov, MAX_PROVIDER_LEN, ':'))
     return CURLE_BAD_FUNCTION_ARGUMENT;
 
-  if(!Curl_str_single(&iname, ':'))
+  if(!curlx_str_single(&iname, ':'))
     /* there was a colon, get the propq until the end of string */
     propq = iname;
 
   /* we need the name in a buffer, null-terminated */
-  memcpy(name, Curl_str(&prov), Curl_strlen(&prov));
-  name[Curl_strlen(&prov)] = 0;
+  memcpy(name, curlx_str(&prov), curlx_strlen(&prov));
+  name[curlx_strlen(&prov)] = 0;
 
   if(!data->state.libctx) {
     OSSL_LIB_CTX *libctx = OSSL_LIB_CTX_new();
@@ -3479,8 +3479,8 @@ ossl_cached_x509_store_expired(const struct Curl_easy *data,
   if(cfg->ca_cache_timeout < 0)
     return FALSE;
   else {
-    struct curltime now = Curl_now();
-    timediff_t elapsed_ms = Curl_timediff(now, mb->time);
+    struct curltime now = curlx_now();
+    timediff_t elapsed_ms = curlx_timediff(now, mb->time);
     timediff_t timeout_ms = cfg->ca_cache_timeout * (timediff_t)1000;
 
     return elapsed_ms >= timeout_ms;
@@ -3562,7 +3562,7 @@ static void ossl_set_cached_x509_store(struct Curl_cfilter *cf,
       free(share->CAfile);
     }
 
-    share->time = Curl_now();
+    share->time = curlx_now();
     share->store = store;
     share->CAfile = CAfile;
   }
@@ -4023,7 +4023,7 @@ CURLcode Curl_ossl_ctx_init(struct ossl_ctx *octx,
         return CURLE_SSL_CONNECT_ERROR;
       }
       ech_config_len = 2 * strlen(b64);
-      result = Curl_base64_decode(b64, &ech_config, &ech_config_len);
+      result = curlx_base64_decode(b64, &ech_config, &ech_config_len);
       if(result || !ech_config) {
         infof(data, "ECH: cannot base64 decode ECHConfig from command line");
         if(data->set.tls_ech & CURLECH_HARD)
@@ -4312,7 +4312,7 @@ static void ossl_trace_ech_retry_configs(struct Curl_easy *data, SSL* ssl,
     char *b64str = NULL;
     size_t blen = 0;
 
-    result = Curl_base64_encode((const char *)rcs, rcl, &b64str, &blen);
+    result = curlx_base64_encode((const char *)rcs, rcl, &b64str, &blen);
     if(!result && b64str) {
       infof(data, "ECH: retry_configs %s", b64str);
       free(b64str);
@@ -4743,7 +4743,7 @@ CURLcode Curl_oss_check_peer_cert(struct Curl_cfilter *cf,
 
   DEBUGASSERT(octx);
 
-  Curl_dyn_init(&dname, MAX_CERT_NAME_LENGTH);
+  curlx_dyn_init(&dname, MAX_CERT_NAME_LENGTH);
 
   if(!mem) {
     failf(data,
@@ -4773,7 +4773,7 @@ CURLcode Curl_oss_check_peer_cert(struct Curl_cfilter *cf,
 
   result = x509_name_oneline(X509_get_subject_name(octx->server_cert),
                              &dname);
-  infof(data, " subject: %s", result ? "[NONE]" : Curl_dyn_ptr(&dname));
+  infof(data, " subject: %s", result ? "[NONE]" : curlx_dyn_ptr(&dname));
 
 #ifndef CURL_DISABLE_VERBOSE_STRINGS
   {
@@ -4798,7 +4798,7 @@ CURLcode Curl_oss_check_peer_cert(struct Curl_cfilter *cf,
     if(result) {
       X509_free(octx->server_cert);
       octx->server_cert = NULL;
-      Curl_dyn_free(&dname);
+      curlx_dyn_free(&dname);
       return result;
     }
   }
@@ -4811,8 +4811,8 @@ CURLcode Curl_oss_check_peer_cert(struct Curl_cfilter *cf,
     result = CURLE_PEER_FAILED_VERIFICATION;
   }
   else {
-    infof(data, " issuer: %s", Curl_dyn_ptr(&dname));
-    Curl_dyn_free(&dname);
+    infof(data, " issuer: %s", curlx_dyn_ptr(&dname));
+    curlx_dyn_free(&dname);
 
     /* We could do all sorts of certificate verification stuff here before
        deallocating the certificate. */
@@ -5395,10 +5395,10 @@ static CURLcode ossl_get_channel_binding(struct Curl_easy *data, int sockindex,
   }
 
   /* Append "tls-server-end-point:" */
-  if(Curl_dyn_addn(binding, prefix, sizeof(prefix) - 1) != CURLE_OK)
+  if(curlx_dyn_addn(binding, prefix, sizeof(prefix) - 1) != CURLE_OK)
     return CURLE_OUT_OF_MEMORY;
   /* Append digest */
-  if(Curl_dyn_addn(binding, buf, length))
+  if(curlx_dyn_addn(binding, buf, length))
     return CURLE_OUT_OF_MEMORY;
 
   return CURLE_OK;
index 7835a8dd0d195a30da39d90cef5bf966b2ad41fa..3c4a2752deb9e796f71f6b5b769d69953f4a9cab 100644 (file)
@@ -417,7 +417,7 @@ read_file_into(const char *filename,
     uint8_t buf[256];
     const size_t rr = fread(buf, 1, sizeof(buf), f);
     if(rr == 0 ||
-       CURLE_OK != Curl_dyn_addn(out, buf, rr)) {
+       CURLE_OK != curlx_dyn_addn(out, buf, rr)) {
       fclose(f);
       return 0;
     }
@@ -692,7 +692,7 @@ init_config_builder_verifier_crl(
   struct dynbuf crl_contents;
   rustls_result rr;
 
-  Curl_dyn_init(&crl_contents, DYN_CRLFILE_SIZE);
+  curlx_dyn_init(&crl_contents, DYN_CRLFILE_SIZE);
   if(!read_file_into(conn_config->CRLfile, &crl_contents)) {
     failf(data, "rustls: failed to read revocation list file");
     result = CURLE_SSL_CRL_BADFILE;
@@ -701,8 +701,8 @@ init_config_builder_verifier_crl(
 
   rr = rustls_web_pki_server_cert_verifier_builder_add_crl(
     builder,
-    Curl_dyn_uptr(&crl_contents),
-    Curl_dyn_len(&crl_contents));
+    curlx_dyn_uptr(&crl_contents),
+    curlx_dyn_len(&crl_contents));
   if(rr != RUSTLS_RESULT_OK) {
     rustls_failf(data, rr, "failed to parse revocation list");
     result = CURLE_SSL_CRL_BADFILE;
@@ -710,7 +710,7 @@ init_config_builder_verifier_crl(
   }
 
 cleanup:
-  Curl_dyn_free(&crl_contents);
+  curlx_dyn_free(&crl_contents);
   return result;
 }
 
@@ -868,8 +868,8 @@ init_config_builder_client_auth(struct Curl_easy *data,
     return CURLE_SSL_CERTPROBLEM;
   }
 
-  Curl_dyn_init(&cert_contents, DYN_CERTFILE_SIZE);
-  Curl_dyn_init(&key_contents, DYN_KEYFILE_SIZE);
+  curlx_dyn_init(&cert_contents, DYN_CERTFILE_SIZE);
+  curlx_dyn_init(&key_contents, DYN_KEYFILE_SIZE);
 
   if(!read_file_into(conn_config->clientcert, &cert_contents)) {
     failf(data, "rustls: failed to read client certificate file: '%s'",
@@ -884,10 +884,10 @@ init_config_builder_client_auth(struct Curl_easy *data,
     goto cleanup;
   }
 
-  rr = rustls_certified_key_build(Curl_dyn_uptr(&cert_contents),
-                                  Curl_dyn_len(&cert_contents),
-                                  Curl_dyn_uptr(&key_contents),
-                                  Curl_dyn_len(&key_contents),
+  rr = rustls_certified_key_build(curlx_dyn_uptr(&cert_contents),
+                                  curlx_dyn_len(&cert_contents),
+                                  curlx_dyn_uptr(&key_contents),
+                                  curlx_dyn_len(&key_contents),
                                   &certified_key);
   if(rr != RUSTLS_RESULT_OK) {
     rustls_failf(data, rr, "rustls: failed to build certified key");
@@ -915,8 +915,8 @@ init_config_builder_client_auth(struct Curl_easy *data,
   }
 
 cleanup:
-  Curl_dyn_free(&cert_contents);
-  Curl_dyn_free(&key_contents);
+  curlx_dyn_free(&cert_contents);
+  curlx_dyn_free(&key_contents);
   if(certified_key) {
     rustls_certified_key_free(certified_key);
   }
@@ -970,7 +970,7 @@ init_config_builder_ech(struct Curl_easy *data,
       goto cleanup;
     }
     /* rustls-ffi expects the raw TLS encoded ECHConfigList bytes */
-    decode_result = Curl_base64_decode(b64, &ech_config, &ech_config_len);
+    decode_result = curlx_base64_decode(b64, &ech_config, &ech_config_len);
     if(decode_result || !ech_config) {
       infof(data, "rustls: cannot base64 decode ECHConfig from command line");
       result = CURLE_SSL_CONNECT_ERROR;
index a5630687575ff685b2b44532eea822703955a530..d968516c0d64f4567a52d25b10ed496bd2fa9db8 100644 (file)
 #include "../select.h" /* for the socket readiness */
 #include "../inet_pton.h" /* for IP addr SNI check */
 #include "../curl_multibyte.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "x509asn1.h"
 #include "../curl_printf.h"
 #include "../multiif.h"
 #include "../system_win32.h"
 #include "../version_win32.h"
 #include "../rand.h"
-#include "../strparse.h"
+#include "../curlx/strparse.h"
 
 /* The last #include file should be: */
 #include "../curl_memory.h"
@@ -381,7 +381,7 @@ set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers,
   int algCount = 0;
   while(startCur && (0 != *startCur) && (algCount < NUM_CIPHERS)) {
     curl_off_t alg;
-    if(Curl_str_number(&startCur, &alg, INT_MAX) || !alg)
+    if(curlx_str_number(&startCur, &alg, INT_MAX) || !alg)
       alg = get_alg_id_by_name(startCur);
 
     if(alg)
@@ -2632,8 +2632,8 @@ HCERTSTORE Curl_schannel_get_cached_cert_store(struct Curl_cfilter *cf,
      negative timeout means retain forever. */
   timeout_ms = cfg->ca_cache_timeout * (timediff_t)1000;
   if(timeout_ms >= 0) {
-    now = Curl_now();
-    elapsed_ms = Curl_timediff(now, share->time);
+    now = curlx_now();
+    elapsed_ms = curlx_timediff(now, share->time);
     if(elapsed_ms >= timeout_ms) {
       return NULL;
     }
@@ -2732,7 +2732,7 @@ bool Curl_schannel_set_cached_cert_store(struct Curl_cfilter *cf,
   }
   free(share->CAfile);
 
-  share->time = Curl_now();
+  share->time = curlx_now();
   share->cert_store = cert_store;
   share->CAinfo_blob_size = CAinfo_blob_size;
   share->CAfile = CAfile;
index 3e491adf3748564438f113fc91e2e449f468a706..12aa2f2a91ae6c545019e2c038159b1073a9f6b6 100644 (file)
@@ -33,8 +33,8 @@
 #ifdef USE_SECTRANSP
 
 #include "../urldata.h" /* for the Curl_easy definition */
-#include "../curl_base64.h"
-#include "../strparse.h"
+#include "../curlx/base64.h"
+#include "../curlx/strparse.h"
 #include "../multiif.h"
 #include "../strcase.h"
 #include "x509asn1.h"
@@ -352,9 +352,9 @@ CF_INLINE void GetDarwinVersionNumber(int *major, int *minor)
       curl_off_t fnum;
       curl_off_t snum;
       /* Parse the version: */
-      if(!Curl_str_number(&os, &fnum, INT_MAX) &&
-         !Curl_str_single(&os, '.') &&
-         !Curl_str_number(&os, &snum, INT_MAX)) {
+      if(!curlx_str_number(&os, &fnum, INT_MAX) &&
+         !curlx_str_single(&os, '.') &&
+         !curlx_str_number(&os, &snum, INT_MAX)) {
         *major = (int)fnum;
         *minor = (int)snum;
       }
@@ -1435,7 +1435,7 @@ static long pem_to_der(const char *in, unsigned char **out, size_t *outlen)
   }
   b64[j] = '\0';
 
-  err = Curl_base64_decode((const char *)b64, out, outlen);
+  err = curlx_base64_decode((const char *)b64, out, outlen);
   free(b64);
   if(err) {
     free(*out);
@@ -1454,7 +1454,7 @@ static int read_cert(const char *file, unsigned char **out, size_t *outlen)
   unsigned char buf[512];
   struct dynbuf certs;
 
-  Curl_dyn_init(&certs, MAX_CERTS_SIZE);
+  curlx_dyn_init(&certs, MAX_CERTS_SIZE);
 
   fd = open(file, 0);
   if(fd < 0)
@@ -1466,18 +1466,18 @@ static int read_cert(const char *file, unsigned char **out, size_t *outlen)
       break;
     if(n < 0) {
       close(fd);
-      Curl_dyn_free(&certs);
+      curlx_dyn_free(&certs);
       return -1;
     }
-    if(Curl_dyn_addn(&certs, buf, n)) {
+    if(curlx_dyn_addn(&certs, buf, n)) {
       close(fd);
       return -1;
     }
   }
   close(fd);
 
-  *out = Curl_dyn_uptr(&certs);
-  *outlen = Curl_dyn_len(&certs);
+  *out = curlx_dyn_uptr(&certs);
+  *outlen = curlx_dyn_len(&certs);
 
   return 0;
 }
index 80b3759e4300d680c92fe43464ecc4947177e037..fa2b0fe92b5799ff970a08202fbcaa82f303d6a0 100644 (file)
 #include "../progress.h"
 #include "../share.h"
 #include "../multiif.h"
-#include "../timeval.h"
+#include "../curlx/timeval.h"
 #include "../curl_md5.h"
 #include "../curl_sha256.h"
-#include "../warnless.h"
-#include "../curl_base64.h"
+#include "../curlx/warnless.h"
+#include "../curlx/base64.h"
 #include "../curl_printf.h"
 #include "../inet_pton.h"
 #include "../connect.h"
@@ -616,17 +616,17 @@ CURLcode Curl_ssl_push_certinfo_len(struct Curl_easy *data,
 
   DEBUGASSERT(certnum < ci->num_of_certs);
 
-  Curl_dyn_init(&build, CURL_X509_STR_MAX);
+  curlx_dyn_init(&build, CURL_X509_STR_MAX);
 
-  if(Curl_dyn_add(&build, label) ||
-     Curl_dyn_addn(&build, ":", 1) ||
-     Curl_dyn_addn(&build, value, valuelen))
+  if(curlx_dyn_add(&build, label) ||
+     curlx_dyn_addn(&build, ":", 1) ||
+     curlx_dyn_addn(&build, value, valuelen))
     return CURLE_OUT_OF_MEMORY;
 
   nl = Curl_slist_append_nodup(ci->certinfo[certnum],
-                               Curl_dyn_ptr(&build));
+                               curlx_dyn_ptr(&build));
   if(!nl) {
-    Curl_dyn_free(&build);
+    curlx_dyn_free(&build);
     curl_slist_free_all(ci->certinfo[certnum]);
     result = CURLE_OUT_OF_MEMORY;
   }
@@ -663,7 +663,7 @@ static CURLcode pubkey_pem_to_der(const char *pem,
   if(!pem)
     return CURLE_BAD_CONTENT_ENCODING;
 
-  Curl_dyn_init(&pbuf, MAX_PINNED_PUBKEY_SIZE);
+  curlx_dyn_init(&pbuf, MAX_PINNED_PUBKEY_SIZE);
 
   begin_pos = strstr(pem, "-----BEGIN PUBLIC KEY-----");
   if(!begin_pos)
@@ -691,16 +691,16 @@ static CURLcode pubkey_pem_to_der(const char *pem,
    */
   while(pem_count < pem_len) {
     if('\n' != pem[pem_count] && '\r' != pem[pem_count]) {
-      result = Curl_dyn_addn(&pbuf, &pem[pem_count], 1);
+      result = curlx_dyn_addn(&pbuf, &pem[pem_count], 1);
       if(result)
         return result;
     }
     ++pem_count;
   }
 
-  result = Curl_base64_decode(Curl_dyn_ptr(&pbuf), der, der_len);
+  result = curlx_base64_decode(curlx_dyn_ptr(&pbuf), der, der_len);
 
-  Curl_dyn_free(&pbuf);
+  curlx_dyn_free(&pbuf);
 
   return result;
 }
@@ -744,9 +744,9 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data,
                                  sha256sumdigest, CURL_SHA256_DIGEST_LENGTH);
 
     if(!encode)
-      encode = Curl_base64_encode((char *)sha256sumdigest,
-                                  CURL_SHA256_DIGEST_LENGTH, &encoded,
-                                  &encodedlen);
+      encode = curlx_base64_encode((char *)sha256sumdigest,
+                                   CURL_SHA256_DIGEST_LENGTH, &encoded,
+                                   &encodedlen);
     Curl_safefree(sha256sumdigest);
 
     if(encode)
@@ -801,7 +801,7 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data,
     if(!fp)
       return result;
 
-    Curl_dyn_init(&buf, MAX_PINNED_PUBKEY_SIZE);
+    curlx_dyn_init(&buf, MAX_PINNED_PUBKEY_SIZE);
 
     /* Determine the file's size */
     if(fseek(fp, 0, SEEK_END))
@@ -829,14 +829,14 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data,
       size_t want = left > sizeof(buffer) ? sizeof(buffer) : left;
       if(want != fread(buffer, 1, want, fp))
         goto end;
-      if(Curl_dyn_addn(&buf, buffer, want))
+      if(curlx_dyn_addn(&buf, buffer, want))
         goto end;
       left -= want;
     } while(left);
 
     /* If the sizes are the same, it cannot be base64 encoded, must be der */
     if(pubkeylen == size) {
-      if(!memcmp(pubkey, Curl_dyn_ptr(&buf), pubkeylen))
+      if(!memcmp(pubkey, curlx_dyn_ptr(&buf), pubkeylen))
         result = CURLE_OK;
       goto end;
     }
@@ -845,7 +845,7 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data,
      * Otherwise we will assume it is PEM and try to decode it
      * after placing null terminator
      */
-    pem_read = pubkey_pem_to_der(Curl_dyn_ptr(&buf), &pem_ptr, &pem_len);
+    pem_read = pubkey_pem_to_der(curlx_dyn_ptr(&buf), &pem_ptr, &pem_len);
     /* if it was not read successfully, exit */
     if(pem_read)
       goto end;
@@ -857,7 +857,7 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data,
     if(pubkeylen == pem_len && !memcmp(pubkey, pem_ptr, pubkeylen))
       result = CURLE_OK;
 end:
-    Curl_dyn_free(&buf);
+    curlx_dyn_free(&buf);
     Curl_safefree(pem_ptr);
     fclose(fp);
   }
@@ -1351,7 +1351,7 @@ static CURLcode ssl_cf_connect(struct Curl_cfilter *cf,
   if(!result && *done) {
     cf->connected = TRUE;
     if(connssl->state == ssl_connection_complete)
-      connssl->handshake_done = Curl_now();
+      connssl->handshake_done = curlx_now();
     /* Connection can be deferred when sending early data */
     DEBUGASSERT(connssl->state == ssl_connection_complete ||
                 connssl->state == ssl_connection_deferred);
index a52d96fffa1162b800f876ae9c946a5abaf26c61..0bb333b987a3c3d6e1d4f5278307e0c5fc8ef0b8 100644 (file)
@@ -45,7 +45,7 @@ struct dynbuf;
 #define SSLSUPP_SIGNATURE_ALGORITHMS (1<<10) /* supports TLS sigalgs */
 
 #ifdef USE_ECH
-# include "../curl_base64.h"
+# include "../curlx/base64.h"
 # define ECH_ENABLED(__data__) \
     (__data__->set.tls_ech && \
      !(__data__->set.tls_ech & CURLECH_DISABLE)\
index 2d8e30c41bf8787b2cfe2b2cdcaeb564f26d8d98..8d3517cac8fee53e11b5cf983b3748c420eb9a7c 100644 (file)
@@ -51,7 +51,7 @@
 #include "../curl_trc.h"
 #include "../curl_sha256.h"
 #include "../rand.h"
-#include "../warnless.h"
+#include "../curlx/warnless.h"
 #include "../curl_printf.h"
 #include "../strdup.h"
 
@@ -387,24 +387,24 @@ static CURLcode cf_ssl_peer_key_add_path(struct dynbuf *buf,
      * the path as is. */
 #ifdef UNDER_CE
     (void)is_local;
-    return Curl_dyn_addf(buf, ":%s-%s", name, path);
+    return curlx_dyn_addf(buf, ":%s-%s", name, path);
 #elif defined(_WIN32)
     char abspath[_MAX_PATH];
     if(_fullpath(abspath, path, _MAX_PATH))
-      return Curl_dyn_addf(buf, ":%s-%s", name, abspath);
+      return curlx_dyn_addf(buf, ":%s-%s", name, abspath);
     *is_local = TRUE;
 #elif defined(HAVE_REALPATH)
     if(path[0] != '/') {
       char *abspath = realpath(path, NULL);
       if(abspath) {
-        CURLcode r = Curl_dyn_addf(buf, ":%s-%s", name, abspath);
+        CURLcode r = curlx_dyn_addf(buf, ":%s-%s", name, abspath);
         (free)(abspath); /* allocated by libc, free without memdebug */
         return r;
       }
       *is_local = TRUE;
     }
 #endif
-    return Curl_dyn_addf(buf, ":%s-%s", name, path);
+    return curlx_dyn_addf(buf, ":%s-%s", name, path);
   }
   return CURLE_OK;
 }
@@ -418,14 +418,14 @@ static CURLcode cf_ssl_peer_key_add_hash(struct dynbuf *buf,
     unsigned char hash[CURL_SHA256_DIGEST_LENGTH];
     size_t i;
 
-    r = Curl_dyn_addf(buf, ":%s-", name);
+    r = curlx_dyn_addf(buf, ":%s-", name);
     if(r)
       goto out;
     r = Curl_sha256it(hash, blob->data, blob->len);
     if(r)
       goto out;
     for(i = 0; i < CURL_SHA256_DIGEST_LENGTH; ++i) {
-      r = Curl_dyn_addf(buf, "%02x", hash[i]);
+      r = curlx_dyn_addf(buf, "%02x", hash[i]);
       if(r)
         goto out;
     }
@@ -457,9 +457,9 @@ CURLcode Curl_ssl_peer_key_make(struct Curl_cfilter *cf,
   CURLcode r;
 
   *ppeer_key = NULL;
-  Curl_dyn_init(&buf, 10 * 1024);
+  curlx_dyn_init(&buf, 10 * 1024);
 
-  r = Curl_dyn_addf(&buf, "%s:%d", peer->hostname, peer->port);
+  r = curlx_dyn_addf(&buf, "%s:%d", peer->hostname, peer->port);
   if(r)
     goto out;
 
@@ -467,72 +467,72 @@ CURLcode Curl_ssl_peer_key_make(struct Curl_cfilter *cf,
   case TRNSPRT_TCP:
     break;
   case TRNSPRT_UDP:
-    r = Curl_dyn_add(&buf, ":UDP");
+    r = curlx_dyn_add(&buf, ":UDP");
     break;
   case TRNSPRT_QUIC:
-    r = Curl_dyn_add(&buf, ":QUIC");
+    r = curlx_dyn_add(&buf, ":QUIC");
     break;
   case TRNSPRT_UNIX:
-    r = Curl_dyn_add(&buf, ":UNIX");
+    r = curlx_dyn_add(&buf, ":UNIX");
     break;
   default:
-    r = Curl_dyn_addf(&buf, ":TRNSPRT-%d", peer->transport);
+    r = curlx_dyn_addf(&buf, ":TRNSPRT-%d", peer->transport);
     break;
   }
   if(r)
     goto out;
 
   if(!ssl->verifypeer) {
-    r = Curl_dyn_add(&buf, ":NO-VRFY-PEER");
+    r = curlx_dyn_add(&buf, ":NO-VRFY-PEER");
     if(r)
       goto out;
   }
   if(!ssl->verifyhost) {
-    r = Curl_dyn_add(&buf, ":NO-VRFY-HOST");
+    r = curlx_dyn_add(&buf, ":NO-VRFY-HOST");
     if(r)
       goto out;
   }
   if(ssl->verifystatus) {
-    r = Curl_dyn_add(&buf, ":VRFY-STATUS");
+    r = curlx_dyn_add(&buf, ":VRFY-STATUS");
     if(r)
       goto out;
   }
   if(!ssl->verifypeer || !ssl->verifyhost) {
     if(cf->conn->bits.conn_to_host) {
-      r = Curl_dyn_addf(&buf, ":CHOST-%s", cf->conn->conn_to_host.name);
+      r = curlx_dyn_addf(&buf, ":CHOST-%s", cf->conn->conn_to_host.name);
       if(r)
         goto out;
     }
     if(cf->conn->bits.conn_to_port) {
-      r = Curl_dyn_addf(&buf, ":CPORT-%d", cf->conn->conn_to_port);
+      r = curlx_dyn_addf(&buf, ":CPORT-%d", cf->conn->conn_to_port);
       if(r)
         goto out;
     }
   }
 
   if(ssl->version || ssl->version_max) {
-    r = Curl_dyn_addf(&buf, ":TLSVER-%d-%d", ssl->version,
+    r = curlx_dyn_addf(&buf, ":TLSVER-%d-%d", ssl->version,
                       (ssl->version_max >> 16));
     if(r)
       goto out;
   }
   if(ssl->ssl_options) {
-    r = Curl_dyn_addf(&buf, ":TLSOPT-%x", ssl->ssl_options);
+    r = curlx_dyn_addf(&buf, ":TLSOPT-%x", ssl->ssl_options);
     if(r)
       goto out;
   }
   if(ssl->cipher_list) {
-    r = Curl_dyn_addf(&buf, ":CIPHER-%s", ssl->cipher_list);
+    r = curlx_dyn_addf(&buf, ":CIPHER-%s", ssl->cipher_list);
     if(r)
       goto out;
   }
   if(ssl->cipher_list13) {
-    r = Curl_dyn_addf(&buf, ":CIPHER13-%s", ssl->cipher_list13);
+    r = curlx_dyn_addf(&buf, ":CIPHER13-%s", ssl->cipher_list13);
     if(r)
       goto out;
   }
   if(ssl->curves) {
-    r = Curl_dyn_addf(&buf, ":CURVES-%s", ssl->curves);
+    r = curlx_dyn_addf(&buf, ":CURVES-%s", ssl->curves);
     if(r)
       goto out;
   }
@@ -566,19 +566,19 @@ CURLcode Curl_ssl_peer_key_make(struct Curl_cfilter *cf,
     }
   }
   if(ssl->pinned_key && ssl->pinned_key[0]) {
-    r = Curl_dyn_addf(&buf, ":Pinned-%s", ssl->pinned_key);
+    r = curlx_dyn_addf(&buf, ":Pinned-%s", ssl->pinned_key);
     if(r)
       goto out;
   }
 
   if(ssl->clientcert && ssl->clientcert[0]) {
-    r = Curl_dyn_add(&buf, ":CCERT");
+    r = curlx_dyn_add(&buf, ":CCERT");
     if(r)
       goto out;
   }
 #ifdef USE_TLS_SRP
   if(ssl->username || ssl->password) {
-    r = Curl_dyn_add(&buf, ":SRP-AUTH");
+    r = curlx_dyn_add(&buf, ":SRP-AUTH");
     if(r)
       goto out;
   }
@@ -588,22 +588,22 @@ CURLcode Curl_ssl_peer_key_make(struct Curl_cfilter *cf,
     r = CURLE_FAILED_INIT;
     goto out;
   }
-  r = Curl_dyn_addf(&buf, ":IMPL-%s", tls_id);
+  r = curlx_dyn_addf(&buf, ":IMPL-%s", tls_id);
   if(r)
     goto out;
 
-  r = Curl_dyn_addf(&buf, is_local ?
-                    CURL_SSLS_LOCAL_SUFFIX : CURL_SSLS_GLOBAL_SUFFIX);
+  r = curlx_dyn_addf(&buf, is_local ?
+                     CURL_SSLS_LOCAL_SUFFIX : CURL_SSLS_GLOBAL_SUFFIX);
   if(r)
     goto out;
 
-  *ppeer_key = Curl_dyn_take(&buf, &key_len);
+  *ppeer_key = curlx_dyn_take(&buf, &key_len);
   /* we just added printable char, and dynbuf always 0 terminates,
    * no need to track length */
 
 
 out:
-  Curl_dyn_free(&buf);
+  curlx_dyn_free(&buf);
   return r;
 }
 
@@ -1173,8 +1173,8 @@ CURLcode Curl_ssl_session_export(struct Curl_easy *data,
 
   Curl_ssl_scache_lock(data);
 
-  Curl_dyn_init(&hbuf, (CURL_SHA256_DIGEST_LENGTH * 2) + 1);
-  Curl_dyn_init(&sbuf, CURL_SSL_TICKET_MAX);
+  curlx_dyn_init(&hbuf, (CURL_SHA256_DIGEST_LENGTH * 2) + 1);
+  curlx_dyn_init(&sbuf, CURL_SSL_TICKET_MAX);
 
   for(i = 0; scache && i < scache->peer_count; i++) {
     peer = &scache->peers[i];
@@ -1183,7 +1183,7 @@ CURLcode Curl_ssl_session_export(struct Curl_easy *data,
     if(!peer->exportable)
       continue;
 
-    Curl_dyn_reset(&hbuf);
+    curlx_dyn_reset(&hbuf);
     cf_scache_peer_remove_expired(peer, now);
     n = Curl_llist_head(&peer->sessions);
     if(n)
@@ -1195,22 +1195,22 @@ CURLcode Curl_ssl_session_export(struct Curl_easy *data,
         if(r)
           goto out;
       }
-      if(!Curl_dyn_len(&hbuf)) {
-        r = Curl_dyn_addn(&hbuf, peer->key_salt, sizeof(peer->key_salt));
+      if(!curlx_dyn_len(&hbuf)) {
+        r = curlx_dyn_addn(&hbuf, peer->key_salt, sizeof(peer->key_salt));
         if(r)
           goto out;
-        r = Curl_dyn_addn(&hbuf, peer->key_hmac, sizeof(peer->key_hmac));
+        r = curlx_dyn_addn(&hbuf, peer->key_hmac, sizeof(peer->key_hmac));
         if(r)
           goto out;
       }
-      Curl_dyn_reset(&sbuf);
+      curlx_dyn_reset(&sbuf);
       r = Curl_ssl_session_pack(data, s, &sbuf);
       if(r)
         goto out;
 
       r = export_fn(data, userptr, peer->ssl_peer_key,
-                    Curl_dyn_uptr(&hbuf), Curl_dyn_len(&hbuf),
-                    Curl_dyn_uptr(&sbuf), Curl_dyn_len(&sbuf),
+                    curlx_dyn_uptr(&hbuf), curlx_dyn_len(&hbuf),
+                    curlx_dyn_uptr(&sbuf), curlx_dyn_len(&sbuf),
                     s->valid_until, s->ietf_tls_id,
                     s->alpn, s->earlydata_max);
       if(r)
@@ -1226,8 +1226,8 @@ CURLcode Curl_ssl_session_export(struct Curl_easy *data,
 
 out:
   Curl_ssl_scache_unlock(data);
-  Curl_dyn_free(&hbuf);
-  Curl_dyn_free(&sbuf);
+  curlx_dyn_free(&hbuf);
+  curlx_dyn_free(&sbuf);
   return r;
 }
 
index e49be6d6b20443113b6f45f1aedf493d9a7a1159..152fad7eb303dabc7d1a924ab909388eae7ad807 100644 (file)
@@ -64,7 +64,7 @@ typedef unsigned __int64 uint64_t;
 
 static CURLcode spack_enc8(struct dynbuf *buf, uint8_t b)
 {
-  return Curl_dyn_addn(buf, &b, 1);
+  return curlx_dyn_addn(buf, &b, 1);
 }
 
 static CURLcode
@@ -82,7 +82,7 @@ static CURLcode spack_enc16(struct dynbuf *buf, uint16_t val)
   uint8_t nval[2];
   nval[0] = (uint8_t)(val >> 8);
   nval[1] = (uint8_t)val;
-  return Curl_dyn_addn(buf, nval, sizeof(nval));
+  return curlx_dyn_addn(buf, nval, sizeof(nval));
 }
 
 static CURLcode
@@ -102,7 +102,7 @@ static CURLcode spack_enc32(struct dynbuf *buf, uint32_t val)
   nval[1] = (uint8_t)(val >> 16);
   nval[2] = (uint8_t)(val >> 8);
   nval[3] = (uint8_t)val;
-  return Curl_dyn_addn(buf, nval, sizeof(nval));
+  return curlx_dyn_addn(buf, nval, sizeof(nval));
 }
 
 static CURLcode
@@ -127,7 +127,7 @@ static CURLcode spack_enc64(struct dynbuf *buf, uint64_t val)
   nval[5] = (uint8_t)(val >> 16);
   nval[6] = (uint8_t)(val >> 8);
   nval[7] = (uint8_t)val;
-  return Curl_dyn_addn(buf, nval, sizeof(nval));
+  return curlx_dyn_addn(buf, nval, sizeof(nval));
 }
 
 static CURLcode
@@ -151,7 +151,7 @@ static CURLcode spack_encstr16(struct dynbuf *buf, const char *s)
     return CURLE_BAD_FUNCTION_ARGUMENT;
   r = spack_enc16(buf, (uint16_t)slen);
   if(!r) {
-    r = Curl_dyn_addn(buf, s, slen);
+    r = curlx_dyn_addn(buf, s, slen);
   }
   return r;
 }
@@ -181,7 +181,7 @@ static CURLcode spack_encdata16(struct dynbuf *buf,
     return CURLE_BAD_FUNCTION_ARGUMENT;
   r = spack_enc16(buf, (uint16_t)data_len);
   if(!r) {
-    r = Curl_dyn_addn(buf, data, data_len);
+    r = curlx_dyn_addn(buf, data, data_len);
   }
   return r;
 }
index 006a17c4630b4efaf61e1f9ca415437dc886cf24..ab7ab46dbd936c9f6e40f71606502a65329495fe 100644 (file)
@@ -714,8 +714,8 @@ wssl_cached_x509_store_expired(const struct Curl_easy *data,
                                const struct wssl_x509_share *mb)
 {
   const struct ssl_general_config *cfg = &data->set.general_ssl;
-  struct curltime now = Curl_now();
-  timediff_t elapsed_ms = Curl_timediff(now, mb->time);
+  struct curltime now = curlx_now();
+  timediff_t elapsed_ms = curlx_timediff(now, mb->time);
   timediff_t timeout_ms = cfg->ca_cache_timeout * (timediff_t)1000;
 
   if(timeout_ms < 0)
@@ -799,7 +799,7 @@ static void wssl_set_cached_x509_store(struct Curl_cfilter *cf,
       free(share->CAfile);
     }
 
-    share->time = Curl_now();
+    share->time = curlx_now();
     share->store = store;
     share->CAfile = CAfile;
   }
@@ -871,14 +871,14 @@ wssl_add_default_ciphers(bool tls13, struct dynbuf *buf)
       continue;
 
     /* if there already is data in the string, add colon separator */
-    if(Curl_dyn_len(buf)) {
-      CURLcode result = Curl_dyn_addn(buf, ":", 1);
+    if(curlx_dyn_len(buf)) {
+      CURLcode result = curlx_dyn_addn(buf, ":", 1);
       if(result)
         return result;
     }
 
     n = strlen(str);
-    if(Curl_dyn_addn(buf, str, n))
+    if(curlx_dyn_addn(buf, str, n))
       return CURLE_OUT_OF_MEMORY;
   }
 
@@ -1067,19 +1067,19 @@ CURLcode Curl_wssl_ctx_init(struct wssl_ctx *wctx,
     const char *ciphers12 = conn_config->cipher_list;
     const char *ciphers13 = conn_config->cipher_list13;
     struct dynbuf c;
-    Curl_dyn_init(&c, MAX_CIPHER_LEN);
+    curlx_dyn_init(&c, MAX_CIPHER_LEN);
 
     if(ciphers13)
-      result = Curl_dyn_add(&c, ciphers13);
+      result = curlx_dyn_add(&c, ciphers13);
     else
       result = wssl_add_default_ciphers(TRUE, &c);
 
     if(!result) {
       if(ciphers12) {
-        if(Curl_dyn_len(&c))
-          result = Curl_dyn_addn(&c, ":", 1);
+        if(curlx_dyn_len(&c))
+          result = curlx_dyn_addn(&c, ":", 1);
         if(!result)
-          result = Curl_dyn_add(&c, ciphers12);
+          result = curlx_dyn_add(&c, ciphers12);
       }
       else
         result = wssl_add_default_ciphers(FALSE, &c);
@@ -1087,14 +1087,14 @@ CURLcode Curl_wssl_ctx_init(struct wssl_ctx *wctx,
     if(result)
       goto out;
 
-    if(!wolfSSL_CTX_set_cipher_list(wctx->ssl_ctx, Curl_dyn_ptr(&c))) {
-      failf(data, "failed setting cipher list: %s", Curl_dyn_ptr(&c));
-      Curl_dyn_free(&c);
+    if(!wolfSSL_CTX_set_cipher_list(wctx->ssl_ctx, curlx_dyn_ptr(&c))) {
+      failf(data, "failed setting cipher list: %s", curlx_dyn_ptr(&c));
+      curlx_dyn_free(&c);
       result = CURLE_SSL_CIPHER;
       goto out;
     }
-    infof(data, "Cipher selection: %s", Curl_dyn_ptr(&c));
-    Curl_dyn_free(&c);
+    infof(data, "Cipher selection: %s", curlx_dyn_ptr(&c));
+    curlx_dyn_free(&c);
   }
 #endif
 
@@ -1769,8 +1769,8 @@ static CURLcode wssl_handshake(struct Curl_cfilter *cf,
         char *b64str = NULL;
         size_t blen = 0;
 
-        result = Curl_base64_encode((const char *)echConfigs, echConfigsLen,
-                                    &b64str, &blen);
+        result = curlx_base64_encode((const char *)echConfigs, echConfigsLen,
+                                     &b64str, &blen);
         if(!result && b64str)
           infof(data, "ECH: (not yet) retry_configs %s", b64str);
         free(b64str);
index 09951529f7ab47178c993066430689c1271a64a6..7f9d332ecf476fbf0626ff6e1ceb162c15392d28 100644 (file)
@@ -47,9 +47,9 @@
 #include "vtls_int.h"
 #include "../sendf.h"
 #include "../inet_pton.h"
-#include "../curl_base64.h"
+#include "../curlx/base64.h"
 #include "x509asn1.h"
-#include "../dynbuf.h"
+#include "../curlx/dynbuf.h"
 
 /* The last 3 #include files should be in this order */
 #include "../curl_printf.h"
@@ -291,7 +291,7 @@ static CURLcode bool2str(struct dynbuf *store,
 {
   if(end - beg != 1)
     return CURLE_BAD_FUNCTION_ARGUMENT;
-  return Curl_dyn_add(store, *beg ? "TRUE": "FALSE");
+  return curlx_dyn_add(store, *beg ? "TRUE": "FALSE");
 }
 
 /*
@@ -305,7 +305,7 @@ static CURLcode octet2str(struct dynbuf *store,
   CURLcode result = CURLE_OK;
 
   while(!result && beg < end)
-    result = Curl_dyn_addf(store, "%02x:", (unsigned char) *beg++);
+    result = curlx_dyn_addf(store, "%02x:", (unsigned char) *beg++);
 
   return result;
 }
@@ -344,7 +344,7 @@ static CURLcode int2str(struct dynbuf *store,
   do
     val = (val << 8) | *(const unsigned char *) beg++;
   while(beg < end);
-  return Curl_dyn_addf(store, "%s%x", val >= 10 ? "0x" : "", val);
+  return curlx_dyn_addf(store, "%s%x", val >= 10 ? "0x" : "", val);
 }
 
 /*
@@ -387,7 +387,7 @@ utf8asn1str(struct dynbuf *to, int type, const char *from, const char *end)
   if(type == CURL_ASN1_UTF8_STRING) {
     /* Just copy. */
     if(inlength)
-      result = Curl_dyn_addn(to, from, inlength);
+      result = curlx_dyn_addn(to, from, inlength);
   }
   else {
     while(!result && (from < end)) {
@@ -426,7 +426,7 @@ utf8asn1str(struct dynbuf *to, int type, const char *from, const char *end)
         charsize++;
       }
       buf[0] = (char) wc;
-      result = Curl_dyn_addn(to, buf, charsize);
+      result = curlx_dyn_addn(to, buf, charsize);
     }
   }
   return result;
@@ -449,7 +449,7 @@ static CURLcode encodeOID(struct dynbuf *store,
   x = y / 40;
   y -= x * 40;
 
-  result = Curl_dyn_addf(store, "%u.%u", x, y);
+  result = curlx_dyn_addf(store, "%u.%u", x, y);
   if(result)
     return result;
 
@@ -462,7 +462,7 @@ static CURLcode encodeOID(struct dynbuf *store,
       y = *(const unsigned char *) beg++;
       x = (x << 7) | (y & 0x7F);
     } while(y & 0x80);
-    result = Curl_dyn_addf(store, ".%u", x);
+    result = curlx_dyn_addf(store, ".%u", x);
   }
   return result;
 }
@@ -480,16 +480,16 @@ static CURLcode OID2str(struct dynbuf *store,
   if(beg < end) {
     if(symbolic) {
       struct dynbuf buf;
-      Curl_dyn_init(&buf, CURL_X509_STR_MAX);
+      curlx_dyn_init(&buf, CURL_X509_STR_MAX);
       result = encodeOID(&buf, beg, end);
 
       if(!result) {
-        const struct Curl_OID *op = searchOID(Curl_dyn_ptr(&buf));
+        const struct Curl_OID *op = searchOID(curlx_dyn_ptr(&buf));
         if(op)
-          result = Curl_dyn_add(store, op->textoid);
+          result = curlx_dyn_add(store, op->textoid);
         else
-          result = Curl_dyn_add(store, Curl_dyn_ptr(&buf));
-        Curl_dyn_free(&buf);
+          result = curlx_dyn_add(store, curlx_dyn_ptr(&buf));
+        curlx_dyn_free(&buf);
       }
     }
     else
@@ -568,12 +568,12 @@ static CURLcode GTime2str(struct dynbuf *store,
     tzl = end - tzp;
   }
 
-  return Curl_dyn_addf(store,
-                       "%.4s-%.2s-%.2s %.2s:%.2s:%c%c%s%.*s%s%.*s",
-                       beg, beg + 4, beg + 6,
-                       beg + 8, beg + 10, sec1, sec2,
-                       fracl ? ".": "", (int)fracl, fracp,
-                       sep, (int)tzl, tzp);
+  return curlx_dyn_addf(store,
+                        "%.4s-%.2s-%.2s %.2s:%.2s:%c%c%s%.*s%s%.*s",
+                        beg, beg + 4, beg + 6,
+                        beg + 8, beg + 10, sec1, sec2,
+                        fracl ? ".": "", (int)fracl, fracp,
+                        sep, (int)tzl, tzp);
 }
 
 #ifdef UNITTESTS
@@ -622,10 +622,10 @@ static CURLcode UTime2str(struct dynbuf *store,
     tzp++;
 
   tzl = end - tzp;
-  return Curl_dyn_addf(store, "%u%.2s-%.2s-%.2s %.2s:%.2s:%.2s %.*s",
-                       20 - (*beg >= '5'), beg, beg + 2, beg + 4,
-                       beg + 6, beg + 8, sec,
-                       (int)tzl, tzp);
+  return curlx_dyn_addf(store, "%u%.2s-%.2s-%.2s %.2s:%.2s:%.2s %.*s",
+                        20 - (*beg >= '5'), beg, beg + 2, beg + 4,
+                        beg + 6, beg + 8, sec,
+                        (int)tzl, tzp);
 }
 
 /*
@@ -658,7 +658,7 @@ static CURLcode ASN1tostr(struct dynbuf *store,
     result = octet2str(store, elem->beg, elem->end);
     break;
   case CURL_ASN1_NULL:
-    result = Curl_dyn_addn(store, "", 1);
+    result = curlx_dyn_addn(store, "", 1);
     break;
   case CURL_ASN1_OBJECT_IDENTIFIER:
     result = OID2str(store, elem->beg, elem->end, TRUE);
@@ -702,7 +702,7 @@ static CURLcode encodeDN(struct dynbuf *store, struct Curl_asn1Element *dn)
   CURLcode result = CURLE_OK;
   bool added = FALSE;
   struct dynbuf temp;
-  Curl_dyn_init(&temp, CURL_X509_STR_MAX);
+  curlx_dyn_init(&temp, CURL_X509_STR_MAX);
 
   for(p1 = dn->beg; p1 < dn->end;) {
     p1 = getASN1Element(&rdn, p1, dn->end);
@@ -725,12 +725,12 @@ static CURLcode encodeDN(struct dynbuf *store, struct Curl_asn1Element *dn)
         result = CURLE_BAD_FUNCTION_ARGUMENT;
         goto error;
       }
-      Curl_dyn_reset(&temp);
+      curlx_dyn_reset(&temp);
       result = ASN1tostr(&temp, &oid, 0);
       if(result)
         goto error;
 
-      str = Curl_dyn_ptr(&temp);
+      str = curlx_dyn_ptr(&temp);
 
       if(!str) {
         result = CURLE_BAD_FUNCTION_ARGUMENT;
@@ -743,20 +743,20 @@ static CURLcode encodeDN(struct dynbuf *store, struct Curl_asn1Element *dn)
         ;
       if(added) {
         if(p3 - str > 2)
-          result = Curl_dyn_addn(store, "/", 1);
+          result = curlx_dyn_addn(store, "/", 1);
         else
-          result = Curl_dyn_addn(store, ", ", 2);
+          result = curlx_dyn_addn(store, ", ", 2);
         if(result)
           goto error;
       }
 
       /* Encode attribute name. */
-      result = Curl_dyn_add(store, str);
+      result = curlx_dyn_add(store, str);
       if(result)
         goto error;
 
       /* Generate equal sign. */
-      result = Curl_dyn_addn(store, "=", 1);
+      result = curlx_dyn_addn(store, "=", 1);
       if(result)
         goto error;
 
@@ -764,12 +764,12 @@ static CURLcode encodeDN(struct dynbuf *store, struct Curl_asn1Element *dn)
       result = ASN1tostr(store, &value, 0);
       if(result)
         goto error;
-      Curl_dyn_reset(&temp);
+      curlx_dyn_reset(&temp);
       added = TRUE; /* use separator for next */
     }
   }
 error:
-  Curl_dyn_free(&temp);
+  curlx_dyn_free(&temp);
 
   return result;
 }
@@ -947,8 +947,8 @@ static CURLcode ssl_push_certinfo_dyn(struct Curl_easy *data,
                                       const char *label,
                                       struct dynbuf *ptr)
 {
-  size_t valuelen = Curl_dyn_len(ptr);
-  char *value = Curl_dyn_ptr(ptr);
+  size_t valuelen = curlx_dyn_len(ptr);
+  char *value = curlx_dyn_ptr(ptr);
 
   CURLcode result = Curl_ssl_push_certinfo_len(data, certnum, label,
                                                value, valuelen);
@@ -966,7 +966,7 @@ static CURLcode do_pubkey_field(struct Curl_easy *data, int certnum,
   CURLcode result;
   struct dynbuf out;
 
-  Curl_dyn_init(&out, CURL_X509_STR_MAX);
+  curlx_dyn_init(&out, CURL_X509_STR_MAX);
 
   /* Generate a certificate information record for the public key. */
 
@@ -974,7 +974,7 @@ static CURLcode do_pubkey_field(struct Curl_easy *data, int certnum,
   if(!result) {
     if(data->set.ssl.certinfo)
       result = ssl_push_certinfo_dyn(data, certnum, label, &out);
-    Curl_dyn_free(&out);
+    curlx_dyn_free(&out);
   }
   return result;
 }
@@ -1110,7 +1110,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
     if(certnum)
       return CURLE_OK;
 
-  Curl_dyn_init(&out, CURL_X509_STR_MAX);
+  curlx_dyn_init(&out, CURL_X509_STR_MAX);
   /* Prepare the certificate information for curl_easy_getinfo(). */
 
   /* Extract the certificate ASN.1 elements. */
@@ -1126,7 +1126,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
     if(result)
       goto done;
   }
-  Curl_dyn_reset(&out);
+  curlx_dyn_reset(&out);
 
   /* Issuer. */
   result = DNtostr(&out, &cert.issuer);
@@ -1137,20 +1137,20 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
     if(result)
       goto done;
   }
-  Curl_dyn_reset(&out);
+  curlx_dyn_reset(&out);
 
   /* Version (always fits in less than 32 bits). */
   version = 0;
   for(ptr = cert.version.beg; ptr < cert.version.end; ptr++)
     version = (version << 8) | *(const unsigned char *) ptr;
   if(data->set.ssl.certinfo) {
-    result = Curl_dyn_addf(&out, "%x", version);
+    result = curlx_dyn_addf(&out, "%x", version);
     if(result)
       goto done;
     result = ssl_push_certinfo_dyn(data, certnum, "Version", &out);
     if(result)
       goto done;
-    Curl_dyn_reset(&out);
+    curlx_dyn_reset(&out);
   }
 
   /* Serial number. */
@@ -1162,7 +1162,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
     if(result)
       goto done;
   }
-  Curl_dyn_reset(&out);
+  curlx_dyn_reset(&out);
 
   /* Signature algorithm .*/
   result = dumpAlgo(&out, &param, cert.signatureAlgorithm.beg,
@@ -1175,7 +1175,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
     if(result)
       goto done;
   }
-  Curl_dyn_reset(&out);
+  curlx_dyn_reset(&out);
 
   /* Start Date. */
   result = ASN1tostr(&out, &cert.notBefore, 0);
@@ -1186,7 +1186,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
     if(result)
       goto done;
   }
-  Curl_dyn_reset(&out);
+  curlx_dyn_reset(&out);
 
   /* Expire Date. */
   result = ASN1tostr(&out, &cert.notAfter, 0);
@@ -1197,7 +1197,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
     if(result)
       goto done;
   }
-  Curl_dyn_reset(&out);
+  curlx_dyn_reset(&out);
 
   /* Public Key Algorithm. */
   result = dumpAlgo(&out, &param, cert.subjectPublicKeyAlgorithm.beg,
@@ -1211,13 +1211,13 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
       goto done;
   }
 
-  rc = do_pubkey(data, certnum, Curl_dyn_ptr(&out),
+  rc = do_pubkey(data, certnum, curlx_dyn_ptr(&out),
                  &param, &cert.subjectPublicKey);
   if(rc) {
     result = CURLE_OUT_OF_MEMORY; /* the most likely error */
     goto done;
   }
-  Curl_dyn_reset(&out);
+  curlx_dyn_reset(&out);
 
   /* Signature. */
   result = ASN1tostr(&out, &cert.signature, 0);
@@ -1228,12 +1228,12 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
     if(result)
       goto done;
   }
-  Curl_dyn_reset(&out);
+  curlx_dyn_reset(&out);
 
   /* Generate PEM certificate. */
-  result = Curl_base64_encode(cert.certificate.beg,
-                              cert.certificate.end - cert.certificate.beg,
-                              &certptr, &clen);
+  result = curlx_base64_encode(cert.certificate.beg,
+                               cert.certificate.end - cert.certificate.beg,
+                               &certptr, &clen);
   if(result)
     goto done;
 
@@ -1246,22 +1246,22 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
      -----END CERTIFICATE-----\n
    */
 
-  Curl_dyn_reset(&out);
+  curlx_dyn_reset(&out);
 
   /* Build the certificate string. */
-  result = Curl_dyn_add(&out, "-----BEGIN CERTIFICATE-----\n");
+  result = curlx_dyn_add(&out, "-----BEGIN CERTIFICATE-----\n");
   if(!result) {
     size_t j = 0;
 
     while(!result && (j < clen)) {
       size_t chunksize = (clen - j) > 64 ? 64 : (clen - j);
-      result = Curl_dyn_addn(&out, &certptr[j], chunksize);
+      result = curlx_dyn_addn(&out, &certptr[j], chunksize);
       if(!result)
-        result = Curl_dyn_addn(&out, "\n", 1);
+        result = curlx_dyn_addn(&out, "\n", 1);
       j += chunksize;
     }
     if(!result)
-      result = Curl_dyn_add(&out, "-----END CERTIFICATE-----\n");
+      result = curlx_dyn_add(&out, "-----END CERTIFICATE-----\n");
   }
   free(certptr);
   if(!result)
@@ -1271,7 +1271,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
 done:
   if(result)
     failf(data, "Failed extracting certificate chain");
-  Curl_dyn_free(&out);
+  curlx_dyn_free(&out);
   return result;
 }
 
index 65bbdaed0dd7ff6be068a245572f7242882fe439..966fd3172c8a833572b20305e70b6f0fc374ad93 100644 (file)
--- a/lib/ws.c
+++ b/lib/ws.c
@@ -29,9 +29,9 @@
 #include "urldata.h"
 #include "url.h"
 #include "bufq.h"
-#include "dynbuf.h"
+#include "curlx/dynbuf.h"
 #include "rand.h"
-#include "curl_base64.h"
+#include "curlx/base64.h"
 #include "connect.h"
 #include "sendf.h"
 #include "multiif.h"
@@ -40,7 +40,7 @@
 #include "transfer.h"
 #include "select.h"
 #include "nonblock.h"
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -851,7 +851,7 @@ CURLcode Curl_ws_request(struct Curl_easy *data, struct dynbuf *req)
   result = Curl_rand(data, (unsigned char *)rand, sizeof(rand));
   if(result)
     return result;
-  result = Curl_base64_encode((char *)rand, sizeof(rand), &randstr, &randlen);
+  result = curlx_base64_encode((char *)rand, sizeof(rand), &randstr, &randlen);
   if(result)
     return result;
   DEBUGASSERT(randlen < sizeof(keyval));
@@ -863,8 +863,8 @@ CURLcode Curl_ws_request(struct Curl_easy *data, struct dynbuf *req)
   free(randstr);
   for(i = 0; !result && (i < CURL_ARRAYSIZE(heads)); i++) {
     if(!Curl_checkheaders(data, heads[i].name, strlen(heads[i].name))) {
-      result = Curl_dyn_addf(req, "%s: %s\r\n", heads[i].name,
-                             heads[i].val);
+      result = curlx_dyn_addf(req, "%s: %s\r\n", heads[i].name,
+                              heads[i].val);
     }
   }
   k->upgr101 = UPGR101_WS;
@@ -905,7 +905,7 @@ CURLcode Curl_ws_accept(struct Curl_easy *data,
       const char *p = getenv("CURL_WS_CHUNK_SIZE");
       if(p) {
         curl_off_t l;
-        if(!Curl_str_number(&p, &l, 1*1024*1024))
+        if(!curlx_str_number(&p, &l, 1*1024*1024))
           chunk_size = (size_t)l;
       }
     }
@@ -1164,7 +1164,7 @@ static CURLcode ws_flush(struct Curl_easy *data, struct websocket *ws,
     const char *p = getenv("CURL_WS_CHUNK_EAGAIN");
     if(p) {
       curl_off_t l;
-      if(!Curl_str_number(&p, &l, 1*1024*1024))
+      if(!curlx_str_number(&p, &l, 1*1024*1024))
         chunk_egain = (size_t)l;
     }
 #endif
index 8e9cee5c2652b9a3c85fb61b64abb318df601d07..5bf620a00fe26a1515c45698cfb86cf143824727 100644 (file)
   </ItemDefinitionGroup>
   <ItemGroup>
 CURL_LIB_C_FILES
+CURL_LIB_CURLX_C_FILES
 CURL_LIB_VAUTH_C_FILES
 CURL_LIB_VQUIC_C_FILES
 CURL_LIB_VSSH_C_FILES
@@ -1991,6 +1992,7 @@ CURL_LIB_VTLS_C_FILES
   </ItemGroup>
   <ItemGroup>
 CURL_LIB_H_FILES
+CURL_LIB_CURLX_H_FILES
 CURL_LIB_VAUTH_H_FILES
 CURL_LIB_VQUIC_H_FILES
 CURL_LIB_VSSH_H_FILES
index 2246bb27d1b910ba27ef9b4f41064a38abcbf34e..9c419577f5fbb6607be4f42abce5412a12baa33c 100644 (file)
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+CURL_LIB_CURLX_C_FILES
 CURL_SRC_X_C_FILES
 CURL_SRC_C_FILES
   </ItemGroup>
   <ItemGroup>
+CURL_LIB_CURLX_H_FILES
 CURL_SRC_X_H_FILES
 CURL_SRC_H_FILES
   </ItemGroup>
index 4f1af243e1bdd1356a34c9a27789abffa60fe9ec..5781ddb5ba3fc33222d933d40278b5292704e4e8 100644 (file)
   </ItemDefinitionGroup>
   <ItemGroup>
 CURL_LIB_C_FILES
+CURL_LIB_CURLX_C_FILES
 CURL_LIB_VAUTH_C_FILES
 CURL_LIB_VQUIC_C_FILES
 CURL_LIB_VSSH_C_FILES
@@ -2039,6 +2040,7 @@ CURL_LIB_VTLS_C_FILES
   </ItemGroup>
   <ItemGroup>
 CURL_LIB_H_FILES
+CURL_LIB_CURLX_H_FILES
 CURL_LIB_VAUTH_H_FILES
 CURL_LIB_VQUIC_H_FILES
 CURL_LIB_VSSH_H_FILES
index d520cb116ce23d3ecb48615e83b283833b712d76..4c495d683aaf094e69004a15ecbdaf58c3275ff4 100644 (file)
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+CURL_LIB_CURLX_C_FILES
 CURL_SRC_X_C_FILES
 CURL_SRC_C_FILES
   </ItemGroup>
   <ItemGroup>
+CURL_LIB_CURLX_H_FILES
 CURL_SRC_X_H_FILES
 CURL_SRC_H_FILES
   </ItemGroup>
index a3c7b47b67d1d2887dc3e337474602aa02c41d0f..74e2303904a0e397f5042569823797cd3d5664ad 100644 (file)
   </ItemDefinitionGroup>
   <ItemGroup>
 CURL_LIB_C_FILES
+CURL_LIB_CURLX_C_FILES
 CURL_LIB_VAUTH_C_FILES
 CURL_LIB_VQUIC_C_FILES
 CURL_LIB_VSSH_C_FILES
@@ -2039,6 +2040,7 @@ CURL_LIB_VTLS_C_FILES
   </ItemGroup>
   <ItemGroup>
 CURL_LIB_H_FILES
+CURL_LIB_CURLX_H_FILES
 CURL_LIB_VAUTH_H_FILES
 CURL_LIB_VQUIC_H_FILES
 CURL_LIB_VSSH_H_FILES
index b84a37337daab4d2a31881b3a5b5373b30093b99..c58479cee53646a5b587883ed7b56bbaec7dc579 100644 (file)
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CONSOLE;DEBUGBUILD;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\lib;..\..\..\..\lib\curlx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CONSOLE;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+CURL_LIB_CURLX_C_FILES
 CURL_SRC_X_C_FILES
 CURL_SRC_C_FILES
   </ItemGroup>
   <ItemGroup>
+CURL_LIB_CURLX_H_FILES
 CURL_SRC_X_H_FILES
 CURL_SRC_H_FILES
   </ItemGroup>
index 8d6d781fa5072afdf03d62975df5c767249dff56..c91dc78639b6f34443be99d38cb619b85832f1b7 100644 (file)
@@ -153,28 +153,18 @@ rem
     ) else if "!var!" == "CURL_SRC_RC_FILES" (
       for /f "delims=" %%r in ('dir /b ..\src\*.rc') do call :element %1 src "%%r" %3
     ) else if "!var!" == "CURL_SRC_X_C_FILES" (
-      call :element %1 lib "strparse.c" %3
       call :element %1 lib "strcase.c" %3
-      call :element %1 lib "timeval.c" %3
       call :element %1 lib "nonblock.c" %3
-      call :element %1 lib "warnless.c" %3
       call :element %1 lib "curl_multibyte.c" %3
       call :element %1 lib "version_win32.c" %3
-      call :element %1 lib "dynbuf.c" %3
-      call :element %1 lib "base64.c" %3
     ) else if "!var!" == "CURL_SRC_X_H_FILES" (
       call :element %1 lib "config-win32.h" %3
       call :element %1 lib "curl_setup.h" %3
-      call :element %1 lib "strparse.h" %3
       call :element %1 lib "strcase.h" %3
-      call :element %1 lib "timeval.h" %3
       call :element %1 lib "nonblock.h" %3
-      call :element %1 lib "warnless.h" %3
       call :element %1 lib "curl_ctype.h" %3
       call :element %1 lib "curl_multibyte.h" %3
       call :element %1 lib "version_win32.h" %3
-      call :element %1 lib "dynbuf.h" %3
-      call :element %1 lib "curl_base64.h" %3
     ) else if "!var!" == "CURL_LIB_C_FILES" (
       for /f "delims=" %%c in ('dir /b ..\lib\*.c') do call :element %1 lib "%%c" %3
     ) else if "!var!" == "CURL_LIB_H_FILES" (
@@ -182,6 +172,10 @@ rem
       for /f "delims=" %%h in ('dir /b ..\lib\*.h') do call :element %1 lib "%%h" %3
     ) else if "!var!" == "CURL_LIB_RC_FILES" (
       for /f "delims=" %%r in ('dir /b ..\lib\*.rc') do call :element %1 lib "%%r" %3
+    ) else if "!var!" == "CURL_LIB_CURLX_C_FILES" (
+      for /f "delims=" %%c in ('dir /b ..\lib\curlx\*.c') do call :element %1 lib\curlx "%%c" %3
+    ) else if "!var!" == "CURL_LIB_CURLX_H_FILES" (
+      for /f "delims=" %%h in ('dir /b ..\lib\curlx\*.h') do call :element %1 lib\curlx "%%h" %3
     ) else if "!var!" == "CURL_LIB_VAUTH_C_FILES" (
       for /f "delims=" %%c in ('dir /b ..\lib\vauth\*.c') do call :element %1 lib\vauth "%%c" %3
     ) else if "!var!" == "CURL_LIB_VAUTH_H_FILES" (
@@ -223,6 +217,8 @@ rem
     set "TABS=                         "
   ) else if "%2" == "lib\vtls" (
     set "TABS=                         "
+  ) else if "%2" == "lib\curlx" (
+    set "TABS=                         "
   ) else (
     set "TABS=                 "
   )
index 19f525abed44642fe9eba16a6c733d0975786d5b..469df6d7611d31fb9ba2aed746cd6f7069ec9578 100644 (file)
@@ -65,7 +65,7 @@ if(CURL_CA_EMBED_SET)
   endif()
 endif()
 
-# Get 'CURL_CFILES', 'CURLX_CFILES', 'CURL_HFILES', 'CURLTOOL_LIBCURL_CFILES' variables
+# Get 'CURL_CFILES', 'CURLX_CFILES', 'CURL_HFILES' variables
 curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
 include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
 
@@ -74,12 +74,13 @@ if(WIN32)
 endif()
 
 if(BUILD_STATIC_CURL)
-  set(CURLX_CFILES ${CURLTOOL_LIBCURL_CFILES})
+  set(CURLX_CFILES "")
 endif()
 
 set_property(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES
   "${PROJECT_BINARY_DIR}/lib"  # for "curl_config.h"
   "${PROJECT_SOURCE_DIR}/lib"  # for "curl_setup.h"
+  "${PROJECT_SOURCE_DIR}/lib/curlx"  # for curlx functions
   # This is needed as tool_hugehelp.c is generated in the binary dir
   "${PROJECT_SOURCE_DIR}/src"  # for "tool_hugehelp.h"
 )
@@ -102,7 +103,7 @@ add_library(
   curltool  # special libcurltool library just for unittests
   STATIC
   EXCLUDE_FROM_ALL
-  ${CURL_CFILES} ${CURLTOOL_LIBCURL_CFILES} ${CURL_HFILES}
+  ${CURL_CFILES} ${CURL_HFILES}
 )
 target_compile_definitions(curltool PUBLIC "CURL_STATICLIB" "UNITTESTS")
 target_link_libraries(curltool PRIVATE ${CURL_LIBS})
index af69d6ecf2e6247416a109119b23df0285b38a01..5e84a20b14d14eaca6e5f796650be8f1dfacad43 100644 (file)
@@ -44,6 +44,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include        \
               -I$(top_builddir)/lib          \
               -I$(top_builddir)/src          \
               -I$(top_srcdir)/lib            \
+              -I$(top_srcdir)/lib/curlx      \
               -I$(top_srcdir)/src
 
 bin_PROGRAMS = curl
@@ -74,7 +75,7 @@ CLEANFILES =
 
 if USE_UNITY
 if USE_CPPFLAG_CURL_STATICLIB
-curl_CURLX = $(CURLTOOL_LIBCURL_CFILES)
+curl_CURLX =
 else
 curl_CURLX = $(CURLX_CFILES)
 endif
@@ -110,8 +111,8 @@ libcurltool_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB -DUNITTESTS
 libcurltool_la_CFLAGS =
 libcurltool_la_LDFLAGS = -static $(LINKFLAGS)
 if USE_UNITY
-libcurltool_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CURL_CFILES) $(CURLTOOL_LIBCURL_CFILES)
-       @PERL@ $(top_srcdir)/scripts/mk-unity.pl $(srcdir) $(CURL_CFILES) $(CURLTOOL_LIBCURL_CFILES) > libcurltool_unity.c
+libcurltool_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CURL_CFILES) $(curl_CURLX)
+       @PERL@ $(top_srcdir)/scripts/mk-unity.pl $(srcdir) $(CURL_CFILES) $(curl_CURLX) > libcurltool_unity.c
 
 nodist_libcurltool_la_SOURCES = libcurltool_unity.c
 libcurltool_la_SOURCES =
index dccb8c0d1df4d95236de823272c6874830086ff2..39e99c44f001283b461c18b2e77b94737d2cb690 100644 (file)
 # CSRC2 = file4.c file5.c file6.c
 # CSOURCES = $(CSRC1) $(CSRC2)
 
-# libcurl sources to include in curltool lib we use for test binaries
-CURLTOOL_LIBCURL_CFILES = \
-  ../lib/base64.c \
-  ../lib/dynbuf.c \
-  ../lib/timeval.c
-
 # libcurl has sources that provide functions named curlx_* that are not part of
 # the official API, but we reuse the code here to avoid duplication.
 CURLX_CFILES = \
-  ../lib/base64.c \
+  ../lib/curlx/base64.c \
   ../lib/curl_multibyte.c \
-  ../lib/dynbuf.c \
+  ../lib/curlx/dynbuf.c \
   ../lib/nonblock.c \
-  ../lib/strparse.c \
+  ../lib/curlx/strparse.c \
   ../lib/strcase.c \
-  ../lib/timediff.c \
-  ../lib/timeval.c \
+  ../lib/curlx/timediff.c \
+  ../lib/curlx/timeval.c \
   ../lib/version_win32.c \
-  ../lib/warnless.c
+  ../lib/curlx/warnless.c
 
 CURLX_HFILES = \
   ../lib/curl_ctype.h \
   ../lib/curl_multibyte.h \
   ../lib/curl_setup.h \
-  ../lib/dynbuf.h \
+  ../lib/curlx/dynbuf.h \
   ../lib/nonblock.h \
-  ../lib/strparse.h \
+  ../lib/curlx/strparse.h \
   ../lib/strcase.h \
-  ../lib/timediff.h \
-  ../lib/timeval.h \
+  ../lib/curlx/timediff.h \
+  ../lib/curlx/timeval.h \
   ../lib/version_win32.h \
-  ../lib/warnless.h
+  ../lib/curlx/warnless.h
 
 CURL_CFILES = \
   slist_wc.c \
index 30d902e95ace90ad36a6c3dc89acf11d32fc448f..384afd8cb3bfc371fe076c7db6d288b9487b3bc9 100644 (file)
@@ -28,9 +28,8 @@
 #endif
 
 #include "terminal.h"
-#include "curlx.h"
-
-#include "memdebug.h" /* keep this as LAST include */
+#include <curlx.h>
+#include <memdebug.h> /* keep this as LAST include */
 
 #ifdef HAVE_TERMIOS_H
 #  include <termios.h>
index 3a701e648a8283a9f4c2c2904c2df76a5ed9c455..2cf889c51cfeda48c633d33f9a6baeae9edd30e8 100644 (file)
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_msgs.h"
 #include "tool_cb_dbg.h"
 #include "tool_util.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 static void dump(const char *timebuf, const char *idsbuf, const char *text,
                  FILE *stream, const unsigned char *ptr, size_t size,
index 6ec6d2c38e74385cdf10f6ec9562a056f475a364..9dd8f2b7a30f11034cab045f64da1cc83bd38b3d 100644 (file)
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "strcase.h"
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_doswin.h"
@@ -38,7 +37,7 @@
 #include "tool_operate.h"
 #include "tool_libinfo.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 static char *parse_filename(const char *ptr, size_t len);
 
index 1f90cda7f25fbeda6f8fb093a38a2fa948f3f616..56f03f2e4e44157c2a87d7b1e5b59057f8b4af72 100644 (file)
@@ -23,7 +23,7 @@
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_cb_prg.h"
@@ -31,7 +31,7 @@
 #include "tool_operate.h"
 #include "terminal.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 #define MAX_BARLENGTH 400
 #define MIN_BARLENGTH 20
index 60c1def0cf37133532653a374abf65aea8a61555..86ae476a225d4ecfa72e4959a752ddc4420089c0 100644 (file)
@@ -27,7 +27,7 @@
 #include <sys/select.h>
 #endif
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_cb_rea.h"
@@ -36,7 +36,7 @@
 #include "tool_msgs.h"
 #include "tool_sleep.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 /*
 ** callback for CURLOPT_READFUNCTION
index ca2f13a0c5255048eb15d4d8b11b32e246ed8bcc..dea98a8e8afe343206e5d816dbe9a7a21c5110d3 100644 (file)
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_operate.h"
 #include "tool_cb_see.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 /*
 ** callback for CURLOPT_SEEKFUNCTION
index 1cd0524df6cab5628ed7a819201d2ab71a7cbc26..e0dbe2c9c7570359ad707e00a31f6657c7d85501 100644 (file)
 
 #include <sys/stat.h>
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_msgs.h"
 #include "tool_cb_wrt.h"
 #include "tool_operate.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 #ifdef _WIN32
 #define OPENMODE S_IREAD | S_IWRITE
index 93ba139c4fcea975ff288be3053191fa2a6ee262..e30925dd54caafa353c5c5dbc59d0c4f198f0c1b 100644 (file)
@@ -27,9 +27,8 @@
 #include "tool_formparse.h"
 #include "tool_paramhlp.h"
 #include "tool_main.h"
-#include "curlx.h"
-
-#include "memdebug.h" /* keep this as LAST include */
+#include <curlx.h>
+#include <memdebug.h> /* keep this as LAST include */
 
 void config_init(struct OperationConfig *config)
 {
index ed49f759ed2cfa00953aae2fad0184497421706e..15b2c347ead8cbc6efe0c6aeb5f9085e8813b869 100644 (file)
@@ -23,6 +23,8 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
+
+#include <curl/mprintf.h>
 #include "tool_setup.h"
 #include "tool_sdecls.h"
 #include "tool_urlglob.h"
 #endif
 #endif
 
+/* make the tool use the libcurl *printf family */
+# 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
+
+#define checkprefix(a,b)    curl_strnequal(b, STRCONST(a))
+
 struct GlobalConfig;
 
 struct State {
@@ -55,7 +77,7 @@ struct State {
 
 struct OperationConfig {
   struct State state;             /* for create_transfer() */
-  struct curlx_dynbuf postdata;
+  struct dynbuf postdata;
   char *useragent;
   struct curl_slist *cookies;  /* cookies to serialize into a single line */
   char *cookiejar;          /* write to this file */
index ac9b969a8da76b0ada16be3eb8351f5919667bd9..88e4daffb7b742b08657cdea180984e2a3d8e85e 100644 (file)
 #  include <direct.h>
 #endif
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_dirhie.h"
 #include "tool_msgs.h"
-#include "dynbuf.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 #if defined(_WIN32) || (defined(MSDOS) && !defined(__DJGPP__))
 #  define mkdir(x,y) (mkdir)((x))
@@ -99,7 +98,7 @@ CURLcode create_dir_hierarchy(const char *outfile, struct GlobalConfig *global)
 {
   CURLcode result = CURLE_OK;
   size_t outlen = strlen(outfile);
-  struct curlx_dynbuf dirbuf;
+  struct dynbuf dirbuf;
 
   curlx_dyn_init(&dirbuf, outlen + 1);
 
index 4f0fa1de0750cc7f0965a4ef1ef86c6bc66794aa..0b3f0ca9c781dd0e6b11a36c568ce89305316831 100644 (file)
@@ -39,8 +39,8 @@
 #include "tool_bname.h"
 #include "tool_doswin.h"
 
-#include "curlx.h"
-#include "memdebug.h" /* keep this as LAST include */
+#include <curlx.h>
+#include <memdebug.h> /* keep this as LAST include */
 
 #ifdef _WIN32
 #  undef  PATH_MAX
index ea09fd7849098f55b0bcc3632794531679d81db4..fa264606fc59868dce479b564cb6250d9121ae2d 100644 (file)
 
 #ifndef CURL_DISABLE_LIBCURL_OPTION
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_easysrc.h"
 #include "tool_msgs.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 /* global variable definitions, for easy-interface source code generation */
 
index 018d85f624da53d7910794906abd03ffe4b2d508..4946e68a3961eafd01205923ea687b56c61be1b7 100644 (file)
@@ -24,7 +24,7 @@
 #include "tool_filetime.h"
 #include "tool_cfgable.h"
 #include "tool_msgs.h"
-#include "curlx.h"
+#include <curlx.h>
 
 #ifdef HAVE_UTIME_H
 #  include <utime.h>
index 5b1e256a08472953c735bf1194bf2b20701ea03c..d16a83899b9d8d6ee015eb37806a6149cafd6a03 100644 (file)
@@ -39,6 +39,7 @@
 #include <curlx.h>
 
 #include "tool_findfile.h"
+#include "tool_cfgable.h"
 
 #include "memdebug.h" /* keep this as LAST include */
 
index af8bd4c6dd47c488fb58f372582ed557a634207c..7f6af798930a202bf6e5ba26076628d9693ac784 100644 (file)
@@ -23,9 +23,7 @@
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "strcase.h"
-
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_msgs.h"
@@ -34,7 +32,7 @@
 #include "tool_paramhlp.h"
 #include "tool_formparse.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 /* tool_mime functions. */
 static struct tool_mime *tool_mime_new(struct tool_mime *parent,
index 47e404c08efb744deeecc2f55ce18c93c9f1e178..efa7145892e520c6b148934df3dfacb2170697e5 100644 (file)
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "strcase.h"
-
-#include "curlx.h"
-
+#include <curlx.h>
 #include "tool_binmode.h"
 #include "tool_cfgable.h"
 #include "tool_cb_prg.h"
 #include "tool_paramhlp.h"
 #include "tool_parsecfg.h"
 #include "tool_main.h"
-#include "dynbuf.h"
 #include "tool_stderr.h"
 #include "var.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 #define ALLOW_BLANK TRUE
 #define DENY_BLANK FALSE
@@ -668,7 +664,7 @@ static ParameterError data_urlencode(struct GlobalConfig *global,
       char *n;
       replace_url_encoded_space_by_plus(enc);
       if(nlen > 0) { /* only append '=' if we have a name */
-        struct curlx_dynbuf dyn;
+        struct dynbuf dyn;
         curlx_dyn_init(&dyn, MAX_DATAURLENCODE);
         if(curlx_dyn_addn(&dyn, nextarg, nlen) ||
            curlx_dyn_addn(&dyn, "=", 1) ||
@@ -740,17 +736,17 @@ static CURLcode set_trace_config(struct GlobalConfig *global,
         break;
     }
 
-    if((len == 3) && strncasecompare(name, "all", 3)) {
+    if((len == 3) && curl_strnequal(name, "all", 3)) {
       global->traceids = toggle;
       global->tracetime = toggle;
       result = curl_global_trace(token);
       if(result)
         goto out;
     }
-    else if((len == 3) && strncasecompare(name, "ids", 3)) {
+    else if((len == 3) && curl_strnequal(name, "ids", 3)) {
       global->traceids = toggle;
     }
-    else if((len == 4) && strncasecompare(name, "time", 4)) {
+    else if((len == 4) && curl_strnequal(name, "time", 4)) {
       global->tracetime = toggle;
     }
     else {
@@ -853,7 +849,7 @@ static ParameterError url_query(const char *nextarg,
   size_t size = 0;
   ParameterError err = PARAM_OK;
   char *query;
-  struct curlx_dynbuf dyn;
+  struct dynbuf dyn;
   curlx_dyn_init(&dyn, MAX_QUERY_LEN);
 
   if(*nextarg == '+') {
@@ -1093,7 +1089,7 @@ static ParameterError parse_url(struct GlobalConfig *global,
 {
   if(nextarg && (nextarg[0] == '@')) {
     /* read URLs from a file, treat all as -O */
-    struct curlx_dynbuf line;
+    struct dynbuf line;
     ParameterError err = PARAM_OK;
     bool error = FALSE;
     bool fromstdin = !strcmp("-", &nextarg[1]);
@@ -1199,11 +1195,11 @@ static ParameterError parse_ech(struct GlobalConfig *global,
   ParameterError err = PARAM_OK;
   if(!feature_ech)
     err = PARAM_LIBCURL_DOESNT_SUPPORT;
-  else if(strlen(nextarg) > 4 && strncasecompare("pn:", nextarg, 3)) {
+  else if(strlen(nextarg) > 4 && curl_strnequal("pn:", nextarg, 3)) {
     /* a public_name */
     err = getstr(&config->ech_public, nextarg, DENY_BLANK);
   }
-  else if(strlen(nextarg) > 5 && strncasecompare("ecl:", nextarg, 4)) {
+  else if(strlen(nextarg) > 5 && curl_strnequal("ecl:", nextarg, 4)) {
     /* an ECHConfigList */
     if('@' != *(nextarg + 4)) {
       err = getstr(&config->ech_config, nextarg, DENY_BLANK);
@@ -1744,7 +1740,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       goto error;
     }
     else if(expand && nextarg) {
-      struct curlx_dynbuf nbuf;
+      struct dynbuf nbuf;
       bool replaced;
 
       if((ARGTYPE(a->desc) != ARG_STRG) &&
index b8e2fb0761319fa70537c0a3e260de60b21879f7..48d39f3837ebb9347aa3624aa18cc39c89eddcec 100644 (file)
@@ -23,7 +23,7 @@
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_help.h"
 #include "tool_libinfo.h"
 #include "tool_cb_prg.h"
 #include "tool_hugehelp.h"
 #include "tool_getparam.h"
+#include "tool_cfgable.h"
 #include "terminal.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 struct category_descriptors {
   const char *opt;
index aa315880ee05a17ac4a7dbfeb00c1bfb19ec6bac..b3bb09e68e4296ad44816c4d1e662d710e257821 100644 (file)
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "strcase.h"
-
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_msgs.h"
 #include "tool_getparam.h"
 #include "tool_helpers.h"
-
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 /*
 ** Helper functions that are used from more than one source file.
index e753e82ae6c188cf1a62cf8babdf552226c068c7..484efb8c464ceb1f4bada0619163ded593935638 100644 (file)
 #include "tool_setup.h"
 
 #ifndef CURL_DISABLE_IPFS
-#include "curlx.h"
-#include "dynbuf.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_msgs.h"
 #include "tool_ipfs.h"
-
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 /* ensure input ends in slash */
 static CURLcode ensure_trailing_slash(char **input)
@@ -39,7 +37,7 @@ static CURLcode ensure_trailing_slash(char **input)
   if(*input && **input) {
     size_t len = strlen(*input);
     if(((*input)[len - 1] != '/')) {
-      struct curlx_dynbuf dyn;
+      struct dynbuf dyn;
       curlx_dyn_init(&dyn, len + 2);
 
       if(curlx_dyn_addn(&dyn, *input, len)) {
@@ -96,7 +94,7 @@ static char *ipfs_gateway(void)
 
   if(gateway_file) {
     int c;
-    struct curlx_dynbuf dyn;
+    struct dynbuf dyn;
     curlx_dyn_init(&dyn, MAX_GATEWAY_URL_LEN);
 
     /* get the first line of the gateway file, ignore the rest */
index 0563c4c5926ebedb91949ef70fb52599fec8f0b0..4f9485350fcbe33370cdbba30a7405d632970d87 100644 (file)
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "strcase.h"
-
-#include "curlx.h"
-
+#include <curlx.h>
 #include "tool_libinfo.h"
-
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 /* global variable definitions, for libcurl runtime info */
 
index 05a5a4fbdf2746a10ad31ec862dcbc301a77c234..1b0493c33d42919b85be37fca359027d59acd03a 100644 (file)
@@ -37,7 +37,7 @@
 #include <fcntl.h>
 #endif
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_doswin.h"
@@ -53,7 +53,7 @@
  * the library level code from this client-side is ugly, but we do this
  * anyway for convenience.
  */
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 #ifdef __VMS
 /*
index 58b935e962e4bcf778f6f1afedad22c901f65574..520bb908727f8cd56c786d1d79422474bdf83f31 100644 (file)
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_msgs.h"
 #include "tool_cb_prg.h"
 #include "terminal.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 #define WARN_PREFIX "Warning: "
 #define NOTE_PREFIX "Note: "
index b50a68545b9e4b55eae770b2ae488b0f2f075db4..56b93b7592665c8b6b6fbd500d7dbd1f39ad5057 100644 (file)
@@ -54,7 +54,7 @@
 #include <uv.h>
 #endif
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_binmode.h"
 #include "tool_cfgable.h"
@@ -91,7 +91,7 @@
 #include "tool_hugehelp.h"
 #include "tool_progress.h"
 #include "tool_ipfs.h"
-#include "dynbuf.h"
+
 #ifdef DEBUGBUILD
 /* libcurl's debug-only curl_easy_perform_ev() */
 CURL_EXTERN CURLcode curl_easy_perform_ev(CURL *easy);
@@ -1352,7 +1352,7 @@ static CURLcode config2setopts(struct GlobalConfig *global,
   my_setopt_slist(curl, CURLOPT_PREQUOTE, config->prequote);
 
   if(config->cookies) {
-    struct curlx_dynbuf cookies;
+    struct dynbuf cookies;
     struct curl_slist *cl;
 
     /* The maximum size needs to match MAX_NAME in cookie.h */
index 6feb7fe60b59204ddd5985e2dc70cb41a2526b1b..7019b514cb20cf01c551a3dca467675256c34f2c 100644 (file)
 #include "tool_setup.h"
 #include "tool_operate.h"
 
-#include "strcase.h"
-
-#include "curlx.h"
-
+#include <curlx.h>
 #include "tool_cfgable.h"
 #include "tool_doswin.h"
 #include "tool_operhlp.h"
 #include "tool_msgs.h"
-
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 void clean_getout(struct OperationConfig *config)
 {
index 681590a2e6132ecd7a7bb463eb4e2211f4e8d3c7..ee28d655ed6eea04c96f4ad39e8a23820c175b46 100644 (file)
@@ -23,8 +23,7 @@
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "strcase.h"
-#include "curlx.h"
+#include <curlx.h>
 
 #include "tool_cfgable.h"
 #include "tool_getparam.h"
@@ -34,9 +33,8 @@
 #include "tool_libinfo.h"
 #include "tool_util.h"
 #include "tool_version.h"
-#include "dynbuf.h"
 
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 struct getout *new_getout(struct OperationConfig *config)
 {
@@ -91,7 +89,7 @@ static size_t memcrlf(char *orig,
 
 ParameterError file2string(char **bufp, FILE *file)
 {
-  struct curlx_dynbuf dyn;
+  struct dynbuf dyn;
   curlx_dyn_init(&dyn, MAX_FILE2STRING);
   if(file) {
     do {
@@ -141,7 +139,7 @@ ParameterError file2memory_range(char **bufp, size_t *size, FILE *file,
 {
   if(file) {
     size_t nread;
-    struct curlx_dynbuf dyn;
+    struct dynbuf dyn;
     curl_off_t offset = 0;
     curl_off_t throwaway = 0;
 
@@ -413,7 +411,7 @@ ParameterError proto2num(struct OperationConfig *config,
                          const char * const *val, char **ostr, const char *str)
 {
   const char **protoset;
-  struct curlx_dynbuf obuf;
+  struct dynbuf obuf;
   size_t proto;
   CURLcode result;
 
@@ -581,7 +579,7 @@ static CURLcode checkpasswd(const char *kind, /* for what purpose */
     /* no password present, prompt for one */
     char passwd[2048] = "";
     char prompt[256];
-    struct curlx_dynbuf dyn;
+    struct dynbuf dyn;
 
     curlx_dyn_init(&dyn, MAX_USERPWDLENGTH);
     if(osep)
index b80b867cc8c2b7c318aaecf907ed3be08841de62..05c23a646fc27da7a0adcd468f55974b90c04885 100644 (file)
@@ -23,8 +23,7 @@
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "curlx.h"
-
+#include <curlx.h>
 #include "tool_cfgable.h"
 #include "tool_getparam.h"
 #include "tool_helpers.h"
@@ -32,9 +31,7 @@
 #include "tool_msgs.h"
 #include "tool_parsecfg.h"
 #include "tool_util.h"
-#include "dynbuf.h"
-
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 /* only acknowledge colon or equals as separators if the option was not
    specified with an initial dash! */
@@ -90,7 +87,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
     char *param;
     int lineno = 0;
     bool dashed_option;
-    struct curlx_dynbuf buf;
+    struct dynbuf buf;
     bool fileerror = FALSE;
     curlx_dyn_init(&buf, MAX_CONFIG_LINE_LENGTH);
     DEBUGASSERT(filename);
index b8a18ef1512804467746073dfe5a49f1b1f5e1be..07a34621ae3be9833a463a0c14f4ed5bdb713476 100644 (file)
@@ -27,6 +27,6 @@
 
 int parseconfig(const char *filename, struct GlobalConfig *config);
 
-bool my_get_line(FILE *fp, struct curlx_dynbuf *db, bool *error);
+bool my_get_line(FILE *fp, struct dynbuf *db, bool *error);
 
 #endif /* HEADER_CURL_TOOL_PARSECFG_H */
index 90b31651267424ef2e7dd0c9f02c44f3b3d47e75..8f74253e961f26c4ed7f3a8421e3f2a4385b0ccf 100644 (file)
@@ -25,8 +25,7 @@
 #include "tool_operate.h"
 #include "tool_progress.h"
 #include "tool_util.h"
-
-#include "curlx.h"
+#include <curlx.h>
 
 /* The point of this function would be to return a string of the input data,
    but never longer than 5 columns (+ one zero byte).
index cd3aeabe00e17dbc66e7b97eec3b065d3df1b319..a782b33ea220ea0387957e60480bb3e11330ef50 100644 (file)
 
 #ifndef CURL_DISABLE_LIBCURL_OPTION
 
-#include "curlx.h"
-
+#include <curlx.h>
 #include "tool_cfgable.h"
 #include "tool_easysrc.h"
 #include "tool_setopt.h"
 #include "tool_msgs.h"
-#include "dynbuf.h"
-
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 /* Lookup tables for converting setopt values back to symbols */
 /* For enums, values may be in any order. */
@@ -177,7 +174,7 @@ static char *c_escape(const char *str, curl_off_t len)
   const char *s;
   unsigned int cutoff = 0;
   CURLcode result;
-  struct curlx_dynbuf escaped;
+  struct dynbuf escaped;
 
   curlx_dyn_init(&escaped, 4 * MAX_STRING_LENGTH_OUTPUT + 3);
 
index a52c98d88ae3f59f71d626f6a996bdafa2e31118..20768ed54b99dc6431f1ae49cfebaea96e150bb8 100644 (file)
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "curlx.h"
+#include <curlx.h>
 #include "tool_cfgable.h"
 #include "tool_cb_dbg.h"
 #include "tool_msgs.h"
 #include "tool_setopt.h"
 #include "tool_ssls.h"
-#include "dynbuf.h"
-#include "curl_base64.h"
 #include "tool_parsecfg.h"
 
 /* The maximum line length for an ecoded session ticket */
index e5531f09fe762fdffc45fdd82a861f5c7ea26439..22d86353585a0ab4d1251b8b924544da054ecab0 100644 (file)
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "curlx.h"
+#include <curlx.h>
 #include "tool_cfgable.h"
 #include "tool_doswin.h"
 #include "tool_urlglob.h"
 #include "tool_vms.h"
-#include "dynbuf.h"
-
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 #define GLOBERROR(string, column, code) \
   glob->error = string, glob->pos = column, code
@@ -611,7 +609,7 @@ CURLcode glob_match_url(char **result, const char *filename,
   char numbuf[18];
   const char *appendthis = "";
   size_t appendlen = 0;
-  struct curlx_dynbuf dyn;
+  struct dynbuf dyn;
 
   *result = NULL;
 
index 5afec91675365ae6ffe60e3da43af10ba58baa22..27c2df1b6ce759adf7e213ed9c8485e5b4c21f90 100644 (file)
@@ -24,9 +24,8 @@
 #include "tool_setup.h"
 
 #include "tool_util.h"
-
-#include "curlx.h"
-#include "memdebug.h" /* keep this as LAST include */
+#include <curlx.h>
+#include <memdebug.h> /* keep this as LAST include */
 
 #ifdef _WIN32
 
@@ -127,7 +126,7 @@ FILE *tool_execpath(const char *filename, char **pathp)
       /* If we have enough space, build the RC filename */
       remaining = sizeof(filebuffer) - strlen(filebuffer);
       if(strlen(filename) < remaining - 1) {
-        msnprintf(lastdirchar, remaining, "%s%s", DIR_CHAR, filename);
+        curl_msnprintf(lastdirchar, remaining, "%s%s", DIR_CHAR, filename);
         *pathp = filebuffer;
         return fopen(filebuffer, FOPEN_READTEXT);
       }
index 4db7b9759a153ed3165f58c91851cd6ace599bd3..678892833938b9087e038bbce010c893ef7c6692 100644 (file)
 #include <unixlib.h>
 #endif
 
-#include "curlx.h"
-
+#include <curlx.h>
 #include "curlmsg_vms.h"
 #include "tool_vms.h"
-
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 void decc$__posix_exit(int __status);
 void decc$exit(int __status);
index 335eb7a69e97f43610d4baab9aaee20207237c64..3081b7082d057237770b12b9aa764b487f9d3f99 100644 (file)
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "curlx.h"
+#include <curlx.h>
 #include "tool_cfgable.h"
 #include "tool_writeout.h"
 #include "tool_writeout_json.h"
-#include "dynbuf.h"
-
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 static int writeTime(FILE *stream, const struct writeoutvar *wovar,
                      struct per_transfer *per, CURLcode per_result,
index 04bacd48ba09c2191cfcfeed8f3ce912bb030a68..1f10942378b43d6c4f85285f8bcd8324de802ba5 100644 (file)
@@ -23,7 +23,7 @@
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "curlx.h"
+#include <curlx.h>
 #include "tool_cfgable.h"
 #include "tool_writeout_json.h"
 #include "tool_writeout.h"
@@ -36,7 +36,7 @@
    Return 0 on success, non-zero on error.
 */
 int jsonquoted(const char *in, size_t len,
-               struct curlx_dynbuf *out, bool lowercase)
+               struct dynbuf *out, bool lowercase)
 {
   const unsigned char *i = (const unsigned char *)in;
   const unsigned char *in_end = &i[len];
@@ -85,7 +85,7 @@ int jsonquoted(const char *in, size_t len,
 
 void jsonWriteString(FILE *stream, const char *in, bool lowercase)
 {
-  struct curlx_dynbuf out;
+  struct dynbuf out;
   curlx_dyn_init(&out, MAX_JSON_STRING);
 
   if(!jsonquoted(in, strlen(in), &out, lowercase)) {
index 91f5d93dc82bf607d1d5d774820ea143e93d02ec..6797fb35741e3633dee60a79447e8fecf049470b 100644 (file)
@@ -27,7 +27,7 @@
 #include "tool_writeout.h"
 
 int jsonquoted(const char *in, size_t len,
-               struct curlx_dynbuf *out, bool lowercase);
+               struct dynbuf *out, bool lowercase);
 
 void ourWriteOutJSON(FILE *stream, const struct writeoutvar mappings[],
                      size_t nentries,
index 1a0e71e0f069188d75cf2301b71a6f580a9d2b63..9dba7e4c1a1e2faa4dee704b91e21d8cc4ddef78 100644 (file)
--- a/src/var.c
+++ b/src/var.c
  ***************************************************************************/
 #include "tool_setup.h"
 
-#include "curlx.h"
-
+#include <curlx.h>
 #include "tool_cfgable.h"
 #include "tool_getparam.h"
 #include "tool_helpers.h"
 #include "tool_findfile.h"
 #include "tool_msgs.h"
 #include "tool_parsecfg.h"
-#include "dynbuf.h"
-#include "curl_base64.h"
 #include "tool_paramhlp.h"
 #include "tool_writeout_json.h"
 #include "var.h"
-
-#include "memdebug.h" /* keep this as LAST include */
+#include <memdebug.h> /* keep this as LAST include */
 
 #define MAX_EXPAND_CONTENT 10000000
 #define MAX_VAR_LEN 128 /* max length of a name */
@@ -99,7 +95,7 @@ static ParameterError varfunc(struct GlobalConfig *global,
                               size_t clen, /* content length */
                               char *f, /* functions */
                               size_t flen, /* function string length */
-                              struct curlx_dynbuf *out)
+                              struct dynbuf *out)
 {
   bool alloc = FALSE;
   ParameterError err = PARAM_OK;
@@ -228,7 +224,7 @@ static ParameterError varfunc(struct GlobalConfig *global,
 }
 
 ParameterError varexpand(struct GlobalConfig *global,
-                         const char *line, struct curlx_dynbuf *out,
+                         const char *line, struct dynbuf *out,
                          bool *replaced)
 {
   CURLcode result;
@@ -307,7 +303,7 @@ ParameterError varexpand(struct GlobalConfig *global,
         else {
           char *value;
           size_t vlen = 0;
-          struct curlx_dynbuf buf;
+          struct dynbuf buf;
           const struct tool_var *v = varcontent(global, name, nlen);
           if(v) {
             value = (char *)CURL_UNCONST(v->content);
index 5af6c1f4dd10ae4f84960db4bb430e0101335ae1..8e5b68508576356013c6f3bfd989baa140394a90 100644 (file)
--- a/src/var.h
+++ b/src/var.h
@@ -25,7 +25,7 @@
  ***************************************************************************/
 
 #include "tool_getparam.h"
-#include "dynbuf.h"
+#include <curlx.h>
 
 struct tool_var {
   struct tool_var *next;
@@ -38,7 +38,7 @@ struct GlobalConfig;
 
 ParameterError setvariable(struct GlobalConfig *global, const char *input);
 ParameterError varexpand(struct GlobalConfig *global,
-                         const char *line, struct curlx_dynbuf *out,
+                         const char *line, struct dynbuf *out,
                          bool *replaced);
 
 /* free everything */
index 0800ca284230421316916d63ea1883bcae0d7cad..4d53793037fd42fc56f115faa76de9e35a1d3f4a 100644 (file)
@@ -23,7 +23,7 @@ unit tests for strparse.c string parsing functions
 
 <verify>
 <stdout>
-Curl_str_word
+curlx_str_word
 0: ("word") 0, "word" [4], line 4
 1: ("word ") 0, "word" [4], line 4
 2: (" word ") 2, "" [0], line 0
@@ -33,7 +33,7 @@ Curl_str_word
 6: ("perfect") 0, "perfect" [7], line 7
 7: ("") 2, "" [0], line 0
 8: ("longerth") 1, "" [0], line 0
-Curl_str_until
+curlx_str_until
 0: ("word") 0, "wor" [3], line 3
 1: ("word ") 0, "wor" [3], line 3
 2: (" word ") 0, " wor" [4], line 4
@@ -43,7 +43,7 @@ Curl_str_until
 6: ("perfect") 0, "perfect" [7], line 7
 7: ("") 2, "" [0], line 0
 8: ("longerth") 1, "" [0], line 0
-Curl_str_quotedword
+curlx_str_quotedword
 0: (""word"") 0, "word" [4], line 6
 1: (""word") 4, "" [0], line 0
 2: ("word"") 3, "" [0], line 0
@@ -56,7 +56,7 @@ Curl_str_quotedword
 9: ("""") 0, "" [0], line 2
 10: ("") 3, "" [0], line 0
 11: (""longerth"") 1, "" [0], line 0
-Curl_str_single
+curlx_str_single
 0: ("a") 0, line 1
 1: ("aa") 0, line 1
 2: ("A") 5, line 0
@@ -64,7 +64,7 @@ Curl_str_single
 4: ("\") 5, line 0
 5: (" ") 5, line 0
 6: ("") 5, line 0
-Curl_str_singlespace
+curlx_str_singlespace
 0: ("a") 5, line 0
 1: ("aa") 5, line 0
 2: ("A") 5, line 0
@@ -75,7 +75,7 @@ Curl_str_singlespace
 7: ("
 ") 5, line 0
 8: ("") 5, line 0
-Curl_str_single
+curlx_str_single
 0: ("a") 0, line 1
 1: ("aa") 0, line 1
 2: ("A") 5, line 0
@@ -83,7 +83,7 @@ Curl_str_single
 4: ("\") 5, line 0
 5: (" ") 5, line 0
 6: ("") 5, line 0
-Curl_str_number
+curlx_str_number
 0: ("1") 0, [1] line 1
 1: ("10000") 7, [0] line 0
 2: ("1234") 0, [1234] line 4
@@ -96,7 +96,7 @@ Curl_str_number
 9: ("-12") 8, [0] line 0
 10: (" 123") 8, [0] line 0
 11: ("") 8, [0] line 0
-Curl_str_number varying max
+curlx_str_number varying max
 0: ("00") max 8 == 0, [0]
 1: ("1") max 8 == 0, [1]
 2: ("1") max 1 == 0, [1]
@@ -110,7 +110,7 @@ Curl_str_number varying max
 10: ("10") max 10 == 0, [10]
 11: ("11") max 10 == 7, [0]
 12: ("12") max 10 == 7, [0]
-Curl_str_hex varying max
+curlx_str_hex varying max
 0: ("00") max 8 == 0, [0]
 1: ("1") max 8 == 0, [1]
 2: ("1") max 1 == 0, [1]
@@ -131,7 +131,7 @@ Curl_str_hex varying max
 17: ("10") max 16 == 0, [16]
 18: ("11") max 16 == 7, [0]
 19: ("12") max 16 == 7, [0]
-Curl_str_octal varying max
+curlx_str_octal varying max
 0: ("00") max 4 == 0, [0]
 1: ("1") max 4 == 0, [1]
 2: ("1") max 4 == 0, [1]
@@ -147,7 +147,7 @@ Curl_str_octal varying max
 12: ("12") max 9 == 7, [0]
 13: ("13") max 9 == 7, [0]
 14: ("8") max 10 == 8, [0]
-Curl_str_number / max
+curlx_str_number / max
 0: ("9223372036854775807") 0, [9223372036854775807] line 19
 1: ("9223372036854775808") 7, [0] line 0
 2: ("18446744073709551615") 7, [0] line 0
@@ -167,7 +167,7 @@ Curl_str_number / max
 16: ("7777777777777777777") 0, [7777777777777777777] line 19
 17: ("8888888888888888888") 0, [8888888888888888888] line 19
 18: ("999999999999999999") 0, [999999999999999999] line 18
-Curl_str_newline
+curlx_str_newline
 0: (%61) 6, line 0
 1: (%61) 6, line 0
 2: (%41) 6, line 0
@@ -179,7 +179,7 @@ Curl_str_newline
 8: (%0d) 0, line 1
 9: (%0c) 6, line 0
 10: (%00) 6, line 0
-Curl_str_hex
+curlx_str_hex
 0: ("1") 0, [1] line 1
 1: ("1000") 0, [4096] line 4
 2: ("1234") 0, [4660] line 4
@@ -192,7 +192,7 @@ Curl_str_hex
 9: ("-12") 8, [0] line 0
 10: (" 123") 8, [0] line 0
 11: ("") 8, [0] line 0
-Curl_str_octal
+curlx_str_octal
 0: ("1") 0, [1] line 1
 1: ("1000") 0, [512] line 4
 2: ("1234") 0, [668] line 4
@@ -205,7 +205,7 @@ Curl_str_octal
 9: ("-12") 8, [0] line 0
 10: (" 123") 8, [0] line 0
 11: ("") 8, [0] line 0
-Curl_str_octal / max
+curlx_str_octal / max
 0: ("777777777777777777777") 0, [9223372036854775807] line 21
 1: ("1000000000000000000000") 7, [0] line 0
 2: ("111111111111111111111") 0, [1317624576693539401] line 21
@@ -214,7 +214,7 @@ Curl_str_octal / max
 5: ("444444444444444444444") 0, [5270498306774157604] line 21
 6: ("555555555555555555555") 0, [6588122883467697005] line 21
 7: ("666666666666666666666") 0, [7905747460161236406] line 21
-Curl_str_hex / max
+curlx_str_hex / max
 0: ("7FFFFFFFFFFFFFFF") 0, [9223372036854775807] line 16
 1: ("8000000000000000") 7, [0] line 0
 2: ("1111111111111111") 0, [1229782938247303441] line 16
index f6f80d6df984321cd3e48fa7eb93fea111bab6d8..e90337995286df525baa7810df77fcb760718d28 100644 (file)
@@ -22,7 +22,7 @@
 #
 ###########################################################################
 
-# Get 'LIBTESTPROGS', '*_SOURCES', 'TESTUTIL', 'TSTTRACE', 'WARNLESS', 'MULTIBYTE', 'INET_PTON', 'TIMEDIFF', 'THREADS',
+# Get 'LIBTESTPROGS', '*_SOURCES', 'TESTUTIL', 'TSTTRACE', 'WARNLESS', 'MULTIBYTE', 'INET_PTON', 'TIMEDIFF', 'THREADS', 'MEMPTR'
 # 'FIRSTFILES' variables
 curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
 include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
@@ -49,7 +49,7 @@ if(CURL_TEST_BUNDLES)
   list(APPEND libtests_SOURCES ${TESTUTIL} ${TSTTRACE})
   if(LIB_SELECTED STREQUAL LIB_SHARED)
     # These are part of the libcurl static lib. Add them here when linking shared.
-    list(APPEND libtests_SOURCES ${WARNLESS} ${MULTIBYTE} ${INET_PTON} ${TIMEDIFF} ${THREADS})
+    list(APPEND libtests_SOURCES ${WARNLESS} ${MULTIBYTE} ${INET_PTON} ${TIMEDIFF} ${THREADS} ${MEMPTR})
   endif()
 endif()
 
@@ -73,6 +73,7 @@ foreach(_target IN LISTS LIBTESTPROGS)
   target_include_directories(${_target_name} PRIVATE
     "${PROJECT_BINARY_DIR}/lib"            # for "curl_config.h"
     "${PROJECT_SOURCE_DIR}/lib"            # for "curl_setup.h"
+    "${PROJECT_SOURCE_DIR}/lib/curlx"      # for curlx
     "${PROJECT_SOURCE_DIR}/src"            # for "tool_binmode.h"
     "${PROJECT_SOURCE_DIR}/tests/libtest"  # to be able to build generated tests
     "${PROJECT_SOURCE_DIR}/tests/unit"     # for curlcheck.h
index a4f6edb7a0edbf3705a0d34824211ec75ec78dc8..497493cc2cd2bb78cdbb73e0a1caa73ff0e3975f 100644 (file)
@@ -35,6 +35,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc
 AM_CPPFLAGS = -I$(top_srcdir)/include        \
               -I$(top_builddir)/lib          \
               -I$(top_srcdir)/lib            \
+              -I$(top_srcdir)/lib/curlx      \
               -I$(top_srcdir)/src            \
               -I$(top_srcdir)/tests/libtest  \
               -I$(top_srcdir)/tests/unit
@@ -111,7 +112,7 @@ CLEANFILES += libtest_bundle.c
 if USE_CPPFLAG_CURL_STATICLIB
 else
 # These are part of the libcurl static lib. Add them here when linking shared.
-libtests_SOURCES += $(WARNLESS) $(MULTIBYTE) $(INET_PTON) $(TIMEDIFF) $(THREADS)
+libtests_SOURCES += $(WARNLESS) $(MULTIBYTE) $(INET_PTON) $(TIMEDIFF) $(THREADS) $(MEMPTR)
 endif
 else
 noinst_PROGRAMS = $(LIBTESTPROGS)
index 12ef21d9f4aad167a0498597df890d6429286e85..edf5a84c25ea83fd4d95b8bae5ef5dd0320cb013 100644 (file)
 # files used only in some libcurl test programs
 TESTUTIL = testutil.c testutil.h
 TSTTRACE = testtrace.c testtrace.h
-WARNLESS = ../../lib/warnless.c ../../lib/warnless.h
+WARNLESS = ../../lib/curlx/warnless.c ../../lib/curlx/warnless.h
 MULTIBYTE = ../../lib/curl_multibyte.c ../../lib/curl_multibyte.h
 THREADS = ../../lib/curl_threads.c ../../lib/curl_threads.h
+MEMPTR = memptr.c
 
 # these files are used in every single test program below
-TIMEDIFF = ../../lib/timediff.c ../../lib/timediff.h
+TIMEDIFF = ../../lib/curlx/timediff.c ../../lib/curlx/timediff.h
 FIRSTFILES = first.c first.h
 SUPPORTFILES = $(TIMEDIFF) $(FIRSTFILES) test.h
 
@@ -756,7 +757,7 @@ lib3104_SOURCES = lib3104.c $(SUPPORTFILES)
 
 lib3105_SOURCES = lib3105.c $(SUPPORTFILES)
 
-lib3207_SOURCES = lib3207.c $(SUPPORTFILES) $(TESTUTIL) $(THREADS) $(WARNLESS) $(MULTIBYTE)
+lib3207_SOURCES = lib3207.c $(SUPPORTFILES) $(TESTUTIL) $(THREADS) $(WARNLESS) $(MULTIBYTE) $(MEMPTR)
 lib3207_LDADD = $(TESTUTIL_LIBS)
 
 lib3208_SOURCES = lib3208.c $(SUPPORTFILES) $(TESTUTIL)
index d170b05fa27c9f0eb4e3ebf1f269a0a71a7f6b60..a10f87106d4bbb081569e29586a4440183db1683 100644 (file)
@@ -29,7 +29,7 @@
 #endif
 
 #include "memdebug.h"
-#include "timediff.h"
+#include "curlx/timediff.h"
 #include "tool_binmode.h"
 
 int select_wrapper(int nfds, fd_set *rd, fd_set *wr, fd_set *exc,
@@ -110,7 +110,7 @@ char *hexdump(const unsigned char *buf, size_t len)
   if(len > 200)
     return NULL;
   for(i = 0; i < len; i++, p += 3)
-    msnprintf(p, 4, "%02x ", buf[i]);
+    curl_msnprintf(p, 4, "%02x ", buf[i]);
   return dump;
 }
 
@@ -148,7 +148,7 @@ int main(int argc, char **argv)
     basearg = 2;
 
     if(argc < (basearg + 1)) {
-      fprintf(stderr, "Pass testname and URL as arguments please\n");
+      curl_mfprintf(stderr, "Pass testname and URL as arguments please\n");
       return 1;
     }
 
@@ -165,7 +165,7 @@ int main(int argc, char **argv)
     }
 
     if(!test_func) {
-      fprintf(stderr, "Test '%s' not found.\n", test_name);
+      curl_mfprintf(stderr, "Test '%s' not found.\n", test_name);
       return 1;
     }
   }
@@ -173,7 +173,7 @@ int main(int argc, char **argv)
   basearg = 1;
 
   if(argc < (basearg + 1)) {
-    fprintf(stderr, "Pass URL as argument please\n");
+    curl_mfprintf(stderr, "Pass URL as argument please\n");
     return 1;
   }
 
@@ -191,10 +191,10 @@ int main(int argc, char **argv)
 
   URL = argv[basearg]; /* provide this to the rest */
 
-  fprintf(stderr, "URL: %s\n", URL);
+  curl_mfprintf(stderr, "URL: %s\n", URL);
 
   result = test_func(URL);
-  fprintf(stderr, "Test ended with result %d\n", result);
+  curl_mfprintf(stderr, "Test ended with result %d\n", result);
 
 #ifdef _WIN32
   /* flush buffers of all streams regardless of mode */
index 114f03ba7b9c82af1db24ec1c142930f5bc4770a..1db7c7d8679c6bc75ec11446e42cfe5018526319 100644 (file)
@@ -93,7 +93,7 @@ static int onetest(CURL *curl, const char *url, const struct testparams *p,
   replyselector = (p->flags & F_CONTENTRANGE) ? 1 : 0;
   if(p->flags & F_HTTP416)
     replyselector += 2;
-  msnprintf(urlbuf, sizeof(urlbuf), "%s%04u", url, replyselector);
+  curl_msnprintf(urlbuf, sizeof(urlbuf), "%s%04u", url, replyselector);
   test_setopt(curl, CURLOPT_URL, urlbuf);
   test_setopt(curl, CURLOPT_VERBOSE, 1L);
   test_setopt(curl, CURLOPT_RESUME_FROM, (p->flags & F_RESUME) ? 3L : 0L);
@@ -103,22 +103,22 @@ static int onetest(CURL *curl, const char *url, const struct testparams *p,
   hasbody = 0;
   res = curl_easy_perform(curl);
   if(res != p->result) {
-    printf("%zd: bad error code (%d): resume=%s, fail=%s, http416=%s, "
-           "content-range=%s, expected=%d\n", num, res,
-           (p->flags & F_RESUME) ? "yes": "no",
-           (p->flags & F_FAIL) ? "yes": "no",
-           (p->flags & F_HTTP416) ? "yes": "no",
-           (p->flags & F_CONTENTRANGE) ? "yes": "no",
-           p->result);
+    curl_mprintf("%zd: bad error code (%d): resume=%s, fail=%s, http416=%s, "
+                 "content-range=%s, expected=%d\n", num, res,
+                 (p->flags & F_RESUME) ? "yes": "no",
+                 (p->flags & F_FAIL) ? "yes": "no",
+                 (p->flags & F_HTTP416) ? "yes": "no",
+                 (p->flags & F_CONTENTRANGE) ? "yes": "no",
+                 p->result);
     return 1;
   }
   if(hasbody && (p->flags & F_IGNOREBODY)) {
-    printf("body should be ignored and is not: resume=%s, fail=%s, "
-           "http416=%s, content-range=%s\n",
-           (p->flags & F_RESUME) ? "yes": "no",
-           (p->flags & F_FAIL) ? "yes": "no",
-           (p->flags & F_HTTP416) ? "yes": "no",
-           (p->flags & F_CONTENTRANGE) ? "yes": "no");
+    curl_mprintf("body should be ignored and is not: resume=%s, fail=%s, "
+                 "http416=%s, content-range=%s\n",
+                 (p->flags & F_RESUME) ? "yes": "no",
+                 (p->flags & F_FAIL) ? "yes": "no",
+                 (p->flags & F_HTTP416) ? "yes": "no",
+                 (p->flags & F_CONTENTRANGE) ? "yes": "no");
     return 1;
   }
   return 0;
@@ -139,14 +139,14 @@ CURLcode test(char *URL)
   int status = 0;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   for(i = 0; i < CURL_ARRAYSIZE(testparams); i++) {
     curl = curl_easy_init();
     if(!curl) {
-      fprintf(stderr, "curl_easy_init() failed\n");
+      curl_mfprintf(stderr, "curl_easy_init() failed\n");
       curl_global_cleanup();
       return TEST_ERR_MAJOR_BAD;
     }
@@ -161,7 +161,7 @@ CURLcode test(char *URL)
   }
 
   curl_global_cleanup();
-  printf("%d\n", status);
+  curl_mprintf("%d\n", status);
   return (CURLcode)status;
 
 test_cleanup:
index 650746a37816ca8ffe54d15fb76f87a0017a0413..71678563f2fa1998978f6a170a0443e4e69c38e6 100644 (file)
@@ -50,26 +50,27 @@ static size_t header_callback(char *ptr, size_t size, size_t nmemb,
     long httpcode = 0;
     /* end of a response */
     result = curl_easy_getinfo(st->easy, CURLINFO_RESPONSE_CODE, &httpcode);
-    fprintf(stderr, "header_callback, get status: %ld, %d\n",
-            httpcode, result);
+    curl_mfprintf(stderr, "header_callback, get status: %ld, %d\n",
+                  httpcode, result);
     if(httpcode < 100 || httpcode >= 1000) {
-      fprintf(stderr, "header_callback, invalid status: %ld, %d\n",
-              httpcode, result);
+      curl_mfprintf(stderr, "header_callback, invalid status: %ld, %d\n",
+                    httpcode, result);
       return CURLE_WRITE_ERROR;
     }
     st->http_status = (int)httpcode;
     if(st->http_status >= 200 && st->http_status < 300) {
       result = curl_easy_getinfo(st->easy, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
                                  &clen);
-      fprintf(stderr, "header_callback, info Content-Length: %ld, %d\n",
-              (long)clen, result);
+      curl_mfprintf(stderr, "header_callback, info Content-Length: %ld, %d\n",
+                    (long)clen, result);
       if(result) {
         st->result = result;
         return CURLE_WRITE_ERROR;
       }
       if(clen < 0) {
-        fprintf(stderr, "header_callback, expected known Content-Length, "
-                "got: %ld\n", (long)clen);
+        curl_mfprintf(stderr,
+                      "header_callback, expected known Content-Length, "
+                      "got: %ld\n", (long)clen);
         return CURLE_WRITE_ERROR;
       }
     }
index 9f4ff07eac017008d43b237a2fbf3f980f526e7f..b5944ef3137b6335aa1f80437808ea7f57e355bf 100644 (file)
@@ -60,7 +60,7 @@ CURLcode test(char *URL)
     int num;
     mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
     if(mres != CURLM_OK) {
-      printf("curl_multi_wait() returned %d\n", mres);
+      curl_mprintf("curl_multi_wait() returned %d\n", mres);
       res = TEST_ERR_MAJOR_BAD;
       goto test_cleanup;
     }
index 34b4ea7ada462c330b2fbdba8e095bf4dc59e2f1..2194127ed592f21b21ea267610387d063b3cf685 100644 (file)
@@ -84,7 +84,7 @@ CURLcode test(char *URL)
 
     abort_on_test_timeout();
 
-    fprintf(stderr, "ping\n");
+    curl_mfprintf(stderr, "ping\n");
     before = tutil_tvnow();
 
     multi_perform(mhandle, &still_running);
@@ -93,7 +93,7 @@ CURLcode test(char *URL)
 
     after = tutil_tvnow();
     e = tutil_tvdiff(after, before);
-    fprintf(stderr, "pong = %ld\n", e);
+    curl_mfprintf(stderr, "pong = %ld\n", e);
 
     if(e > MAX_BLOCKED_TIME_MS) {
       res = CURLE_TOO_LARGE;
index d4ebdf50157252a2f57a21daa5b5e6f5436b512d..cb7a8c2ae644f88d20660520a2a410164f5153d2 100644 (file)
@@ -57,14 +57,14 @@ CURLcode test(char *URL)
     return res;
   }
 
-  msnprintf(redirect, sizeof(redirect), "google.com:%s:%s", libtest_arg2,
-            libtest_arg3);
+  curl_msnprintf(redirect, sizeof(redirect), "google.com:%s:%s", libtest_arg2,
+                 libtest_arg3);
 
   start_test_timing();
 
   dns_cache_list = curl_slist_append(NULL, redirect);
   if(!dns_cache_list) {
-    fprintf(stderr, "curl_slist_append() failed\n");
+    curl_mfprintf(stderr, "curl_slist_append() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 2dbda6d0d07060661b0ad17f30834fb6a6592546..d7e4cb0d6281f359bcf032b3224751e4f9d7cebd 100644 (file)
@@ -48,12 +48,12 @@ CURLcode test(char *URL)
 
   /* Create fake DNS entries for serverX.example.com for all handles */
   for(i = 0; i < NUM_HANDLES; i++) {
-    msnprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s",
-              i + 1, port, address);
-    printf("%s\n", dnsentry);
+    curl_msnprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s",
+                   i + 1, port, address);
+    curl_mprintf("%s\n", dnsentry);
     slist2 = curl_slist_append(slist, dnsentry);
     if(!slist2) {
-      fprintf(stderr, "curl_slist_append() failed\n");
+      curl_mfprintf(stderr, "curl_slist_append() failed\n");
       goto test_cleanup;
     }
     slist = slist2;
@@ -72,9 +72,9 @@ CURLcode test(char *URL)
     /* get an easy handle */
     easy_init(curl[i]);
     /* specify target */
-    msnprintf(target_url, sizeof(target_url),
-              "http://server%d.example.com:%s/path/1506%04i",
-              i + 1, port, i + 1);
+    curl_msnprintf(target_url, sizeof(target_url),
+                   "http://server%d.example.com:%s/path/1506%04i",
+                   i + 1, port, i + 1);
     target_url[sizeof(target_url) - 1] = '\0';
     easy_setopt(curl[i], CURLOPT_URL, target_url);
     /* go verbose */
@@ -85,7 +85,7 @@ CURLcode test(char *URL)
     easy_setopt(curl[i], CURLOPT_RESOLVE, slist);
   }
 
-  fprintf(stderr, "Start at URL 0\n");
+  curl_mfprintf(stderr, "Start at URL 0\n");
 
   for(i = 0; i < NUM_HANDLES; i++) {
     /* add handle to multi */
index fc788459cd66a5bf087c0f6e640ef711f42f117e..7525ec534298d850dd30f57a05c114903c88c7cc 100644 (file)
@@ -124,8 +124,8 @@ CURLcode test(char *URL)
     rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
 
     if(tutil_tvdiff(tutil_tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
-      fprintf(stderr, "ABORTING TEST, since it seems "
-              "that it would have run forever.\n");
+      curl_mfprintf(stderr, "ABORTING TEST, since it seems "
+                    "that it would have run forever.\n");
       break;
     }
 
index bece5fc927446d875ac8234e9b657f7aff83c68d..5e8547bb8ac08096cf24af5d21f4afc865b6b64c 100644 (file)
@@ -45,7 +45,7 @@ test_cleanup:
   curl_multi_cleanup(m);
   curl_global_cleanup();
 
-  printf("We are done\n");
+  curl_mprintf("We are done\n");
 
   return res;
 }
index 328ebd5d066f6f1aaba6ca78f45f45c47dc6a249..a289da56dcfbedb8cca1e2fa895047ce79c64e3a 100644 (file)
@@ -55,24 +55,24 @@ CURLcode test(char *URL)
 
   code = curl_easy_perform(curl);
   if(CURLE_OK != code) {
-    fprintf(stderr, "%s:%d curl_easy_perform() failed, "
-            "with code %d (%s)\n",
-            __FILE__, __LINE__, code, curl_easy_strerror(code));
+    curl_mfprintf(stderr, "%s:%d curl_easy_perform() failed, "
+                  "with code %d (%s)\n",
+                  __FILE__, __LINE__, code, curl_easy_strerror(code));
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
 
   code = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &headerSize);
   if(CURLE_OK != code) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
-            "with code %d (%s)\n",
-            __FILE__, __LINE__, code, curl_easy_strerror(code));
+    curl_mfprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
+                  "with code %d (%s)\n",
+                  __FILE__, __LINE__, code, curl_easy_strerror(code));
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
 
-  printf("header length is ........: %ld\n", headerSize);
-  printf("header length should be..: %lu\n", realHeaderSize);
+  curl_mprintf("header length is ........: %ld\n", headerSize);
+  curl_mprintf("header length should be..: %lu\n", realHeaderSize);
 
 test_cleanup:
 
index b3764b8b64ee962760cbd78c3df03a15980a93cd..d039b7b0e3553d7f824366be1ede051be85c16bb 100644 (file)
@@ -46,12 +46,12 @@ CURLcode test(char *URL)
 
   /* Create fake DNS entries for serverX.example.com for all handles */
   for(i = 0; i < NUM_URLS; i++) {
-    msnprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1,
-              port, address);
-    printf("%s\n", dnsentry);
+    curl_msnprintf(dnsentry, sizeof(dnsentry),
+                   "server%d.example.com:%s:%s", i + 1, port, address);
+    curl_mprintf("%s\n", dnsentry);
     slist2 = curl_slist_append(slist, dnsentry);
     if(!slist2) {
-      fprintf(stderr, "curl_slist_append() failed\n");
+      curl_mfprintf(stderr, "curl_slist_append() failed\n");
       goto test_cleanup;
     }
     slist = slist2;
@@ -76,9 +76,9 @@ CURLcode test(char *URL)
   /* get NUM_HANDLES easy handles */
   for(i = 0; i < NUM_URLS; i++) {
     /* specify target */
-    msnprintf(target_url, sizeof(target_url),
-              "http://server%d.example.com:%s/path/1510%04i",
-              i + 1, port, i + 1);
+    curl_msnprintf(target_url, sizeof(target_url),
+                   "http://server%d.example.com:%s/path/1510%04i",
+                   i + 1, port, i + 1);
     target_url[sizeof(target_url) - 1] = '\0';
     easy_setopt(curl, CURLOPT_URL, target_url);
 
index a93bfc029a3018ece53a738f058deb12a5d1ed16..710d71517c914745aecb87713b60aaf64a380fc2 100644 (file)
@@ -47,13 +47,13 @@ CURLcode test(char *URL)
   (void)URL; /* URL is setup in the code */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  msnprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s",
-            port, address);
-  printf("%s\n", dnsentry);
+  curl_msnprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s",
+                 port, address);
+  curl_mprintf("%s\n", dnsentry);
   slist = curl_slist_append(slist, dnsentry);
 
   /* get NUM_HANDLES easy handles */
@@ -61,9 +61,9 @@ CURLcode test(char *URL)
     /* get an easy handle */
     easy_init(curl[i]);
     /* specify target */
-    msnprintf(target_url, sizeof(target_url),
-              "http://server.example.curl:%s/path/1512%04i",
-              port, i + 1);
+    curl_msnprintf(target_url, sizeof(target_url),
+                   "http://server.example.curl:%s/path/1512%04i",
+                   port, i + 1);
     target_url[sizeof(target_url) - 1] = '\0';
     easy_setopt(curl[i], CURLOPT_URL, target_url);
     /* go verbose */
index 392e6c6121f5f76320ded4e8dfb87f0714e9f734..433f6f1aec5d2f5d14bbb067ee00a49c9ca601c0 100644 (file)
@@ -43,7 +43,7 @@ static int progressKiller(void *arg,
   (void)dlnow;
   (void)ultotal;
   (void)ulnow;
-  printf("PROGRESSFUNCTION called\n");
+  curl_mprintf("PROGRESSFUNCTION called\n");
   return 1;
 }
 
index 39e343744c0985a0a9bc19076b3cde3a39fcd936..6c07c7901b22dc68eebfb5053b4bbd3e68e08a6d 100644 (file)
@@ -114,8 +114,8 @@ CURLcode test(char *URL)
   int i;
   int count = 2;
 
-  msnprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s",
-            port, address);
+  curl_msnprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s",
+                 port, address);
 
   start_test_timing();
 
@@ -125,13 +125,13 @@ CURLcode test(char *URL)
 
   for(i = 1; i <= count; i++) {
     char target_url[256];
-    msnprintf(target_url, sizeof(target_url),
-              "http://testserver.example.com:%s/%s%04d", port, path, i);
+    curl_msnprintf(target_url, sizeof(target_url),
+                   "http://testserver.example.com:%s/%s%04d", port, path, i);
 
     /* second request must succeed like the first one */
     res = do_one_request(multi, target_url, dns_entry);
     if(res != CURLE_OK) {
-      fprintf(stderr, "request %s failed with %d\n", target_url, res);
+      curl_mfprintf(stderr, "request %s failed with %d\n", target_url, res);
       goto test_cleanup;
     }
 
index 571b7585af8a7fb48a734d62bbc3bb3778cdaec8..3ae6c03c4d75902330ec5a3a084f72bd02667224 100644 (file)
@@ -62,8 +62,8 @@ CURLcode test(char *URL)
 
   if(!strcmp(URL, "check")) {
 #if (defined(_WIN32) || defined(__CYGWIN__))
-    printf("Windows TCP does not deliver response data but reports "
-           "CONNABORTED\n");
+    curl_mprintf("Windows TCP does not deliver response data but reports "
+                 "CONNABORTED\n");
     return TEST_ERR_FAILURE; /* skip since it fails on Windows without
                                 workaround */
 #else
@@ -75,13 +75,13 @@ CURLcode test(char *URL)
   pooh.sizeleft = strlen(testdata);
 
   if(curl_global_init(CURL_GLOBAL_ALL)) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 5588ea098a42fff39e31907ec1492b02c88456c9..928462e0a0461cb77407565f914880639f81e29c 100644 (file)
@@ -50,7 +50,7 @@ CURLcode test(char *URL)
 #endif
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -85,16 +85,16 @@ CURLcode test(char *URL)
   curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &redirectUrl);
   test_setopt(curl, CURLOPT_WRITEFUNCTION, writecb);
 
-  printf("res %d\n"
-         "status %ld\n"
-         "redirects %ld\n"
-         "effectiveurl %s\n"
-         "redirecturl %s\n",
-         res,
-         curlResponseCode,
-         curlRedirectCount,
-         effectiveUrl,
-         redirectUrl ? redirectUrl : "blank");
+  curl_mprintf("res %d\n"
+               "status %ld\n"
+               "redirects %ld\n"
+               "effectiveurl %s\n"
+               "redirecturl %s\n",
+               res,
+               curlResponseCode,
+               curlRedirectCount,
+               effectiveUrl,
+               redirectUrl ? redirectUrl : "blank");
 
 test_cleanup:
 
index 8e5f6a9be04f48b096de8be5ed57496aa2ff0fd8..f9070945caed96adbe05edbd13863b7afc10d82c 100644 (file)
@@ -79,13 +79,13 @@ CURLcode test(char *URL)
   struct upload_status upload_ctx = {0};
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 3d171009b75589c29db1e21d7cbcceb63a92506d..1c0d945293f387b2651336e7740e6b0337186e98 100644 (file)
@@ -79,18 +79,18 @@ CURLcode test(char *URL)
     curl_off_t uploadSize;
     curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD_T, &uploadSize);
 
-    printf("uploadSize = %ld\n", (long)uploadSize);
+    curl_mprintf("uploadSize = %ld\n", (long)uploadSize);
 
     if((size_t) uploadSize == sizeof(g_Data)) {
-      printf("!!!!!!!!!! PASS\n");
+      curl_mprintf("!!!!!!!!!! PASS\n");
     }
     else {
-      printf("sent %d, libcurl says %d\n",
-             (int)sizeof(g_Data), (int)uploadSize);
+      curl_mprintf("sent %d, libcurl says %d\n",
+                   (int)sizeof(g_Data), (int)uploadSize);
     }
   }
   else {
-    printf("curl_easy_perform() failed. e = %d\n", code);
+    curl_mprintf("curl_easy_perform() failed. e = %d\n", code);
   }
 test_cleanup:
   curl_slist_free_all(pHeaderList);
index d72ef038c62f2483501e3cebdbe238d13ba9e312..80e01aea6dff128a5fe78eacce6b79f0e2157d56 100644 (file)
@@ -70,11 +70,11 @@ CURLcode test(char *URL)
 
   ret = run(hnd, 1, 2);
   if(ret)
-    fprintf(stderr, "error (%d) %s\n", ret, buffer);
+    curl_mfprintf(stderr, "error (%d) %s\n", ret, buffer);
 
   ret = run(hnd, 12000, 1);
   if(ret != CURLE_OPERATION_TIMEDOUT)
-    fprintf(stderr, "error (%d) %s\n", ret, buffer);
+    curl_mfprintf(stderr, "error (%d) %s\n", ret, buffer);
   else
     ret = CURLE_OK;
 
index e14b766e81ad8c0ff226808f142e5b30cf4573c7..481384320f780704cc175b015c6e823693317f0e 100644 (file)
@@ -54,13 +54,13 @@ CURLcode test(char *URL)
   struct curl_slist *hhl = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 3e14c656805f32e31dfa93fc45883cf2f0f87e9e..cf6ca1e4297935fed603307239e78a31216fb5d5 100644 (file)
@@ -52,13 +52,13 @@ CURLcode test(char *URL)
   struct curl_slist *hhl = NULL, *phl = NULL, *tmp = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index fcc2eb3aa24cef7f578cf25782add066c0dc39cd..aa5aa286ab37034153dabfb3816bb45ac90f13ea 100644 (file)
@@ -53,13 +53,13 @@ CURLcode test(char *URL)
   struct curl_slist *hhl = NULL, *tmp = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 43a6bbb806f7678c18cb2d12aa30e082674fdde1..7cc21c7b0929f0ff9953f661928506afd804300e 100644 (file)
@@ -35,13 +35,13 @@ CURLcode test(char *URL)
   struct curl_slist *phl = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 51d3eae581493d90a6653dd4e1278971c7463a90..fb11ab16526f7ea312293576e0ff5a4902311024 100644 (file)
@@ -31,17 +31,17 @@ CURLcode test(char *URL)
   CURL *curl = NULL;
   CURLcode res = CURLE_FAILED_INIT;
   char bURL[512];
-  msnprintf(bURL, sizeof(bURL),
-            "%s HTTP/1.1\r\nGET http://1529.com/1529", URL);
+  curl_msnprintf(bURL, sizeof(bURL),
+                 "%s HTTP/1.1\r\nGET http://1529.com/1529", URL);
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 6b86cdb6fd646cd7609c81b694a48c4c9839f99d..bb725eea66a2e8a3e98cdc1cb1958e5cc8f1f381 100644 (file)
@@ -33,7 +33,7 @@ static curl_socket_t opensocket(void *clientp,
   (void)purpose;
   (void)address;
   (void)clientp;
-  fprintf(stderr, "opensocket() returns CURL_SOCKET_BAD\n");
+  curl_mfprintf(stderr, "opensocket() returns CURL_SOCKET_BAD\n");
   return CURL_SOCKET_BAD;
 }
 
@@ -44,13 +44,13 @@ CURLcode test(char *URL)
   (void)URL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index ea250b607ef590334de638f43f65ec5e01dac185..1155296fccb8f6ba79e9708b57ee1ac9b863f745 100644 (file)
@@ -98,7 +98,7 @@ CURLcode test(char *URL)
     mc = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
     if(mc != CURLM_OK) {
-      fprintf(stderr, "curl_multi_fdset() failed, code %d.\n", mc);
+      curl_mfprintf(stderr, "curl_multi_fdset() failed, code %d.\n", mc);
       break;
     }
 
@@ -142,7 +142,8 @@ CURLcode test(char *URL)
   do {
     msg = curl_multi_info_read(multi_handle, &msgs_left);
     if(msg && msg->msg == CURLMSG_DONE) {
-      printf("HTTP transfer completed with status %d\n", msg->data.result);
+      curl_mprintf("HTTP transfer completed with status %d\n",
+                   msg->data.result);
       break;
     }
 
index 22b1aadaa3ae403f33e03ccde778f069e9cb540e..c9fd4e66bc5869a40bb4410bd79ca133d8ff2a77 100644 (file)
@@ -41,20 +41,22 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_perform() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
 
   res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpcode);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(httpcode != 200) {
-    fprintf(stderr, "%s:%d unexpected response code %ld\n",
-            __FILE__, __LINE__, httpcode);
+    curl_mfprintf(stderr, "%s:%d unexpected response code %ld\n",
+                  __FILE__, __LINE__, httpcode);
     res = CURLE_HTTP_RETURNED_ERROR;
     goto test_cleanup;
   }
@@ -64,13 +66,16 @@ CURLcode test(char *URL)
 
   res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpcode);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(httpcode) {
-    fprintf(stderr, "%s:%d curl_easy_reset failed to zero the response code\n"
-            "possible regression of github bug 1017\n", __FILE__, __LINE__);
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_reset failed to zero the response code\n"
+                  "possible regression of github bug 1017\n",
+                  __FILE__, __LINE__);
     res = CURLE_HTTP_RETURNED_ERROR;
     goto test_cleanup;
   }
index 4f0a39e8aa2534f7578f322078b7ddbb79c01605..68fdb2b6d2b2948f855ab6db2f2830299d5dd8cd 100644 (file)
@@ -107,18 +107,19 @@ static CURLcode perform_and_check_connections(CURL *curl,
 
   res = curl_easy_perform(curl);
   if(res != CURLE_OK) {
-    fprintf(stderr, "curl_easy_perform() failed with %d\n", res);
+    curl_mfprintf(stderr, "curl_easy_perform() failed with %d\n", res);
     return TEST_ERR_MAJOR_BAD;
   }
 
   res = curl_easy_getinfo(curl, CURLINFO_NUM_CONNECTS, &connections);
   if(res != CURLE_OK) {
-    fprintf(stderr, "curl_easy_getinfo() failed\n");
+    curl_mfprintf(stderr, "curl_easy_getinfo() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
-  fprintf(stderr, "%s: expected: %ld connections; actual: %ld connections\n",
-          description, expected_connections, connections);
+  curl_mfprintf(stderr,
+                "%s: expected: %ld connections; actual: %ld connections\n",
+                description, expected_connections, connections);
 
   if(connections != expected_connections) {
     return TEST_ERR_FAILURE;
@@ -136,13 +137,13 @@ CURLcode test(char *URL)
   CURLcode result;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index a9a7d73d857e7bb008b732d8d69f6e4d2db27791..467691c032e97788615be01c3390fd568e71ac9b 100644 (file)
@@ -42,13 +42,15 @@ CURLcode test(char *URL)
 
   res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(filetime != -1) {
-    fprintf(stderr, "%s:%d filetime init failed; expected -1 but is %ld\n",
-            __FILE__, __LINE__, filetime);
+    curl_mfprintf(stderr,
+                  "%s:%d filetime init failed; expected -1 but is %ld\n",
+                  __FILE__, __LINE__, filetime);
     res = CURLE_FAILED_INIT;
     goto test_cleanup;
   }
@@ -58,8 +60,9 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_perform() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
 
@@ -68,14 +71,15 @@ CURLcode test(char *URL)
 
   res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(filetime != 30) {
-    fprintf(stderr, "%s:%d filetime of http resource is incorrect; "
-            "expected 30 but is %ld\n",
-            __FILE__, __LINE__, filetime);
+    curl_mfprintf(stderr, "%s:%d filetime of http resource is incorrect; "
+                  "expected 30 but is %ld\n",
+                  __FILE__, __LINE__, filetime);
     res = CURLE_HTTP_RETURNED_ERROR;
     goto test_cleanup;
   }
@@ -85,21 +89,23 @@ CURLcode test(char *URL)
 
   dupe = curl_easy_duphandle(curl);
   if(!dupe) {
-    fprintf(stderr, "%s:%d curl_easy_duphandle() failed\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d curl_easy_duphandle() failed\n",
+                  __FILE__, __LINE__);
     res = CURLE_FAILED_INIT;
     goto test_cleanup;
   }
 
   res = curl_easy_getinfo(dupe, CURLINFO_FILETIME, &filetime);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(filetime != -1) {
-    fprintf(stderr, "%s:%d filetime init failed; expected -1 but is %ld\n",
-            __FILE__, __LINE__, filetime);
+    curl_mfprintf(stderr,
+                  "%s:%d filetime init failed; expected -1 but is %ld\n",
+                  __FILE__, __LINE__, filetime);
     res = CURLE_FAILED_INIT;
     goto test_cleanup;
   }
@@ -112,13 +118,15 @@ CURLcode test(char *URL)
 
   res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(filetime != -1) {
-    fprintf(stderr, "%s:%d filetime init failed; expected -1 but is %ld\n",
-            __FILE__, __LINE__, filetime);
+    curl_mfprintf(stderr,
+                  "%s:%d filetime init failed; expected -1 but is %ld\n",
+                  __FILE__, __LINE__, filetime);
     res = CURLE_FAILED_INIT;
     goto test_cleanup;
   }
index 80589d8938fc810d2c79e0483806249b8c56fd6f..71d7466d58d7a55d51186d810e8af8a763f36697 100644 (file)
@@ -44,13 +44,15 @@ CURLcode test(char *URL)
     res = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
   )
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(protocol) {
-    fprintf(stderr, "%s:%d protocol init failed; expected 0 but is %ld\n",
-            __FILE__, __LINE__, protocol);
+    curl_mfprintf(stderr,
+                  "%s:%d protocol init failed; expected 0 but is %ld\n",
+                  __FILE__, __LINE__, protocol);
     res = CURLE_FAILED_INIT;
     goto test_cleanup;
   }
@@ -59,8 +61,9 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_perform() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
 
@@ -71,14 +74,16 @@ CURLcode test(char *URL)
     res = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
   )
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(protocol != CURLPROTO_HTTP) {
-    fprintf(stderr, "%s:%d protocol of http resource is incorrect; "
-            "expected %d but is %ld\n",
-            __FILE__, __LINE__, CURLPROTO_HTTP, protocol);
+    curl_mfprintf(stderr,
+                  "%s:%d protocol of http resource is incorrect; "
+                  "expected %d but is %ld\n",
+                  __FILE__, __LINE__, CURLPROTO_HTTP, protocol);
     res = CURLE_HTTP_RETURNED_ERROR;
     goto test_cleanup;
   }
@@ -88,8 +93,8 @@ CURLcode test(char *URL)
 
   dupe = curl_easy_duphandle(curl);
   if(!dupe) {
-    fprintf(stderr, "%s:%d curl_easy_duphandle() failed\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d curl_easy_duphandle() failed\n",
+                  __FILE__, __LINE__);
     res = CURLE_FAILED_INIT;
     goto test_cleanup;
   }
@@ -98,13 +103,15 @@ CURLcode test(char *URL)
     res = curl_easy_getinfo(dupe, CURLINFO_PROTOCOL, &protocol);
   )
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(protocol) {
-    fprintf(stderr, "%s:%d protocol init failed; expected 0 but is %ld\n",
-            __FILE__, __LINE__, protocol);
+    curl_mfprintf(stderr,
+                  "%s:%d protocol init failed; expected 0 but is %ld\n",
+                  __FILE__, __LINE__, protocol);
     res = CURLE_FAILED_INIT;
     goto test_cleanup;
   }
@@ -119,13 +126,15 @@ CURLcode test(char *URL)
     res = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
   )
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(protocol) {
-    fprintf(stderr, "%s:%d protocol init failed; expected 0 but is %ld\n",
-            __FILE__, __LINE__, protocol);
+    curl_mfprintf(stderr,
+                  "%s:%d protocol init failed; expected 0 but is %ld\n",
+                  __FILE__, __LINE__, protocol);
     res = CURLE_FAILED_INIT;
     goto test_cleanup;
   }
index 7bc9e718b6fed9703538e1322a73aa292664ec11..fea7e1acf6ac03bf7a905faff2ceafc6664f544e 100644 (file)
@@ -42,13 +42,15 @@ CURLcode test(char *URL)
 
   res = curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(scheme) {
-    fprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr,
+                  "%s:%d scheme init failed; expected NULL\n",
+                  __FILE__, __LINE__);
     res = CURLE_FAILED_INIT;
     goto test_cleanup;
   }
@@ -57,8 +59,9 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_perform() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
 
@@ -67,15 +70,16 @@ CURLcode test(char *URL)
 
   res = curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(!scheme || memcmp(scheme, "http", 5) != 0) {
-    fprintf(stderr, "%s:%d scheme of http resource is incorrect; "
-            "expected 'http' but is %s\n",
-            __FILE__, __LINE__,
-            (scheme == NULL ? "NULL" : "invalid"));
+    curl_mfprintf(stderr, "%s:%d scheme of http resource is incorrect; "
+                  "expected 'http' but is %s\n",
+                  __FILE__, __LINE__,
+                  (scheme == NULL ? "NULL" : "invalid"));
     res = CURLE_HTTP_RETURNED_ERROR;
     goto test_cleanup;
   }
@@ -85,21 +89,22 @@ CURLcode test(char *URL)
 
   dupe = curl_easy_duphandle(curl);
   if(!dupe) {
-    fprintf(stderr, "%s:%d curl_easy_duphandle() failed\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d curl_easy_duphandle() failed\n",
+                  __FILE__, __LINE__);
     res = CURLE_FAILED_INIT;
     goto test_cleanup;
   }
 
   res = curl_easy_getinfo(dupe, CURLINFO_SCHEME, &scheme);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(scheme) {
-    fprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
+                  __FILE__, __LINE__);
     res = CURLE_FAILED_INIT;
     goto test_cleanup;
   }
@@ -112,13 +117,14 @@ CURLcode test(char *URL)
 
   res = curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme);
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_easy_getinfo() failed with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
   if(scheme) {
-    fprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
+                  __FILE__, __LINE__);
     res = CURLE_FAILED_INIT;
     goto test_cleanup;
   }
index 1a35cf678d72c42063b105440c87b12eb36a5db9..88f99bc60ebd4e51ed622e7adbef0ec42d0a6937 100644 (file)
@@ -38,13 +38,13 @@ CURLcode test(char *URL)
   (void)URL; /* we don't use this */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   asize = (int)sizeof(a);
   ptr = curl_easy_escape(NULL, (const char *)a, asize);
-  printf("%s\n", ptr);
+  curl_mprintf("%s\n", ptr);
   curl_free(ptr);
 
   /* deprecated API */
@@ -53,12 +53,12 @@ CURLcode test(char *URL)
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
-  printf("%s\n", ptr);
+  curl_mprintf("%s\n", ptr);
 
   raw = curl_easy_unescape(NULL, ptr, (int)strlen(ptr), &outlen);
-  printf("outlen == %d\n", outlen);
-  printf("unescape == original? %s\n",
-         memcmp(raw, a, outlen) ? "no" : "YES");
+  curl_mprintf("outlen == %d\n", outlen);
+  curl_mprintf("unescape == original? %s\n",
+               memcmp(raw, a, outlen) ? "no" : "YES");
   curl_free(raw);
 
   /* deprecated API */
@@ -68,20 +68,20 @@ CURLcode test(char *URL)
     goto test_cleanup;
   }
   outlen = (int)strlen(raw);
-  printf("[old] outlen == %d\n", outlen);
-  printf("[old] unescape == original? %s\n",
-         memcmp(raw, a, outlen) ? "no" : "YES");
+  curl_mprintf("[old] outlen == %d\n", outlen);
+  curl_mprintf("[old] unescape == original? %s\n",
+               memcmp(raw, a, outlen) ? "no" : "YES");
   curl_free(raw);
   curl_free(ptr);
 
   /* weird input length */
   ptr = curl_easy_escape(NULL, (const char *)a, -1);
-  printf("escape -1 length: %s\n", ptr);
+  curl_mprintf("escape -1 length: %s\n", ptr);
 
   /* weird input length */
   outlen = 2017; /* just a value */
   ptr = curl_easy_unescape(NULL, "moahahaha", -1, &outlen);
-  printf("unescape -1 length: %s %d\n", ptr, outlen);
+  curl_mprintf("unescape -1 length: %s %d\n", ptr, outlen);
 
 test_cleanup:
   curl_free(ptr);
index bd830b2830b022253168d69c2bb3bfcd3f993171..e5dcec1f49b861c0df2f98a19f1a1855f46cf0b0 100644 (file)
@@ -45,17 +45,17 @@ CURLcode test(char *URL)
   curl_url_strerror((CURLUcode)-INT_MAX);
   /* NOLINTEND(clang-analyzer-optin.core.EnumCastOutOfRange) */
   for(easyret = CURLE_OK; easyret <= CURL_LAST; easyret++) {
-    printf("e%d: %s\n", (int)easyret, curl_easy_strerror(easyret));
+    curl_mprintf("e%d: %s\n", (int)easyret, curl_easy_strerror(easyret));
   }
   for(multiret = CURLM_CALL_MULTI_PERFORM; multiret <= CURLM_LAST;
       multiret++) {
-    printf("m%d: %s\n", (int)multiret, curl_multi_strerror(multiret));
+    curl_mprintf("m%d: %s\n", (int)multiret, curl_multi_strerror(multiret));
   }
   for(shareret = CURLSHE_OK; shareret <= CURLSHE_LAST; shareret++) {
-    printf("s%d: %s\n", (int)shareret, curl_share_strerror(shareret));
+    curl_mprintf("s%d: %s\n", (int)shareret, curl_share_strerror(shareret));
   }
   for(urlret = CURLUE_OK; urlret <= CURLUE_LAST; urlret++) {
-    printf("u%d: %s\n", (int)urlret, curl_url_strerror(urlret));
+    curl_mprintf("u%d: %s\n", (int)urlret, curl_url_strerror(urlret));
   }
 
   return res;
index 210879447ec508b0039abc621c7c9320f81df0ff..aad97d2af2b6577a92c1a8a6f703d97ff7f9ca58 100644 (file)
@@ -53,7 +53,7 @@ static int please_continue(void *userp,
       curl_easy_pause(st->easy, CURLPAUSE_CONT);
     }
   }
-  fprintf(stderr, "xferinfo: paused %d\n", st->halted);
+  curl_mfprintf(stderr, "xferinfo: paused %d\n", st->halted);
   return 0; /* go on */
 }
 
@@ -78,7 +78,7 @@ static size_t write_callback(char *ptr, size_t size, size_t nmemb, void *userp)
     return len;
   }
   if(len)
-    printf("Got bytes but pausing!\n");
+    curl_mprintf("Got bytes but pausing!\n");
   st->halted = 1;
   return CURL_WRITEFUNC_PAUSE;
 }
index a60d61a7eca4ae3329e6fca729da280207004870..d09e0e66e7e3a9ef19fd216e43181067c9432ed2 100644 (file)
@@ -38,8 +38,8 @@ struct transfer_status {
 
 static int geterr(const char *name, CURLcode val, int lineno)
 {
-  printf("CURLINFO_%s returned %d, \"%s\" on line %d\n",
-         name, val, curl_easy_strerror(val), lineno);
+  curl_mprintf("CURLINFO_%s returned %d, \"%s\" on line %d\n",
+               name, val, curl_easy_strerror(val), lineno);
   return (int)val;
 }
 
@@ -47,10 +47,10 @@ static void report_time(const char *key, const char *where, curl_off_t time,
                         bool ok)
 {
   if(ok)
-    printf("%s on %s is OK\n", key, where);
+    curl_mprintf("%s on %s is OK\n", key, where);
   else
-    printf("%s on %s is WRONG: %" CURL_FORMAT_CURL_OFF_T "\n",
-           key, where, time);
+    curl_mprintf("%s on %s is WRONG: %" CURL_FORMAT_CURL_OFF_T "\n",
+                 key, where, time);
 }
 
 static void check_time(CURL *easy, int key, const char *name,
index 20e938ece6aa65ddd4a71d04924b875c2552ee75..77834655adea5eeea37da884a30fdd14c5ca9b27 100644 (file)
@@ -42,7 +42,7 @@ CURLcode test(char *URL)
     if(res)
       goto test_cleanup;
 
-    fprintf(stderr, "****************************** Do it again\n");
+    curl_mfprintf(stderr, "****************************** Do it again\n");
     res = curl_easy_perform(curl);
   }
 
index 821fba27a37500f2ad370fe00613322e4f9fafcf..b61f162ed9a5c69cbdbefbc10e31879b92ad6476 100644 (file)
@@ -63,7 +63,7 @@ CURLcode test(char *URL)
     int num;
     mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
     if(mres != CURLM_OK) {
-      printf("curl_multi_wait() returned %d\n", mres);
+      curl_mprintf("curl_multi_wait() returned %d\n", mres);
       res = TEST_ERR_MAJOR_BAD;
       goto test_cleanup;
     }
index 998c0762aaf5319bcb460ddcfb497f11a03566ca..a1c04314ee080754eb2c6fa25474c192f7aa86fa 100644 (file)
@@ -39,7 +39,7 @@ static int xferinfo(void *p,
   (void)dltotal;
   (void)ulnow;
   (void)ultotal;
-  fprintf(stderr, "xferinfo fail!\n");
+  curl_mfprintf(stderr, "xferinfo fail!\n");
   return 1; /* fail as fast as we can */
 }
 
@@ -92,7 +92,7 @@ CURLcode test(char *URL)
     int num;
     mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
     if(mres != CURLM_OK) {
-      printf("curl_multi_wait() returned %d\n", mres);
+      curl_mprintf("curl_multi_wait() returned %d\n", mres);
       res = TEST_ERR_MAJOR_BAD;
       goto test_cleanup;
     }
index 3c48f3fe0851f0f0faafa1740ad58806a97aa161..4fc408f609f67530d51dfe97b0f69a727115ef5c 100644 (file)
@@ -43,7 +43,7 @@ static void test_lock(CURL *handle, curl_lock_data data,
   (void)data;
   (void)laccess;
   (void)useptr;
-  printf("-> Mutex lock %s\n", ldata_names[data]);
+  curl_mprintf("-> Mutex lock %s\n", ldata_names[data]);
 }
 
 static void test_unlock(CURL *handle, curl_lock_data data, void *useptr)
@@ -51,7 +51,7 @@ static void test_unlock(CURL *handle, curl_lock_data data, void *useptr)
   (void)handle;
   (void)data;
   (void)useptr;
-  printf("<- Mutex unlock %s\n", ldata_names[data]);
+  curl_mprintf("<- Mutex unlock %s\n", ldata_names[data]);
 }
 
 /* test function */
@@ -65,7 +65,7 @@ CURLcode test(char *URL)
 
   share = curl_share_init();
   if(!share) {
-    fprintf(stderr, "curl_share_init() failed\n");
+    curl_mfprintf(stderr, "curl_share_init() failed\n");
     goto test_cleanup;
   }
 
@@ -92,8 +92,8 @@ CURLcode test(char *URL)
 
       /* Check for errors */
       if(res != CURLE_OK) {
-        fprintf(stderr, "curl_easy_perform() failed: %s\n",
-                curl_easy_strerror(res));
+        curl_mfprintf(stderr, "curl_easy_perform() failed: %s\n",
+                      curl_easy_strerror(res));
         goto test_cleanup;
       }
     }
index 59db1fbdbe3b883b615e32c697817eb45e0d4783..9f2d0bc8dbdfcff8b276df4962a80fd9cccf0d6c 100644 (file)
@@ -46,9 +46,9 @@ static int progressCallback(void *arg,
   (void)ultotal;
   (void)ulnow;
   res = curl_easy_recv(curl, buffer, 256, &n);
-  printf("curl_easy_recv returned %d\n", res);
+  curl_mprintf("curl_easy_recv returned %d\n", res);
   res = curl_easy_send(curl, buffer, n, &n);
-  printf("curl_easy_send returned %d\n", res);
+  curl_mprintf("curl_easy_send returned %d\n", res);
 
   return 1;
 }
index 25be5e50fa8a37a35d656392be527adcd99cc47d..6bbf353e1ea41b5043a6093bb6825986a044eb21 100644 (file)
@@ -62,14 +62,14 @@ CURLcode test(char *URL)
 
   code = curl_easy_perform(curl);
   if(CURLE_OK != code) {
-    fprintf(stderr, "%s:%d curl_easy_perform() failed, "
-            "with code %d (%s)\n",
-            __FILE__, __LINE__, code, curl_easy_strerror(code));
+    curl_mfprintf(stderr, "%s:%d curl_easy_perform() failed, "
+                  "with code %d (%s)\n",
+                  __FILE__, __LINE__, code, curl_easy_strerror(code));
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
 
-  printf("Max = %ld\n", (long)info.largest);
+  curl_mprintf("Max = %ld\n", (long)info.largest);
 
 test_cleanup:
 
index e3a648f395a8dda6d7047bfee9b3ae7ab03cc746..2f54d2cf8ce8305603082ff1cd8e4989d0a43732 100644 (file)
@@ -39,8 +39,8 @@ CURLcode test(char *URL)
   easy_setopt(curl, CURLOPT_URL, URL);
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "curl_easy_perform() returned %d (%s)\n",
-            res, curl_easy_strerror(res));
+    curl_mfprintf(stderr, "curl_easy_perform() returned %d (%s)\n",
+                  res, curl_easy_strerror(res));
     goto test_cleanup;
   }
 
@@ -48,12 +48,12 @@ CURLcode test(char *URL)
     res = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
   )
   if(res) {
-    fprintf(stderr, "curl_easy_getinfo() returned %d (%s)\n",
-            res, curl_easy_strerror(res));
+    curl_mfprintf(stderr, "curl_easy_getinfo() returned %d (%s)\n",
+                  res, curl_easy_strerror(res));
     goto test_cleanup;
   }
 
-  printf("Protocol: %lx\n", protocol);
+  curl_mprintf("Protocol: %lx\n", protocol);
 
   curl_easy_cleanup(curl);
   curl_global_cleanup();
index 0d1a450ac0f779798ceb068e9238e4c6c829d987..19448afd8f320e27afa66574f6b57e8d3d3fb2d1 100644 (file)
@@ -49,24 +49,24 @@ CURLcode test(char *URL)
   longurl[EXCESSIVE-1] = 0;
 
   res = curl_easy_setopt(curl, CURLOPT_URL, longurl);
-  printf("CURLOPT_URL %d bytes URL == %d\n",
-         EXCESSIVE, res);
+  curl_mprintf("CURLOPT_URL %d bytes URL == %d\n",
+               EXCESSIVE, res);
 
   res = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, longurl);
-  printf("CURLOPT_POSTFIELDS %d bytes data == %d\n",
-         EXCESSIVE, res);
+  curl_mprintf("CURLOPT_POSTFIELDS %d bytes data == %d\n",
+               EXCESSIVE, res);
 
   u = curl_url();
   if(u) {
     CURLUcode uc = curl_url_set(u, CURLUPART_URL, longurl, 0);
-    printf("CURLUPART_URL %d bytes URL == %d (%s)\n",
-           EXCESSIVE, (int)uc, curl_url_strerror(uc));
+    curl_mprintf("CURLUPART_URL %d bytes URL == %d (%s)\n",
+                 EXCESSIVE, (int)uc, curl_url_strerror(uc));
     uc = curl_url_set(u, CURLUPART_SCHEME, longurl, CURLU_NON_SUPPORT_SCHEME);
-    printf("CURLUPART_SCHEME %d bytes scheme == %d (%s)\n",
-           EXCESSIVE, (int)uc, curl_url_strerror(uc));
+    curl_mprintf("CURLUPART_SCHEME %d bytes scheme == %d (%s)\n",
+                 EXCESSIVE, (int)uc, curl_url_strerror(uc));
     uc = curl_url_set(u, CURLUPART_USER, longurl, 0);
-    printf("CURLUPART_USER %d bytes user == %d (%s)\n",
-           EXCESSIVE, (int)uc, curl_url_strerror(uc));
+    curl_mprintf("CURLUPART_USER %d bytes user == %d (%s)\n",
+                 EXCESSIVE, (int)uc, curl_url_strerror(uc));
     curl_url_cleanup(u);
   }
 
index 01e9c4108cba4ef419e95772b00d3f5dc259627b..c0898735ed3716598d4383c82e372185f1471a4b 100644 (file)
@@ -72,10 +72,10 @@ static int checkparts(CURLU *u, const char *in, const char *wanted,
     size_t n;
     rc = curl_url_get(u, parts[i].part, &p, getflags);
     if(!rc && p) {
-      msnprintf(bufp, len, "%s%s", buf[0]?" | ":"", p);
+      curl_msnprintf(bufp, len, "%s%s", buf[0]?" | ":"", p);
     }
     else
-      msnprintf(bufp, len, "%s[%d]", buf[0]?" | ":"", (int)rc);
+      curl_msnprintf(bufp, len, "%s[%d]", buf[0]?" | ":"", (int)rc);
 
     n = strlen(bufp);
     bufp += n;
@@ -83,7 +83,7 @@ static int checkparts(CURLU *u, const char *in, const char *wanted,
     curl_free(p);
   }
   if(strcmp(buf, wanted)) {
-    fprintf(stderr, "in: %s\nwanted: %s\ngot:    %s\n", in, wanted, buf);
+    curl_mfprintf(stderr, "in: %s\nwanted: %s\ngot:    %s\n", in, wanted, buf);
     return 1;
   }
   return 0;
@@ -830,11 +830,11 @@ static const struct urltestcase get_url_list[] = {
 static int checkurl(const char *org, const char *url, const char *out)
 {
   if(strcmp(out, url)) {
-    fprintf(stderr,
-            "Org:    %s\n"
-            "Wanted: %s\n"
-            "Got   : %s\n",
-            org, out, url);
+    curl_mfprintf(stderr,
+                  "Org:    %s\n"
+                  "Wanted: %s\n"
+                  "Got   : %s\n",
+                  org, out, url);
     return 1;
   }
   return 0;
@@ -1178,10 +1178,10 @@ static CURLUcode updateurl(CURLU *u, const char *cmd, unsigned int setflags)
         CURLUPart what = part2id(part);
 #if 0
         /* for debugging this */
-        fprintf(stderr, "%s = \"%s\" [%d]\n", part, value, (int)what);
+        curl_mfprintf(stderr, "%s = \"%s\" [%d]\n", part, value, (int)what);
 #endif
         if(what > CURLUPART_ZONEID)
-          fprintf(stderr, "UNKNOWN part '%s'\n", part);
+          curl_mfprintf(stderr, "UNKNOWN part '%s'\n", part);
 
         if(!strcmp("NULL", value))
           uc = curl_url_set(u, what, NULL, setflags);
@@ -1373,17 +1373,17 @@ static int set_url(void)
       rc = curl_url_set(urlp, CURLUPART_URL, set_url_list[i].set,
                         set_url_list[i].setflags);
       if(rc) {
-        fprintf(stderr, "%s:%d Set URL %s returned %d (%s)\n",
-                __FILE__, __LINE__, set_url_list[i].set,
-                (int)rc, curl_url_strerror(rc));
+        curl_mfprintf(stderr, "%s:%d Set URL %s returned %d (%s)\n",
+                      __FILE__, __LINE__, set_url_list[i].set,
+                      (int)rc, curl_url_strerror(rc));
         error++;
       }
       else {
         char *url = NULL;
         rc = curl_url_get(urlp, CURLUPART_URL, &url, 0);
         if(rc) {
-          fprintf(stderr, "%s:%d Get URL returned %d (%s)\n",
-                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+          curl_mfprintf(stderr, "%s:%d Get URL returned %d (%s)\n",
+                        __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
           error++;
         }
         else {
@@ -1395,8 +1395,8 @@ static int set_url(void)
       }
     }
     else if(rc != set_url_list[i].ucode) {
-      fprintf(stderr, "Set URL\nin: %s\nreturned %d (expected %d)\n",
-              set_url_list[i].in, (int)rc, set_url_list[i].ucode);
+      curl_mfprintf(stderr, "Set URL\nin: %s\nreturned %d (expected %d)\n",
+                    set_url_list[i].in, (int)rc, set_url_list[i].ucode);
       error++;
     }
     curl_url_cleanup(urlp);
@@ -1431,8 +1431,9 @@ static int setget_parts(void)
                                setget_parts_list[i].setflags);
 
       if(uc != setget_parts_list[i].pcode) {
-        fprintf(stderr, "updateurl\nin: %s\nreturned %d (expected %d)\n",
-                setget_parts_list[i].set, (int)uc, setget_parts_list[i].pcode);
+        curl_mfprintf(stderr, "updateurl\nin: %s\nreturned %d (expected %d)\n",
+                      setget_parts_list[i].set,
+                      (int)uc, setget_parts_list[i].pcode);
         error++;
       }
       if(!uc) {
@@ -1443,8 +1444,8 @@ static int setget_parts(void)
       curl_free(url);
     }
     else if(rc != CURLUE_OK) {
-      fprintf(stderr, "Set parts\nin: %s\nreturned %d (expected %d)\n",
-              setget_parts_list[i].in, (int)rc, 0);
+      curl_mfprintf(stderr, "Set parts\nin: %s\nreturned %d (expected %d)\n",
+                    setget_parts_list[i].in, (int)rc, 0);
       error++;
     }
     curl_url_cleanup(urlp);
@@ -1475,8 +1476,8 @@ static int set_parts(void)
                                set_parts_list[i].setflags);
 
       if(uc != set_parts_list[i].pcode) {
-        fprintf(stderr, "updateurl\nin: %s\nreturned %d (expected %d)\n",
-                set_parts_list[i].set, (int)uc, set_parts_list[i].pcode);
+        curl_mfprintf(stderr, "updateurl\nin: %s\nreturned %d (expected %d)\n",
+                      set_parts_list[i].set, (int)uc, set_parts_list[i].pcode);
         error++;
       }
       if(!uc) {
@@ -1484,8 +1485,8 @@ static int set_parts(void)
         rc = curl_url_get(urlp, CURLUPART_URL, &url, 0);
 
         if(rc) {
-          fprintf(stderr, "%s:%d Get URL returned %d (%s)\n",
-                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+          curl_mfprintf(stderr, "%s:%d Get URL returned %d (%s)\n",
+                        __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
           error++;
         }
         else if(checkurl(set_parts_list[i].in, url, set_parts_list[i].out)) {
@@ -1495,8 +1496,8 @@ static int set_parts(void)
       curl_free(url);
     }
     else if(rc != set_parts_list[i].ucode) {
-      fprintf(stderr, "Set parts\nin: %s\nreturned %d (expected %d)\n",
-              set_parts_list[i].in, (int)rc, set_parts_list[i].ucode);
+      curl_mfprintf(stderr, "Set parts\nin: %s\nreturned %d (expected %d)\n",
+                    set_parts_list[i].in, (int)rc, set_parts_list[i].ucode);
       error++;
     }
     curl_url_cleanup(urlp);
@@ -1522,9 +1523,9 @@ static int get_url(void)
       rc = curl_url_get(urlp, CURLUPART_URL, &url, get_url_list[i].getflags);
 
       if(rc) {
-        fprintf(stderr, "%s:%d returned %d (%s). URL: '%s'\n",
-                __FILE__, __LINE__, (int)rc, curl_url_strerror(rc),
-                get_url_list[i].in);
+        curl_mfprintf(stderr, "%s:%d returned %d (%s). URL: '%s'\n",
+                      __FILE__, __LINE__, (int)rc, curl_url_strerror(rc),
+                      get_url_list[i].in);
         error++;
       }
       else {
@@ -1535,8 +1536,8 @@ static int get_url(void)
       curl_free(url);
     }
     if(rc != get_url_list[i].ucode) {
-      fprintf(stderr, "Get URL\nin: %s\nreturned %d (expected %d)\n",
-              get_url_list[i].in, (int)rc, get_url_list[i].ucode);
+      curl_mfprintf(stderr, "Get URL\nin: %s\nreturned %d (expected %d)\n",
+                    get_url_list[i].in, (int)rc, get_url_list[i].ucode);
       error++;
     }
     curl_url_cleanup(urlp);
@@ -1559,8 +1560,8 @@ static int get_parts(void)
                       get_parts_list[i].in,
                       get_parts_list[i].urlflags);
     if(rc != get_parts_list[i].ucode) {
-      fprintf(stderr, "Get parts\nin: %s\nreturned %d (expected %d)\n",
-              get_parts_list[i].in, (int)rc, get_parts_list[i].ucode);
+      curl_mfprintf(stderr, "Get parts\nin: %s\nreturned %d (expected %d)\n",
+                    get_parts_list[i].in, (int)rc, get_parts_list[i].ucode);
       error++;
     }
     else if(get_parts_list[i].ucode) {
@@ -1615,8 +1616,8 @@ static int append(void)
     if(error)
       ;
     else if(rc != append_list[i].ucode) {
-      fprintf(stderr, "Append\nin: %s\nreturned %d (expected %d)\n",
-              append_list[i].in, (int)rc, append_list[i].ucode);
+      curl_mfprintf(stderr, "Append\nin: %s\nreturned %d (expected %d)\n",
+                    append_list[i].in, (int)rc, append_list[i].ucode);
       error++;
     }
     else if(append_list[i].ucode) {
@@ -1626,8 +1627,8 @@ static int append(void)
       char *url;
       rc = curl_url_get(urlp, CURLUPART_URL, &url, 0);
       if(rc) {
-        fprintf(stderr, "%s:%d Get URL returned %d (%s)\n",
-                __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+        curl_mfprintf(stderr, "%s:%d Get URL returned %d (%s)\n",
+                      __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
         error++;
       }
       else {
@@ -1652,15 +1653,16 @@ static int scopeid(void)
   rc = curl_url_set(u, CURLUPART_URL,
                     "https://[fe80::20c:29ff:fe9c:409b%25eth0]/hello.html", 0);
   if(rc != CURLUE_OK) {
-    fprintf(stderr, "%s:%d curl_url_set returned %d (%s)\n",
-            __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+    curl_mfprintf(stderr, "%s:%d curl_url_set returned %d (%s)\n",
+                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
     error++;
   }
 
   rc = curl_url_get(u, CURLUPART_HOST, &url, 0);
   if(rc != CURLUE_OK) {
-    fprintf(stderr, "%s:%d curl_url_get CURLUPART_HOST returned %d (%s)\n",
-            __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_url_get CURLUPART_HOST returned %d (%s)\n",
+                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
     error++;
   }
   else {
@@ -1669,15 +1671,17 @@ static int scopeid(void)
 
   rc = curl_url_set(u, CURLUPART_HOST, "[::1]", 0);
   if(rc != CURLUE_OK) {
-    fprintf(stderr, "%s:%d curl_url_set CURLUPART_HOST returned %d (%s)\n",
-            __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_url_set CURLUPART_HOST returned %d (%s)\n",
+                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
     error++;
   }
 
   rc = curl_url_get(u, CURLUPART_URL, &url, 0);
   if(rc != CURLUE_OK) {
-    fprintf(stderr, "%s:%d curl_url_get CURLUPART_URL returned %d (%s)\n",
-            __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_url_get CURLUPART_URL returned %d (%s)\n",
+                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
     error++;
   }
   else {
@@ -1686,15 +1690,17 @@ static int scopeid(void)
 
   rc = curl_url_set(u, CURLUPART_HOST, "example.com", 0);
   if(rc != CURLUE_OK) {
-    fprintf(stderr, "%s:%d curl_url_set CURLUPART_HOST returned %d (%s)\n",
-            __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_url_set CURLUPART_HOST returned %d (%s)\n",
+                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
     error++;
   }
 
   rc = curl_url_get(u, CURLUPART_URL, &url, 0);
   if(rc != CURLUE_OK) {
-    fprintf(stderr, "%s:%d curl_url_get CURLUPART_URL returned %d (%s)\n",
-            __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_url_get CURLUPART_URL returned %d (%s)\n",
+                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
     error++;
   }
   else {
@@ -1704,15 +1710,17 @@ static int scopeid(void)
   rc = curl_url_set(u, CURLUPART_HOST,
                     "[fe80::20c:29ff:fe9c:409b%25eth0]", 0);
   if(rc != CURLUE_OK) {
-    fprintf(stderr, "%s:%d curl_url_set CURLUPART_HOST returned %d (%s)\n",
-            __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_url_set CURLUPART_HOST returned %d (%s)\n",
+                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
     error++;
   }
 
   rc = curl_url_get(u, CURLUPART_URL, &url, 0);
   if(rc != CURLUE_OK) {
-    fprintf(stderr, "%s:%d curl_url_get CURLUPART_URL returned %d (%s)\n",
-            __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_url_get CURLUPART_URL returned %d (%s)\n",
+                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
     error++;
   }
   else {
@@ -1721,8 +1729,9 @@ static int scopeid(void)
 
   rc = curl_url_get(u, CURLUPART_HOST, &url, 0);
   if(rc != CURLUE_OK) {
-    fprintf(stderr, "%s:%d curl_url_get CURLUPART_HOST returned %d (%s)\n",
-            __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_url_get CURLUPART_HOST returned %d (%s)\n",
+                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
     error++;
   }
   else {
@@ -1731,8 +1740,9 @@ static int scopeid(void)
 
   rc = curl_url_get(u, CURLUPART_ZONEID, &url, 0);
   if(rc != CURLUE_OK) {
-    fprintf(stderr, "%s:%d curl_url_get CURLUPART_ZONEID returned %d (%s)\n",
-            __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_url_get CURLUPART_ZONEID returned %d (%s)\n",
+                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
     error++;
   }
   else {
@@ -1741,15 +1751,17 @@ static int scopeid(void)
 
   rc = curl_url_set(u, CURLUPART_ZONEID, "clown", 0);
   if(rc != CURLUE_OK) {
-    fprintf(stderr, "%s:%d curl_url_set CURLUPART_ZONEID returned %d (%s)\n",
-            __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_url_set CURLUPART_ZONEID returned %d (%s)\n",
+                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
     error++;
   }
 
   rc = curl_url_get(u, CURLUPART_URL, &url, 0);
   if(rc != CURLUE_OK) {
-    fprintf(stderr, "%s:%d curl_url_get CURLUPART_URL returned %d (%s)\n",
-            __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
+    curl_mfprintf(stderr,
+                  "%s:%d curl_url_get CURLUPART_URL returned %d (%s)\n",
+                  __FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
     error++;
   }
   else {
@@ -1770,41 +1782,41 @@ static int get_nothing(void)
 
     rc = curl_url_get(u, CURLUPART_SCHEME, &p, 0);
     if(rc != CURLUE_NO_SCHEME)
-      fprintf(stderr, "unexpected return code line %u\n", __LINE__);
+      curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
 
     rc = curl_url_get(u, CURLUPART_HOST, &p, 0);
     if(rc != CURLUE_NO_HOST)
-      fprintf(stderr, "unexpected return code line %u\n", __LINE__);
+      curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
 
     rc = curl_url_get(u, CURLUPART_USER, &p, 0);
     if(rc != CURLUE_NO_USER)
-      fprintf(stderr, "unexpected return code line %u\n", __LINE__);
+      curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
 
     rc = curl_url_get(u, CURLUPART_PASSWORD, &p, 0);
     if(rc != CURLUE_NO_PASSWORD)
-      fprintf(stderr, "unexpected return code line %u\n", __LINE__);
+      curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
 
     rc = curl_url_get(u, CURLUPART_OPTIONS, &p, 0);
     if(rc != CURLUE_NO_OPTIONS)
-      fprintf(stderr, "unexpected return code line %u\n", __LINE__);
+      curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
 
     rc = curl_url_get(u, CURLUPART_PATH, &p, 0);
     if(rc != CURLUE_OK)
-      fprintf(stderr, "unexpected return code line %u\n", __LINE__);
+      curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
     else
       curl_free(p);
 
     rc = curl_url_get(u, CURLUPART_QUERY, &p, 0);
     if(rc != CURLUE_NO_QUERY)
-      fprintf(stderr, "unexpected return code line %u\n", __LINE__);
+      curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
 
     rc = curl_url_get(u, CURLUPART_FRAGMENT, &p, 0);
     if(rc != CURLUE_NO_FRAGMENT)
-      fprintf(stderr, "unexpected return code line %u\n", __LINE__);
+      curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
 
     rc = curl_url_get(u, CURLUPART_ZONEID, &p, 0);
     if(rc != CURLUE_NO_ZONEID)
-      fprintf(stderr, "unexpected return code %u on line %u\n", (int)rc,
+      curl_mfprintf(stderr, "unexpected return code %u on line %u\n", (int)rc,
               __LINE__);
 
     curl_url_cleanup(u);
@@ -1837,17 +1849,17 @@ static int clear_url(void)
     for(i = 0; clear_url_list[i].in && !error; i++) {
       rc = curl_url_set(u, clear_url_list[i].part, clear_url_list[i].in, 0);
       if(rc != CURLUE_OK)
-        fprintf(stderr, "unexpected return code line %u\n", __LINE__);
+        curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
 
       rc = curl_url_set(u, CURLUPART_URL, NULL, 0);
       if(rc != CURLUE_OK)
-        fprintf(stderr, "unexpected return code line %u\n", __LINE__);
+        curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
 
       rc = curl_url_get(u, clear_url_list[i].part, &p, 0);
       if(rc != clear_url_list[i].ucode || (clear_url_list[i].out &&
          0 != strcmp(p, clear_url_list[i].out))) {
 
-        fprintf(stderr, "unexpected return code line %u\n", __LINE__);
+        curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
         error++;
       }
       if(rc == CURLUE_OK)
@@ -1890,19 +1902,19 @@ static int huge(void)
 
   for(i = 0; i <  7; i++) {
     char *partp;
-    msnprintf(total, sizeof(total),
-              "%s://%s:%s@%s/%s?%s#%s",
-              (i == 0) ? &bigpart[1] : smallpart,
-              (i == 1) ? &bigpart[1] : smallpart,
-              (i == 2) ? &bigpart[1] : smallpart,
-              (i == 3) ? &bigpart[1] : smallpart,
-              (i == 4) ? &bigpart[1] : smallpart,
-              (i == 5) ? &bigpart[1] : smallpart,
-              (i == 6) ? &bigpart[1] : smallpart);
+    curl_msnprintf(total, sizeof(total),
+                   "%s://%s:%s@%s/%s?%s#%s",
+                   (i == 0) ? &bigpart[1] : smallpart,
+                   (i == 1) ? &bigpart[1] : smallpart,
+                   (i == 2) ? &bigpart[1] : smallpart,
+                   (i == 3) ? &bigpart[1] : smallpart,
+                   (i == 4) ? &bigpart[1] : smallpart,
+                   (i == 5) ? &bigpart[1] : smallpart,
+                   (i == 6) ? &bigpart[1] : smallpart);
     rc = curl_url_set(urlp, CURLUPART_URL, total, CURLU_NON_SUPPORT_SCHEME);
     if((!i && (rc != CURLUE_BAD_SCHEME)) ||
        (i && rc)) {
-      printf("URL %u: failed to parse [%s]\n", i, total);
+      curl_mprintf("URL %u: failed to parse [%s]\n", i, total);
       error++;
     }
 
@@ -1910,7 +1922,7 @@ static int huge(void)
     if(!rc) {
       curl_url_get(urlp, part[i], &partp, 0);
       if(!partp || strcmp(partp, &bigpart[1 - (i == 4)])) {
-        printf("URL %u part %u: failure\n", i, part[i]);
+        curl_mprintf("URL %u part %u: failure\n", i, part[i]);
         error++;
       }
       curl_free(partp);
@@ -1963,8 +1975,8 @@ static int urldup(void)
       goto err;
 
     if(strcmp(h_str, copy_str)) {
-      printf("Original:  %s\nParsed:    %s\nCopy:      %s\n",
-             url[i], h_str, copy_str);
+      curl_mprintf("Original:  %s\nParsed:    %s\nCopy:      %s\n",
+                   url[i], h_str, copy_str);
       goto err;
     }
     curl_free(copy_str);
@@ -2021,6 +2033,6 @@ CURLcode test(char *URL)
   if(clear_url())
     return (CURLcode)8;
 
-  printf("success\n");
+  curl_mprintf("success\n");
   return CURLE_OK;
 }
index 851d02c403fb6bfafa798e7853b79ac1f316bfa3..83c774df7006dff7ee5d88a8182f6624ef934037 100644 (file)
@@ -53,8 +53,8 @@ CURLcode test(char *URL)
   time_after_wait = tutil_tvnow();
 
   if(tutil_tvdiff(time_after_wait, time_before_wait) < 500) {
-    fprintf(stderr, "%s:%d curl_multi_poll returned too early\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d curl_multi_poll returned too early\n",
+                  __FILE__, __LINE__);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -70,8 +70,8 @@ CURLcode test(char *URL)
   time_after_wait = tutil_tvnow();
 
   if(tutil_tvdiff(time_after_wait, time_before_wait) > 500) {
-    fprintf(stderr, "%s:%d curl_multi_poll returned too late\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d curl_multi_poll returned too late\n",
+                  __FILE__, __LINE__);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -85,8 +85,8 @@ CURLcode test(char *URL)
   time_after_wait = tutil_tvnow();
 
   if(tutil_tvdiff(time_after_wait, time_before_wait) < 500) {
-    fprintf(stderr, "%s:%d curl_multi_poll returned too early\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d curl_multi_poll returned too early\n",
+                  __FILE__, __LINE__);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -103,8 +103,8 @@ CURLcode test(char *URL)
   time_after_wait = tutil_tvnow();
 
   if(tutil_tvdiff(time_after_wait, time_before_wait) > 500) {
-    fprintf(stderr, "%s:%d curl_multi_poll returned too late\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d curl_multi_poll returned too late\n",
+                  __FILE__, __LINE__);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -118,8 +118,8 @@ CURLcode test(char *URL)
   time_after_wait = tutil_tvnow();
 
   if(tutil_tvdiff(time_after_wait, time_before_wait) < 500) {
-    fprintf(stderr, "%s:%d curl_multi_poll returned too early\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d curl_multi_poll returned too early\n",
+                  __FILE__, __LINE__);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
index 3acbcb03382a2518c51c3232abe6c61b44aaefa6..d83add89599156897da5f8e34e196e0f17445d97 100644 (file)
@@ -115,8 +115,8 @@ CURLcode test(char *URL)
   if(!result)
     tid_valid = true;
   else {
-    fprintf(stderr, "%s:%d Couldn't create thread, errno %d\n",
-            __FILE__, __LINE__, result);
+    curl_mfprintf(stderr, "%s:%d Couldn't create thread, errno %d\n",
+                  __FILE__, __LINE__, result);
     goto test_cleanup;
   }
 
@@ -134,8 +134,9 @@ CURLcode test(char *URL)
         finished_num++;
       }
       else {
-        fprintf(stderr, "%s:%d Got an unexpected message from curl: %i\n",
-              __FILE__, __LINE__, (int)message->msg);
+        curl_mfprintf(stderr,
+                      "%s:%d Got an unexpected message from curl: %i\n",
+                      __FILE__, __LINE__, (int)message->msg);
         res = TEST_ERR_MAJOR_BAD;
         goto test_cleanup;
       }
@@ -170,14 +171,14 @@ CURLcode test(char *URL)
   }
 
   if(CONN_NUM != started_num) {
-    fprintf(stderr, "%s:%d Not all connections started: %d of %d\n",
-            __FILE__, __LINE__, started_num, CONN_NUM);
+    curl_mfprintf(stderr, "%s:%d Not all connections started: %d of %d\n",
+                  __FILE__, __LINE__, started_num, CONN_NUM);
     goto test_cleanup;
   }
 
   if(CONN_NUM != finished_num) {
-    fprintf(stderr, "%s:%d Not all connections finished: %d of %d\n",
-            __FILE__, __LINE__, started_num, CONN_NUM);
+    curl_mfprintf(stderr, "%s:%d Not all connections finished: %d of %d\n",
+                  __FILE__, __LINE__, started_num, CONN_NUM);
     goto test_cleanup;
   }
 
index fae8cc12e8f72d488f14923e9aa1dbfc4c0943ea..d1de1637a0ab07c9f2f3d8bdbd14bdca4e489df1 100644 (file)
@@ -46,7 +46,7 @@ CURLcode test(char *URL)
       if(res)
         goto test_cleanup;
 
-      fprintf(stderr, "****************************** Do it again\n");
+      curl_mfprintf(stderr, "****************************** Do it again\n");
       res = curl_easy_perform(curl);
     }
   }
index a1d74e3e5c9a6c48619e6697101004123d2bd227..599475742e2cf7e1ad7e32a685d7af8aca964525 100644 (file)
@@ -32,13 +32,13 @@ CURLcode test(char *URL)
   int testno = atoi(libtest_arg2);
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index a25798824d57b0005c746b971a1f8e75cb0f71ba..279d6fbc97f1e17b8a5faea3ec5f84f998a341b4 100644 (file)
@@ -55,13 +55,13 @@ CURLcode test(char *URL)
   int testno = atoi(libtest_arg2);
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index c0200d5429b2f73403742c47ecdfdbb2d9d78358..7d1c012698e1c076e3391375ad3a9e2a8074638c 100644 (file)
@@ -81,14 +81,14 @@ CURLcode test(char *URL)
   struct curl_slist *hhl = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index cb6ee826a8c139f63714353c4af1d7b0c250dc63..99f088d661b070c9ca38a7139d5c7d9f812d7181 100644 (file)
@@ -79,9 +79,9 @@ CURLcode test(char *URL)
        all because we haven't been able to configure the resolver to use an
        non-responsive DNS server.  At least we exercise the flow.
        */
-    fprintf(stderr,
-            "CURLOPT_DNS_SERVERS not supported; "
-            "assuming curl_multi_remove_handle() will block\n");
+    curl_mfprintf(stderr,
+                  "CURLOPT_DNS_SERVERS not supported; "
+                  "assuming curl_multi_remove_handle() will block\n");
     timeout = TEST_HANG_TIMEOUT / 2;
   }
 
@@ -94,20 +94,21 @@ CURLcode test(char *URL)
   multi_add_handle(multiHandle, curl);
 
   /* This should move the handle from INIT => CONNECT => WAITRESOLVE. */
-  fprintf(stderr, "curl_multi_perform()...\n");
+  curl_mfprintf(stderr, "curl_multi_perform()...\n");
   multi_perform(multiHandle, &stillRunning);
-  fprintf(stderr, "curl_multi_perform() succeeded\n");
+  curl_mfprintf(stderr, "curl_multi_perform() succeeded\n");
 
   /* Start measuring how long it takes to remove the handle. */
-  fprintf(stderr, "curl_multi_remove_handle()...\n");
+  curl_mfprintf(stderr, "curl_multi_remove_handle()...\n");
   start_test_timing();
   mres = curl_multi_remove_handle(multiHandle, curl);
   if(mres) {
-    fprintf(stderr, "curl_multi_remove_handle() failed, with code %d\n", mres);
+    curl_mfprintf(stderr,
+                  "curl_multi_remove_handle() failed, with code %d\n", mres);
     res = TEST_ERR_MULTI;
     goto test_cleanup;
   }
-  fprintf(stderr, "curl_multi_remove_handle() succeeded\n");
+  curl_mfprintf(stderr, "curl_multi_remove_handle() succeeded\n");
 
   /* Fail the test if it took too long to remove.  This happens after the fact,
      and says "it seems that it would have run forever", which isn't true, but
index 2a31a720e4543530779a94c6149acb6a4df60018..8b469e6105c0c110a060156dfe5806e7ab06b92c 100644 (file)
@@ -49,7 +49,7 @@ CURLcode test(char *URL)
   if(res)
     goto test_cleanup;
 
-  printf("Retry-After %" CURL_FORMAT_CURL_OFF_T "\n", retry);
+  curl_mprintf("Retry-After %" CURL_FORMAT_CURL_OFF_T "\n", retry);
 
 test_cleanup:
 
index 1b7285d0dcc587c4faa2f15acc66c22f0d280b21..f183d3e4288ab55e694522aa42aef28a645dfa33 100644 (file)
@@ -87,7 +87,7 @@ CURLcode test(char *URL)
       res = TEST_ERR_FAILURE;
       goto test_cleanup;
     }
-    n += msnprintf(protolist + n, sizeof(protolist) - n, ",%s", *proto);
+    n += curl_msnprintf(protolist + n, sizeof(protolist) - n, ",%s", *proto);
     if(curl_strequal(*proto, "http"))
       httpcode = CURLE_OK;
     if(curl_strequal(*proto, "https"))
@@ -98,11 +98,11 @@ CURLcode test(char *URL)
   for(i = 0; prots[i].in; i++) {
     res = curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, prots[i].in);
     if(res != *prots[i].exp) {
-      printf("unexpectedly '%s' returned %d\n", prots[i].in, res);
+      curl_mprintf("unexpectedly '%s' returned %d\n", prots[i].in, res);
       break;
     }
   }
-  printf("Tested %u strings\n", i);
+  curl_mprintf("Tested %u strings\n", i);
 
 test_cleanup:
   curl_easy_cleanup(curl);
index 904ba65b0ed85745fa7e2208dcd5f3dd752275b1..e2a3cfeb0acd7b905431cd4026a47ea58352c5f9 100644 (file)
@@ -62,14 +62,14 @@ CURLcode test(char *URL)
   struct curl_slist *hhl = NULL, *list;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index fded3bfb17d072d24d35757299e2070955f88c1b..61996e2595190968b5b0b09c68a66958a376b575 100644 (file)
@@ -47,9 +47,9 @@ CURLcode test(char *URL)
   easy_setopt(curl, CURLOPT_PORT, 1L);
   res = curl_easy_perform(curl);
   if(res != CURLE_COULDNT_CONNECT && res != CURLE_OPERATION_TIMEDOUT) {
-    fprintf(stderr, "failure expected, "
-            "curl_easy_perform returned %d: <%s>, <%s>\n",
-            res, curl_easy_strerror(res), error_buffer);
+    curl_mfprintf(stderr, "failure expected, "
+                  "curl_easy_perform returned %d: <%s>, <%s>\n",
+                  res, curl_easy_strerror(res), error_buffer);
     if(res == CURLE_OK)
       res = TEST_ERR_MAJOR_BAD;  /* force an error return */
     goto test_cleanup;
@@ -58,7 +58,7 @@ CURLcode test(char *URL)
 
   /* print the used url */
   curl_url_get(curlu, CURLUPART_URL, &url_after, 0);
-  fprintf(stderr, "curlu now: <%s>\n", url_after);
+  curl_mfprintf(stderr, "curlu now: <%s>\n", url_after);
   curl_free(url_after);
   url_after = NULL;
 
@@ -67,13 +67,13 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res)
-    fprintf(stderr, "success expected, "
-            "curl_easy_perform returned %d: <%s>, <%s>\n",
-            res, curl_easy_strerror(res), error_buffer);
+    curl_mfprintf(stderr, "success expected, "
+                  "curl_easy_perform returned %d: <%s>, <%s>\n",
+                  res, curl_easy_strerror(res), error_buffer);
 
   /* print url */
   curl_url_get(curlu, CURLUPART_URL, &url_after, 0);
-  fprintf(stderr, "curlu now: <%s>\n", url_after);
+  curl_mfprintf(stderr, "curlu now: <%s>\n", url_after);
 
 test_cleanup:
   curl_free(url_after);
index 82026f23cd62bf6b352e3a1ddba365b38656c2c4..2cda08e02cf630dc25c7141da04d5d9910e562d2 100644 (file)
@@ -41,13 +41,13 @@ CURLcode test(char *URL)
   curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
   res = curl_easy_perform(curl);
   if(!res)
-    fprintf(stderr, "failure expected, "
-            "curl_easy_perform returned %ld: <%s>, <%s>\n",
-            (long) res, curl_easy_strerror(res), error_buffer);
+    curl_mfprintf(stderr, "failure expected, "
+                  "curl_easy_perform returned %ld: <%s>, <%s>\n",
+                  (long) res, curl_easy_strerror(res), error_buffer);
 
   /* print the used url */
   if(!curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url_after))
-    printf("Effective URL: %s\n", url_after);
+    curl_mprintf("Effective URL: %s\n", url_after);
 
   curl_easy_cleanup(curl);
   curl_global_cleanup();
index 4177ed0b3766dec4c3067637579700ea580059e7..bbd9c8e0a48da6e1692e64f4845e5a01044eeacf 100644 (file)
@@ -51,7 +51,7 @@ CURLcode test(char *URL)
   memset(testbuf, 'A', MAX_INPUT_LENGTH + 1);
   testbuf[MAX_INPUT_LENGTH + 1] = 0;
 
-  printf("string length: %d\n", (int)strlen(testbuf));
+  curl_mprintf("string length: %d\n", (int)strlen(testbuf));
 
   for(o = curl_easy_option_next(NULL);
       o;
@@ -85,8 +85,8 @@ CURLcode test(char *URL)
         break;
       default:
         /* all other return codes are unexpected */
-        fprintf(stderr, "curl_easy_setopt(%s...) returned %d\n",
-                o->name, result);
+        curl_mfprintf(stderr, "curl_easy_setopt(%s...) returned %d\n",
+                      o->name, result);
         error++;
         break;
       }
index b6667c004146f5e428fb34fa6081abc78096bf6d..26ad6e5af58dc98f286ebae59b62142049451d1a 100644 (file)
@@ -27,8 +27,9 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-#define print_err(name, exp) \
-  fprintf(stderr, "Type mismatch for CURLOPT_%s (expected %s)\n", name, exp);
+#define print_err(name, exp)                                            \
+  curl_mfprintf(stderr, "Type mismatch for CURLOPT_%s (expected %s)\n", \
+                name, exp);
 
 CURLcode test(char *URL)
 {
index ead6713a0e840d06ab148fe6f03a11165c9b6307..02c225a3237bf0a5110a45c2a4229dfa01351914 100644 (file)
@@ -66,7 +66,7 @@ static CURLSTScode hstsread(CURL *easy, struct curl_hstsentry *e,
     strcpy(e->name, host);
     e->includeSubDomains = FALSE;
     strcpy(e->expire, expire);
-    fprintf(stderr, "add '%s'\n", host);
+    curl_mfprintf(stderr, "add '%s'\n", host);
   }
   else
     return CURLSTS_DONE;
@@ -89,7 +89,7 @@ static CURLSTScode hstswrite(CURL *easy, struct curl_hstsentry *e,
 {
   (void)easy;
   (void)userp;
-  printf("[%zu/%zu] %s %s\n", i->index, i->total, e->name, e->expire);
+  curl_mprintf("[%zu/%zu] %s %s\n", i->index, i->total, e->name, e->expire);
   return CURLSTS_OK;
 }
 
@@ -124,7 +124,7 @@ CURLcode test(char *URL)
   hnd = NULL;
   if(res == CURLE_OPERATION_TIMEDOUT) /* we expect that on Windows */
     res = CURLE_COULDNT_CONNECT;
-  printf("First request returned %d\n", res);
+  curl_mprintf("First request returned %d\n", res);
   res = CURLE_OK;
 
   easy_init(hnd);
@@ -141,7 +141,7 @@ CURLcode test(char *URL)
   res = curl_easy_perform(hnd);
   curl_easy_cleanup(hnd);
   hnd = NULL;
-  printf("Second request returned %d\n", res);
+  curl_mprintf("Second request returned %d\n", res);
 
 test_cleanup:
   curl_easy_cleanup(hnd);
index 36a938b61d99ef5da41c70c62479e404af8c606a..b8655191eee2289074bf8b0e04e15f9b9e63a277 100644 (file)
@@ -32,7 +32,7 @@ CURLcode test(char *URL)
   CURLcode res = CURLE_OK;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -47,7 +47,7 @@ CURLcode test(char *URL)
 #endif
     res = curl_easy_perform(curl);
     if(res) {
-      printf("res: %d\n", res);
+      curl_mprintf("res: %d\n", res);
     }
     curl_easy_cleanup(curl);
   }
index 7eaf41bd4f03c3d314cf9ca70978b203470f53bc..359c64e472785ed7aa403b7b2d42b5cdac714d2f 100644 (file)
@@ -43,12 +43,12 @@ CURLcode test(char *URL)
       curl_easy_option_by_id(o->id);
 
     if(ename->id != o->id) {
-      printf("name lookup id %d doesn't match %d\n",
-             ename->id, o->id);
+      curl_mprintf("name lookup id %d doesn't match %d\n",
+                   ename->id, o->id);
     }
     else if(eid->id != o->id) {
-      printf("ID lookup %d doesn't match %d\n",
-             ename->id, o->id);
+      curl_mprintf("ID lookup %d doesn't match %d\n",
+                   ename->id, o->id);
     }
   }
   curl_global_cleanup();
index 554756c3ca4b52c390dca8932fcadc6fa0dbe289..597b54c368e0f1c3cba00ae1e4d7645d38ab9768 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *list = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 6257759fe33084eb04a5f553fe7b2447568e7c69..9756a01c196a147a4e341903c51a7a154b96b011 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *list = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 8800916c8696762911ac440471813bd6eaf99491..7396203b56aabea91d507111a334239b7044d665 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *list = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index c136fc0a25d989f5511576235307bc2801e8d6e3..350f7b696ae3626dfec04062be699c344a518bec 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *list = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 61f71127b4861837754db8f7e356498c3b22071a..05ca7c35d5a3b7f21478f60d335e998e31446f39 100644 (file)
@@ -34,13 +34,13 @@ CURLcode test(char *URL)
   struct curl_slist *list = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 02ab6cc20192ca9df7efca606c66b7bb3d4b3751..c241971526238103075c8d1425d21db22e4afab3 100644 (file)
@@ -35,13 +35,13 @@ CURLcode test(char *URL)
   unsigned char data[] = {0x70, 0x6f, 0x73, 0x74, 0, 0x44, 0x61, 0x74, 0x61};
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index c7365e5fec5d7ef9f232d6584f0621eda39f6485..6dc0cc8d9ffab2d50cf95eada987d21da597f229 100644 (file)
@@ -59,7 +59,7 @@ CURLcode test(char *URL)
           m = curl_multi_perform(multi, &running_handles);
 
         if(m)
-          fprintf(stderr, "curl_multi_perform failed\n");
+          curl_mfprintf(stderr, "curl_multi_perform failed\n");
       }
       /* Close the easy handle *before* the multi handle. Doing it the other
          way around avoids the issue. */
index e8dbcdd13f95d65dc295f06297615ba3594d2aaf..16e288029b614b2843a6b92380fbae53f86b083e 100644 (file)
@@ -58,8 +58,8 @@ static void showem(CURL *easy, unsigned int type)
         size_t index = 0;
         size_t amount = header->amount;
         do {
-          printf("- %s == %s (%u/%u)\n", header->name, header->value,
-                 (int)index, (int)amount);
+          curl_mprintf("- %s == %s (%u/%u)\n", header->name, header->value,
+                       (int)index, (int)amount);
 
           if(++index == amount)
             break;
@@ -70,7 +70,7 @@ static void showem(CURL *easy, unsigned int type)
       }
       else {
         /* only one of this */
-        printf(" %s == %s\n", header->name, header->value);
+        curl_mprintf(" %s == %s\n", header->name, header->value);
       }
     }
   }
index 301da6bd77b1fcd16bda24152ffa152a6d2f8f15..a043de2eb4b214feac942e51cc622dd2505932d1 100644 (file)
@@ -33,8 +33,8 @@ static void showem(CURL *easy, unsigned int type)
 
   /* !checksrc! disable EQUALSNULL 1 */
   while((header = curl_easy_nextheader(easy, type, 0, prev)) != NULL) {
-    printf(" %s == %s (%u/%u)\n", header->name, header->value,
-           (int)header->index, (int)header->amount);
+    curl_mprintf(" %s == %s (%u/%u)\n", header->name, header->value,
+                 (int)header->index, (int)header->amount);
     prev = header;
   }
 }
@@ -67,7 +67,7 @@ CURLcode test(char *URL)
   }
   res = curl_easy_perform(easy);
   if(res) {
-    printf("badness: %d\n", res);
+    curl_mprintf("badness: %d\n", res);
   }
   showem(easy, CURLH_CONNECT|CURLH_HEADER|CURLH_TRAILER|CURLH_1XX);
 
index cd14e266196888048d09811dcdfcb43618264bd8..c57bd5c7472ef61a7451c4bb0189edcacd6e44a4 100644 (file)
@@ -51,8 +51,8 @@ CURLcode test(char *URL)
   easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "curl_easy_perform() failed: %s\n",
-            curl_easy_strerror(res));
+    curl_mfprintf(stderr, "curl_easy_perform() failed: %s\n",
+                  curl_easy_strerror(res));
     goto test_cleanup;
   }
 
@@ -65,14 +65,14 @@ CURLcode test(char *URL)
     if(h)
       count++;
   } while(h);
-  printf("count = %u\n", count);
+  curl_mprintf("count = %u\n", count);
 
   /* perform another request - without redirect */
   easy_setopt(curl, CURLOPT_URL, libtest_arg2);
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "curl_easy_perform() failed: %s\n",
-            curl_easy_strerror(res));
+    curl_mfprintf(stderr, "curl_easy_perform() failed: %s\n",
+                  curl_easy_strerror(res));
     goto test_cleanup;
   }
 
@@ -83,7 +83,7 @@ CURLcode test(char *URL)
     if(h)
       count++;
   } while(h);
-  printf("count = %u\n", count);
+  curl_mprintf("count = %u\n", count);
 
 test_cleanup:
   curl_easy_cleanup(curl);
index 39b5754ad133c302aba83418652978e84e4bb281..73b395b1e392a8563dd1632bf1cc529c1b28cf97 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *connect_to = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 669e143931dc23209fff8e1a6669f5956b03205a..5d52e163f4a14d6396775ea5971dfa86ff8ae7e7 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *connect_to = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 7cc35e42b6decb069247f2cd2a03d7576200a492..855b92ce283464710251573d1bded79051ee0eb9 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *connect_to = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 58b4ea79b17d38dbd7e1d2a654829b27a0f1c280..af369e2d0b1c022bd27af86a3a743f0b0f0f3b78 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *connect_to = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 1fbf26c0be50db9f696e6547591ce61186e2cac3..a89a3764adbb8446e2e91a3283d1eb12dbda832d 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *connect_to = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index dc9eb9c7b4011d866c4ae66ce3f01124b5f6aba1..00d231c14458663bb95a9c88f0dad6e1ace55f8d 100644 (file)
@@ -90,7 +90,7 @@ CURLcode test(char *URL)
   port = (unsigned short)atoi(libtest_arg3);
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -101,7 +101,7 @@ CURLcode test(char *URL)
    */
   client_fd = socket(AF_INET, SOCK_STREAM, 0);
   if(client_fd == CURL_SOCKET_BAD) {
-    fprintf(stderr, "socket creation error\n");
+    curl_mfprintf(stderr, "socket creation error\n");
     goto test_cleanup;
   }
 
@@ -109,19 +109,19 @@ CURLcode test(char *URL)
   serv_addr.sin_port = htons(port);
 
   if(my_inet_pton(AF_INET, libtest_arg2, &serv_addr.sin_addr) <= 0) {
-    fprintf(stderr, "inet_pton failed\n");
+    curl_mfprintf(stderr, "inet_pton failed\n");
     goto test_cleanup;
   }
 
   status = connect(client_fd, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
   if(status < 0) {
-    fprintf(stderr, "connection failed\n");
+    curl_mfprintf(stderr, "connection failed\n");
     goto test_cleanup;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     goto test_cleanup;
   }
 
@@ -150,7 +150,7 @@ test_cleanup:
 CURLcode test(char *URL)
 {
   (void)URL;
-  printf("lacks inet_pton\n");
+  curl_mprintf("lacks inet_pton\n");
   return CURLE_OK;
 }
 #endif
index f0b9d517bf737976533c0a941767e7723936fd21..d806e131c25adfe5c3c89b03b661a8672987f3a4 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *connect_to = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 8f4be08b2a9e85a534ac3423fd0ba24eec4f3d27..46a4b21ee552752806752e9d9b0a5c8ea0866b01 100644 (file)
@@ -43,13 +43,13 @@ CURLcode test(char *URL)
   struct curl_slist *connect_to = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index a51c45018bf2205c13749fad00ae15796e722aed..d4147ab0e3cf915218b6b26ab4732c5a64102a4c 100644 (file)
@@ -35,13 +35,13 @@ CURLcode test(char *URL)
   struct curl_slist *connect_to = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 4b2ba95c6dc8a89c5b1a0c988bb385f93459eea6..fd886ff3984906b9d926d8e69215fd19508cfe12 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *connect_to = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 41922fa607e10e3a90913e0b34984256810b212a..1e3671c5b0edd00a8e6c4107dcde07f4db3a7b9a 100644 (file)
@@ -32,13 +32,13 @@ CURLcode test(char *URL)
   struct curl_slist *connect_to = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 0cd9be24b0a04e94fe517ba0a2527a1a0dce22c9..1ed4c70f7f6f3cb05c4e0425574b366143930d39 100644 (file)
@@ -43,13 +43,13 @@ CURLcode test(char *URL)
   struct curl_slist *connect_to = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 939ac0b5958b35d2bb8ee9551dcefcdd7db4568c..5f030f493e00516b8c319cb6d52f056cb1e0fb26 100644 (file)
@@ -50,7 +50,7 @@ CURLcode test(char *URL)
   res = curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective);
   if(res)
     goto test_cleanup;
-  printf("effective URL: %s\n", effective);
+  curl_mprintf("effective URL: %s\n", effective);
 
 
   /* second transfer: set URL + query in the second CURLU handle */
@@ -66,7 +66,7 @@ CURLcode test(char *URL)
   res = curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective);
   if(res)
     goto test_cleanup;
-  printf("effective URL: %s\n", effective);
+  curl_mprintf("effective URL: %s\n", effective);
 
 
   /* third transfer: append extra query in the second CURLU handle, but do not
@@ -83,7 +83,7 @@ CURLcode test(char *URL)
   res = curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective);
   if(res)
     goto test_cleanup;
-  printf("effective URL: %s\n", effective);
+  curl_mprintf("effective URL: %s\n", effective);
 
 
 test_cleanup:
index 07554547f49953d399bbc1aea014516a7d64b8df..f19ec428183e6413ec8f89629ef87dcd3587f96c 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *list = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index e903e93760ec69c0483df0cce07df4985441e607..8a370928a3269719cae37b85b192e9a39c781122 100644 (file)
@@ -32,8 +32,8 @@ static CURLcode send_ping(CURL *curl, const char *send_payload)
   size_t sent;
   CURLcode result =
     curl_ws_send(curl, send_payload, strlen(send_payload), &sent, CURLWS_PING);
-  fprintf(stderr,
-          "ws: curl_ws_send returned %d, sent %d\n", result, (int)sent);
+  curl_mfprintf(stderr,
+                "ws: curl_ws_send returned %d, sent %d\n", result, (int)sent);
 
   return result;
 }
@@ -47,21 +47,22 @@ static CURLcode recv_pong(CURL *curl, const char *expected_payload)
     curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &rflags);
   if(rflags & CURLWS_PONG) {
     int same = 0;
-    fprintf(stderr, "ws: got PONG back\n");
+    curl_mfprintf(stderr, "ws: got PONG back\n");
     if(rlen == strlen(expected_payload)) {
       if(!memcmp(expected_payload, buffer, rlen)) {
-        fprintf(stderr, "ws: got the same payload back\n");
+        curl_mfprintf(stderr, "ws: got the same payload back\n");
         same = 1;
       }
     }
     if(!same)
-      fprintf(stderr, "ws: did NOT get the same payload back\n");
+      curl_mfprintf(stderr, "ws: did NOT get the same payload back\n");
   }
   else {
-    fprintf(stderr, "recv_pong: got %d bytes rflags %x\n", (int)rlen, rflags);
+    curl_mfprintf(stderr, "recv_pong: got %d bytes rflags %x\n",
+                  (int)rlen, rflags);
   }
-  fprintf(stderr, "ws: curl_ws_recv returned %d, received %d\n", result,
-          (int)rlen);
+  curl_mfprintf(stderr, "ws: curl_ws_recv returned %d, received %d\n", result,
+                (int)rlen);
   return result;
 }
 
@@ -71,14 +72,14 @@ static void websocket_close(CURL *curl)
   size_t sent;
   CURLcode result =
     curl_ws_send(curl, "", 0, &sent, CURLWS_CLOSE);
-  fprintf(stderr,
-          "ws: curl_ws_send returned %d, sent %d\n", result, (int)sent);
+  curl_mfprintf(stderr,
+                "ws: curl_ws_send returned %d, sent %d\n", result, (int)sent);
 }
 
 static void websocket(CURL *curl)
 {
   int i = 0;
-  fprintf(stderr, "ws: websocket() starts\n");
+  curl_mfprintf(stderr, "ws: websocket() starts\n");
   do {
     if(send_ping(curl, "foobar"))
       return;
@@ -101,21 +102,21 @@ static size_t writecb(char *b, size_t size, size_t nitems, void *p)
     0x8a, 0x0
   };
   size_t incoming = nitems;
-  fprintf(stderr, "Called CURLOPT_WRITEFUNCTION with %d bytes: ",
-          (int)nitems);
+  curl_mfprintf(stderr, "Called CURLOPT_WRITEFUNCTION with %d bytes: ",
+                (int)nitems);
   for(i = 0; i < nitems; i++)
-    fprintf(stderr, "%02x ", (unsigned char)buffer[i]);
-  fprintf(stderr, "\n");
+    curl_mfprintf(stderr, "%02x ", (unsigned char)buffer[i]);
+  curl_mfprintf(stderr, "\n");
   (void)size;
   if(buffer[0] == 0x89) {
     CURLcode result;
-    fprintf(stderr, "send back a simple PONG\n");
+    curl_mfprintf(stderr, "send back a simple PONG\n");
     result = curl_ws_send(easy, pong, 2, &sent, 0, 0);
     if(result)
       nitems = 0;
   }
   if(nitems != incoming)
-    fprintf(stderr, "returns error from callback\n");
+    curl_mfprintf(stderr, "returns error from callback\n");
   return nitems;
 }
 
@@ -137,7 +138,7 @@ CURLcode test(char *URL)
     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writecb);
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, curl);
     res = curl_easy_perform(curl);
-    fprintf(stderr, "curl_easy_perform() returned %d\n", res);
+    curl_mfprintf(stderr, "curl_easy_perform() returned %d\n", res);
 #if 0
     if(res == CURLE_OK)
       websocket(curl);
index c83a04c783e113ff2f0ac42e9e30f7c5c4bb7514..1207a3a9af18e4e833a897b2a2cc3e8f6d7a3278 100644 (file)
@@ -45,13 +45,13 @@ static void flush_data(struct ws_data *wd)
     return;
 
   for(i = 0; i < wd->blen; ++i)
-    printf("%02x ", (unsigned char)wd->buf[i]);
+    curl_mprintf("%02x ", (unsigned char)wd->buf[i]);
 
-  printf("\n");
+  curl_mprintf("\n");
   if(wd->has_meta)
-    printf("RECFLAGS: %x\n", wd->meta_flags);
+    curl_mprintf("RECFLAGS: %x\n", wd->meta_flags);
   else
-    fprintf(stderr, "RECFLAGS: NULL\n");
+    curl_mfprintf(stderr, "RECFLAGS: NULL\n");
   wd->blen = 0;
   wd->nwrites = 0;
 }
@@ -89,7 +89,7 @@ static size_t writecb(char *buffer, size_t size, size_t nitems, void *p)
   incoming = add_data(ws_data, buffer, incoming, meta);
 
   if(nitems != incoming)
-    fprintf(stderr, "returns error from callback\n");
+    curl_mfprintf(stderr, "returns error from callback\n");
   return nitems;
 }
 
@@ -115,7 +115,7 @@ CURLcode test(char *URL)
       curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writecb);
       curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ws_data);
       res = curl_easy_perform(curl);
-      fprintf(stderr, "curl_easy_perform() returned %d\n", res);
+      curl_mfprintf(stderr, "curl_easy_perform() returned %d\n", res);
       /* always cleanup */
       curl_easy_cleanup(curl);
       flush_data(&ws_data);
index bc8a1f343628e41aa98ce1a444887ea99be66fca..74053538bf4efce351616d7c2d818d0a4cf2486d 100644 (file)
@@ -32,8 +32,8 @@ static CURLcode send_ping(CURL *curl, const char *send_payload)
   CURLcode result =
     curl_ws_send(curl, send_payload, strlen(send_payload), &sent, 0,
                  CURLWS_PING);
-  fprintf(stderr,
-          "ws: curl_ws_send returned %d, sent %d\n", result, (int)sent);
+  curl_mfprintf(stderr,
+                "ws: curl_ws_send returned %d, sent %d\n", result, (int)sent);
 
   return result;
 }
@@ -47,23 +47,23 @@ static CURLcode recv_pong(CURL *curl, const char *expected_payload)
   if(!result) {
     if(meta->flags & CURLWS_PONG) {
       int same = 0;
-      fprintf(stderr, "ws: got PONG back\n");
+      curl_mfprintf(stderr, "ws: got PONG back\n");
       if(rlen == strlen(expected_payload)) {
         if(!memcmp(expected_payload, buffer, rlen)) {
-          fprintf(stderr, "ws: got the same payload back\n");
+          curl_mfprintf(stderr, "ws: got the same payload back\n");
           same = 1;
         }
       }
       if(!same)
-        fprintf(stderr, "ws: did NOT get the same payload back\n");
+        curl_mfprintf(stderr, "ws: did NOT get the same payload back\n");
     }
     else {
-      fprintf(stderr, "recv_pong: got %d bytes rflags %x\n", (int)rlen,
-              meta->flags);
+      curl_mfprintf(stderr, "recv_pong: got %d bytes rflags %x\n", (int)rlen,
+                    meta->flags);
     }
   }
-  fprintf(stderr, "ws: curl_ws_recv returned %d, received %d\n", result,
-          (int)rlen);
+  curl_mfprintf(stderr, "ws: curl_ws_recv returned %d, received %d\n", result,
+                (int)rlen);
   return result;
 }
 
@@ -76,8 +76,8 @@ static CURLcode recv_any(CURL *curl)
   if(result)
     return result;
 
-  fprintf(stderr, "recv_any: got %u bytes rflags %x\n", (int)rlen,
-          meta->flags);
+  curl_mfprintf(stderr, "recv_any: got %u bytes rflags %x\n", (int)rlen,
+                meta->flags);
   return CURLE_OK;
 }
 
@@ -87,22 +87,22 @@ static void websocket_close(CURL *curl)
   size_t sent;
   CURLcode result =
     curl_ws_send(curl, "", 0, &sent, 0, CURLWS_CLOSE);
-  fprintf(stderr,
-          "ws: curl_ws_send returned %d, sent %u\n", result, (int)sent);
+  curl_mfprintf(stderr,
+                "ws: curl_ws_send returned %d, sent %u\n", result, (int)sent);
 }
 
 static void websocket(CURL *curl)
 {
   int i = 0;
-  fprintf(stderr, "ws: websocket() starts\n");
+  curl_mfprintf(stderr, "ws: websocket() starts\n");
   do {
     recv_any(curl);
-    fprintf(stderr, "Send ping\n");
+    curl_mfprintf(stderr, "Send ping\n");
     if(send_ping(curl, "foobar"))
       return;
-    fprintf(stderr, "Receive pong\n");
+    curl_mfprintf(stderr, "Receive pong\n");
     if(recv_pong(curl, "foobar")) {
-      printf("Connection closed\n");
+      curl_mprintf("Connection closed\n");
       return;
     }
     sleep(2);
@@ -126,7 +126,7 @@ CURLcode test(char *URL)
     curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
     curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */
     res = curl_easy_perform(curl);
-    fprintf(stderr, "curl_easy_perform() returned %d\n", res);
+    curl_mfprintf(stderr, "curl_easy_perform() returned %d\n", res);
     if(res == CURLE_OK)
       websocket(curl);
 
index 71ee19496a3a2459d4219399795411341674b862..fc712ac1667b2368a0cba597e93d75aac38b11b8 100644 (file)
@@ -34,8 +34,8 @@ static void websocket_close(CURL *curl)
   size_t sent;
   CURLcode result =
     curl_ws_send(curl, "", 0, &sent, 0, CURLWS_CLOSE);
-  fprintf(stderr,
-          "ws: curl_ws_send returned %d, sent %d\n", result, (int)sent);
+  curl_mfprintf(stderr,
+                "ws: curl_ws_send returned %d, sent %d\n", result, (int)sent);
 }
 
 static void websocket(CURL *curl)
@@ -57,14 +57,14 @@ static void websocket(CURL *curl)
         /* crude busy-loop */
         continue;
       fclose(save);
-      printf("curl_ws_recv returned %d\n", result);
+      curl_mprintf("curl_ws_recv returned %d\n", result);
       return;
     }
-    printf("%d: nread %zu Age %d Flags %x "
-           "Offset %" CURL_FORMAT_CURL_OFF_T " "
-           "Bytesleft %" CURL_FORMAT_CURL_OFF_T "\n",
-           (int)i,
-           nread, meta->age, meta->flags, meta->offset, meta->bytesleft);
+    curl_mprintf("%d: nread %zu Age %d Flags %x "
+                 "Offset %" CURL_FORMAT_CURL_OFF_T " "
+                 "Bytesleft %" CURL_FORMAT_CURL_OFF_T "\n",
+                 (int)i,
+                 nread, meta->age, meta->flags, meta->offset, meta->bytesleft);
     i += meta->len;
     fwrite(buffer, 1, nread, save);
   }
@@ -93,7 +93,7 @@ CURLcode test(char *URL)
     curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
     curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */
     res = curl_easy_perform(curl);
-    fprintf(stderr, "curl_easy_perform() returned %d\n", res);
+    curl_mfprintf(stderr, "curl_easy_perform() returned %d\n", res);
     if(res == CURLE_OK)
       websocket(curl);
 
index 47e0763c81515912a81faa61b2ce4d6de6f0e819..68f1357d3f8b49c09c3c1ed476c91dbf2c7bec9a 100644 (file)
@@ -46,7 +46,7 @@ CURLcode test(char *URL)
   curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cb_curl);
   curl_easy_setopt(curl, CURLOPT_URL, URL);
   res = curl_easy_perform(curl);
-  printf("Returned %d, should be %d.\n", res, CURLE_WRITE_ERROR);
+  curl_mprintf("Returned %d, should be %d.\n", res, CURLE_WRITE_ERROR);
   fflush(stdout);
   curl_easy_cleanup(curl);
   curl_global_cleanup();
index 11f1c1fbd886846d5901b03ba9cd0314672fec99..23519c29c645c848ca446a0f0371d965fd5feb05 100644 (file)
@@ -55,7 +55,7 @@ CURLcode test(char *URL)
     curldupe = curl_easy_duphandle(curl);
     if(curldupe) {
       res = curl_easy_perform(curldupe);
-      printf("Returned %d, should be %d.\n", res, CURLE_WRITE_ERROR);
+      curl_mprintf("Returned %d, should be %d.\n", res, CURLE_WRITE_ERROR);
       fflush(stdout);
       curl_easy_cleanup(curldupe);
     }
index a3d163ae21f91d7e5c42a6a8965958754cf8f975..f5fe7dcca90868108e5eb028abbc37430c50add9 100644 (file)
@@ -54,7 +54,7 @@ CURLcode test(char *URL)
     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writecb);
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, curl);
     res = curl_easy_perform(curl);
-    printf("Returned %d, should be %d.\n", res, CURLE_RECV_ERROR);
+    curl_mprintf("Returned %d, should be %d.\n", res, CURLE_RECV_ERROR);
 
     /* always cleanup */
     curl_easy_cleanup(curl);
index 9a9608e82c382884aae4dc8b009e142cdc1c1df8..428b637e29c1af50e5618eefae93bd14343f5baa 100644 (file)
@@ -34,8 +34,8 @@ static void websocket_close(CURL *curl)
   size_t sent;
   CURLcode result =
     curl_ws_send(curl, "", 0, &sent, 0, CURLWS_CLOSE);
-  fprintf(stderr,
-          "ws: curl_ws_send returned %d, sent %zu\n", result, sent);
+  curl_mfprintf(stderr,
+                "ws: curl_ws_send returned %d, sent %zu\n", result, sent);
 }
 
 static void websocket_frame(CURL *curl, FILE *save, int expected_flags)
@@ -56,14 +56,14 @@ static void websocket_frame(CURL *curl, FILE *save, int expected_flags)
       if(result == CURLE_AGAIN)
         /* crude busy-loop */
         continue;
-      printf("curl_ws_recv returned %d\n", result);
+      curl_mprintf("curl_ws_recv returned %d\n", result);
       return;
     }
-    printf("%d: nread %zu Age %d Flags %x "
-           "Offset %" CURL_FORMAT_CURL_OFF_T " "
-           "Bytesleft %" CURL_FORMAT_CURL_OFF_T "\n",
-           (int)total_read,
-           nread, meta->age, meta->flags, meta->offset, meta->bytesleft);
+    curl_mprintf("%d: nread %zu Age %d Flags %x "
+                 "Offset %" CURL_FORMAT_CURL_OFF_T " "
+                 "Bytesleft %" CURL_FORMAT_CURL_OFF_T "\n",
+                 (int)total_read,
+                 nread, meta->age, meta->flags, meta->offset, meta->bytesleft);
     assert(meta->flags == expected_flags);
     total_read += nread;
     fwrite(buffer, 1, nread, save);
@@ -111,7 +111,7 @@ CURLcode test(char *URL)
     curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
     curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */
     res = curl_easy_perform(curl);
-    fprintf(stderr, "curl_easy_perform() returned %d\n", res);
+    curl_mfprintf(stderr, "curl_easy_perform() returned %d\n", res);
     if(res == CURLE_OK)
       websocket(curl);
 
index 53998d8369de0b7767fce4f490115386009bed21..7f1b085d4da8b00d76b74b602feb3ef6dc6f12af 100644 (file)
@@ -41,23 +41,23 @@ static size_t write_cb(char *b, size_t size, size_t nitems, void *p)
 
   /* upon ping, respond with input data, disconnect, mark a success */
   if(frame->flags & CURLWS_PING) {
-    fprintf(stderr, "write_cb received ping with %zd bytes\n",
-      size * nitems);
-    fprintf(stderr, "\n");
+    curl_mfprintf(stderr, "write_cb received ping with %zd bytes\n",
+                  size * nitems);
+    curl_mfprintf(stderr, "\n");
     for(i = 0; i < size * nitems; i++) {
-      fprintf(stderr, "%02X%s", (int)b[i],
-          (i % 10 == 0 && i != 0) ? "\n" : " ");
+      curl_mfprintf(stderr, "%02X%s", (int)b[i],
+                    (i % 10 == 0 && i != 0) ? "\n" : " ");
     }
-    fprintf(stderr, "\n");
-    fprintf(stderr, "write_cb sending pong response\n");
+    curl_mfprintf(stderr, "\n");
+    curl_mfprintf(stderr, "write_cb sending pong response\n");
     curl_ws_send(curl, b, size * nitems, &sent, 0, CURLWS_PONG);
-    fprintf(stderr, "write_cb closing websocket\n");
+    curl_mfprintf(stderr, "write_cb closing websocket\n");
     curl_ws_send(curl, NULL, 0, &sent, 0, CURLWS_CLOSE);
     ping_check->pinged = 1;
   }
   else {
-    fprintf(stderr, "ping_check_cb: non-ping message, frame->flags %x\n",
-      frame->flags);
+    curl_mfprintf(stderr, "ping_check_cb: non-ping message, frame->flags %x\n",
+                  frame->flags);
   }
 
   return size * nitems;
@@ -86,7 +86,7 @@ CURLcode test(char *URL)
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, &state);
 
     res = curl_easy_perform(curl);
-    fprintf(stderr, "curl_easy_perform() returned %u\n", (int)res);
+    curl_mfprintf(stderr, "curl_easy_perform() returned %u\n", (int)res);
 
     res = state.pinged ? 0 : 1;
 
index c58946bb1bbfad6936e5985bb58adba46a583fd0..9e3e8fba7904799432bc60dedc9c7582e51ad502 100644 (file)
@@ -46,12 +46,12 @@ CURLcode test(char *URL)
 
   (void)URL;
 
-  msnprintf(dnsentry, sizeof(dnsentry), "localhost:%s:%s",
-            port, address);
-  printf("%s\n", dnsentry);
+  curl_msnprintf(dnsentry, sizeof(dnsentry), "localhost:%s:%s",
+                 port, address);
+  curl_mprintf("%s\n", dnsentry);
   slist = curl_slist_append(slist, dnsentry);
   if(!slist) {
-    fprintf(stderr, "curl_slist_append() failed\n");
+    curl_mfprintf(stderr, "curl_slist_append() failed\n");
     goto test_cleanup;
   }
 
@@ -68,9 +68,9 @@ CURLcode test(char *URL)
     /* get an easy handle */
     easy_init(curl[i]);
     /* specify target */
-    msnprintf(target_url, sizeof(target_url),
-              "https://localhost:%s/path/2402%04i",
-              port, i + 1);
+    curl_msnprintf(target_url, sizeof(target_url),
+                   "https://localhost:%s/path/2402%04i",
+                   port, i + 1);
     target_url[sizeof(target_url) - 1] = '\0';
     easy_setopt(curl[i], CURLOPT_URL, target_url);
     /* go http2 */
@@ -88,7 +88,7 @@ CURLcode test(char *URL)
     easy_setopt(curl[i], CURLOPT_RESOLVE, slist);
   }
 
-  fprintf(stderr, "Start at URL 0\n");
+  curl_mfprintf(stderr, "Start at URL 0\n");
 
   for(i = 0; i < NUM_HANDLES; i++) {
     /* add handle to multi */
index ed47d42578bcff8a3a2a48dc3dc5995d053453ba..c4d8e5df58b6d4762e36d14dce5baf01cba3edc7 100644 (file)
@@ -46,12 +46,12 @@ CURLcode test(char *URL)
 
   (void)URL;
 
-  msnprintf(dnsentry, sizeof(dnsentry), "localhost:%s:%s",
-            port, address);
-  printf("%s\n", dnsentry);
+  curl_msnprintf(dnsentry, sizeof(dnsentry), "localhost:%s:%s",
+                 port, address);
+  curl_mprintf("%s\n", dnsentry);
   slist = curl_slist_append(slist, dnsentry);
   if(!slist) {
-    fprintf(stderr, "curl_slist_append() failed\n");
+    curl_mfprintf(stderr, "curl_slist_append() failed\n");
     goto test_cleanup;
   }
 
@@ -68,9 +68,9 @@ CURLcode test(char *URL)
     /* get an easy handle */
     easy_init(curl[i]);
     /* specify target */
-    msnprintf(target_url, sizeof(target_url),
-              "https://localhost:%s/path/2404%04i",
-              port, i + 1);
+    curl_msnprintf(target_url, sizeof(target_url),
+                   "https://localhost:%s/path/2404%04i",
+                   port, i + 1);
     target_url[sizeof(target_url) - 1] = '\0';
     easy_setopt(curl[i], CURLOPT_URL, target_url);
     /* go http2 */
@@ -90,7 +90,7 @@ CURLcode test(char *URL)
     easy_setopt(curl[i], CURLOPT_STREAM_WEIGHT, (long)128 + i);
   }
 
-  fprintf(stderr, "Start at URL 0\n");
+  curl_mfprintf(stderr, "Start at URL 0\n");
 
   for(i = 0; i < NUM_HANDLES; i++) {
     /* add handle to multi */
index 9a9bb2c637e8e1be8a5f92573346fc3b6723d2d9..fe40a3ba09ef1c6935d58cc2d86c1dbe234e11c5 100644 (file)
 
 #define test_check(expected_fds) \
   if(res != CURLE_OK) { \
-    fprintf(stderr, "test failed with code: %d\n", res); \
+    curl_mfprintf(stderr, "test failed with code: %d\n", res); \
     goto test_cleanup; \
   } \
   else if(fd_count != expected_fds) { \
-    fprintf(stderr, "Max number of waitfds: %d not as expected: %d\n", \
+    curl_mfprintf(stderr, "Max number of waitfds: %d not as expected: %d\n", \
       fd_count, expected_fds); \
     res = TEST_ERR_FAILURE; \
     goto test_cleanup; \
@@ -172,8 +172,8 @@ static CURLcode test_run(char *URL, long option, unsigned int *max_fd_count)
     mc = curl_multi_waitfds(multi, NULL, 0, NULL);
 
     if(mc != CURLM_BAD_FUNCTION_ARGUMENT) {
-      fprintf(stderr, "curl_multi_waitfds() return code %d instead of "
-        "CURLM_BAD_FUNCTION_ARGUMENT.\n", mc);
+      curl_mfprintf(stderr, "curl_multi_waitfds() return code %d instead of "
+                    "CURLM_BAD_FUNCTION_ARGUMENT.\n", mc);
       res = TEST_ERR_FAILURE;
       break;
     }
@@ -181,8 +181,8 @@ static CURLcode test_run(char *URL, long option, unsigned int *max_fd_count)
     mc = curl_multi_waitfds(multi, NULL, 1, NULL);
 
     if(mc != CURLM_BAD_FUNCTION_ARGUMENT) {
-      fprintf(stderr, "curl_multi_waitfds() return code %d instead of "
-        "CURLM_BAD_FUNCTION_ARGUMENT.\n", mc);
+      curl_mfprintf(stderr, "curl_multi_waitfds() return code %d instead of "
+                    "CURLM_BAD_FUNCTION_ARGUMENT.\n", mc);
       res = TEST_ERR_FAILURE;
       break;
     }
@@ -190,8 +190,8 @@ static CURLcode test_run(char *URL, long option, unsigned int *max_fd_count)
     mc = curl_multi_waitfds(multi, NULL, 1, &fd_count);
 
     if(mc != CURLM_BAD_FUNCTION_ARGUMENT) {
-      fprintf(stderr, "curl_multi_waitfds() return code %d instead of "
-        "CURLM_BAD_FUNCTION_ARGUMENT.\n", mc);
+      curl_mfprintf(stderr, "curl_multi_waitfds() return code %d instead of "
+                    "CURLM_BAD_FUNCTION_ARGUMENT.\n", mc);
       res = TEST_ERR_FAILURE;
       break;
     }
@@ -199,7 +199,7 @@ static CURLcode test_run(char *URL, long option, unsigned int *max_fd_count)
     mc = curl_multi_waitfds(multi, ufds, 10, &fd_count);
 
     if(mc != CURLM_OK) {
-      fprintf(stderr, "curl_multi_waitfds() failed, code %d.\n", mc);
+      curl_mfprintf(stderr, "curl_multi_waitfds() failed, code %d.\n", mc);
       res = TEST_ERR_FAILURE;
       break;
     }
@@ -212,14 +212,15 @@ static CURLcode test_run(char *URL, long option, unsigned int *max_fd_count)
     mc = curl_multi_waitfds(multi, NULL, 0, &fd_count_chk);
 
     if(mc != CURLM_OK) {
-      fprintf(stderr, "curl_multi_waitfds() failed, code %d.\n", mc);
+      curl_mfprintf(stderr, "curl_multi_waitfds() failed, code %d.\n", mc);
       res = TEST_ERR_FAILURE;
       break;
     }
 
     if(fd_count_chk < fd_count) {
-      fprintf(stderr, "curl_multi_waitfds() should return at least the number "
-        "of fds needed\n");
+      curl_mfprintf(stderr,
+                    "curl_multi_waitfds() should return at least the number "
+                    "of fds needed\n");
       res = TEST_ERR_FAILURE;
       break;
     }
@@ -228,15 +229,16 @@ static CURLcode test_run(char *URL, long option, unsigned int *max_fd_count)
     mc = curl_multi_waitfds(multi, ufds1, fd_count - 1, &fd_count_chk);
 
     if(mc != CURLM_OUT_OF_MEMORY) {
-      fprintf(stderr, "curl_multi_waitfds() return code %d instead of "
-        "CURLM_OUT_OF_MEMORY.\n", mc);
+      curl_mfprintf(stderr, "curl_multi_waitfds() return code %d instead of "
+                    "CURLM_OUT_OF_MEMORY.\n", mc);
       res = TEST_ERR_FAILURE;
       break;
     }
 
     if(fd_count_chk < fd_count) {
-      fprintf(stderr, "curl_multi_waitfds() sould return the amount of fds "
-        "needed if enough isn't passed in.\n");
+      curl_mfprintf(stderr,
+                    "curl_multi_waitfds() sould return the amount of fds "
+                    "needed if enough isn't passed in.\n");
       res = TEST_ERR_FAILURE;
       break;
     }
@@ -245,8 +247,8 @@ static CURLcode test_run(char *URL, long option, unsigned int *max_fd_count)
     mc = curl_multi_waitfds(multi, ufds, 0, NULL);
 
     if(mc != CURLM_OUT_OF_MEMORY) {
-      fprintf(stderr, "curl_multi_waitfds() return code %d instead of "
-        "CURLM_OUT_OF_MEMORY.\n", mc);
+      curl_mfprintf(stderr, "curl_multi_waitfds() return code %d instead of "
+                    "CURLM_OUT_OF_MEMORY.\n", mc);
       res = TEST_ERR_FAILURE;
       break;
     }
@@ -254,15 +256,16 @@ static CURLcode test_run(char *URL, long option, unsigned int *max_fd_count)
     mc = curl_multi_waitfds(multi, ufds, 0, &fd_count_chk);
 
     if(mc != CURLM_OUT_OF_MEMORY) {
-      fprintf(stderr, "curl_multi_waitfds() return code %d instead of "
-        "CURLM_OUT_OF_MEMORY.\n", mc);
+      curl_mfprintf(stderr, "curl_multi_waitfds() return code %d instead of "
+                    "CURLM_OUT_OF_MEMORY.\n", mc);
       res = TEST_ERR_FAILURE;
       break;
     }
 
     if(fd_count_chk < fd_count) {
-      fprintf(stderr, "curl_multi_waitfds() sould return the amount of fds "
-        "needed if enough isn't passed in.\n");
+      curl_mfprintf(stderr,
+                    "curl_multi_waitfds() sould return the amount of fds "
+                    "needed if enough isn't passed in.\n");
       res = TEST_ERR_FAILURE;
       break;
     }
@@ -274,7 +277,7 @@ static CURLcode test_run(char *URL, long option, unsigned int *max_fd_count)
     mc = curl_multi_poll(multi1, ufds, fd_count, 500, &numfds);
 
     if(mc != CURLM_OK) {
-      fprintf(stderr, "curl_multi_poll() failed, code %d.\\n", mc);
+      curl_mfprintf(stderr, "curl_multi_poll() failed, code %d.\\n", mc);
       res = TEST_ERR_FAILURE;
       break;
     }
@@ -325,13 +328,13 @@ static CURLcode empty_multi_test(void)
   mc = curl_multi_waitfds(multi, ufds, 10, &fd_count);
 
   if(mc != CURLM_OK) {
-    fprintf(stderr, "curl_multi_waitfds() failed, code %d.\n", mc);
+    curl_mfprintf(stderr, "curl_multi_waitfds() failed, code %d.\n", mc);
     res = TEST_ERR_FAILURE;
     goto test_cleanup;
   }
   else if(fd_count > 0) {
-    fprintf(stderr, "curl_multi_waitfds() returned non-zero count of "
-        "waitfds: %d.\n", fd_count);
+    curl_mfprintf(stderr, "curl_multi_waitfds() returned non-zero count of "
+                  "waitfds: %d.\n", fd_count);
     res = TEST_ERR_FAILURE;
     goto test_cleanup;
   }
@@ -348,13 +351,13 @@ static CURLcode empty_multi_test(void)
   mc = curl_multi_waitfds(multi, ufds, 10, &fd_count);
 
   if(mc != CURLM_OK) {
-    fprintf(stderr, "curl_multi_waitfds() failed, code %d.\n", mc);
+    curl_mfprintf(stderr, "curl_multi_waitfds() failed, code %d.\n", mc);
     res = TEST_ERR_FAILURE;
     goto test_cleanup;
   }
   else if(fd_count > 0) {
-    fprintf(stderr, "curl_multi_waitfds() returned non-zero count of "
-        "waitfds: %d.\n", fd_count);
+    curl_mfprintf(stderr, "curl_multi_waitfds() returned non-zero count of "
+                  "waitfds: %d.\n", fd_count);
     res = TEST_ERR_FAILURE;
     goto test_cleanup;
   }
index 340d0bf5507da88b0127177fb6f62db3b25d24e7..8979d19b0523a506b9405b595fc14e8413608826 100644 (file)
@@ -47,12 +47,12 @@ CURLcode test(char *URL)
 
   (void)URL;
 
-  msnprintf(dnsentry, sizeof(dnsentry), "localhost:%s:%s",
-            port, address);
-  printf("%s\n", dnsentry);
+  curl_msnprintf(dnsentry, sizeof(dnsentry), "localhost:%s:%s",
+                 port, address);
+  curl_mprintf("%s\n", dnsentry);
   slist = curl_slist_append(slist, dnsentry);
   if(!slist) {
-    fprintf(stderr, "curl_slist_append() failed\n");
+    curl_mfprintf(stderr, "curl_slist_append() failed\n");
     goto test_cleanup;
   }
 
@@ -69,9 +69,9 @@ CURLcode test(char *URL)
     /* get an easy handle */
     easy_init(curl[i]);
     /* specify target */
-    msnprintf(target_url, sizeof(target_url),
-              "https://localhost:%s/path/2502%04i",
-              port, i + 1);
+    curl_msnprintf(target_url, sizeof(target_url),
+                   "https://localhost:%s/path/2502%04i",
+                   port, i + 1);
     target_url[sizeof(target_url) - 1] = '\0';
     easy_setopt(curl[i], CURLOPT_URL, target_url);
     /* go http2 */
@@ -92,7 +92,7 @@ CURLcode test(char *URL)
     easy_setopt(curl[i], CURLOPT_RESOLVE, slist);
   }
 
-  fprintf(stderr, "Start at URL 0\n");
+  curl_mfprintf(stderr, "Start at URL 0\n");
 
   for(i = 0; i < NUM_HANDLES; i++) {
     /* add handle to multi */
index ce0fa30505eef86c90e3a5bd76c501b4073faba2..dbeb3223d196b055e7c8c767bc13249e273f343b 100644 (file)
@@ -39,24 +39,26 @@ CURLcode test(char *URL)
     curl_easy_setopt(curl, CURLOPT_URL, URL);
     ret = curl_easy_perform(curl);
     if(ret) {
-      fprintf(stderr, "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-          __FILE__, __LINE__, ret, curl_easy_strerror(ret));
+      curl_mfprintf(stderr,
+                    "%s:%d curl_easy_perform() failed with code %d (%s)\n",
+                    __FILE__, __LINE__, ret, curl_easy_strerror(ret));
       goto test_cleanup;
     }
     curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &follow_url);
     curl_easy_getinfo(curl, CURLINFO_RETRY_AFTER, &retry_after);
-    printf("Retry-After %" CURL_FORMAT_CURL_OFF_T "\n", retry_after);
+    curl_mprintf("Retry-After %" CURL_FORMAT_CURL_OFF_T "\n", retry_after);
     curl_easy_setopt(curl, CURLOPT_URL, follow_url);
     ret = curl_easy_perform(curl);
     if(ret) {
-      fprintf(stderr, "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-          __FILE__, __LINE__, ret, curl_easy_strerror(ret));
+      curl_mfprintf(stderr,
+                    "%s:%d curl_easy_perform() failed with code %d (%s)\n",
+                    __FILE__, __LINE__, ret, curl_easy_strerror(ret));
       goto test_cleanup;
     }
 
     curl_easy_reset(curl);
     curl_easy_getinfo(curl, CURLINFO_RETRY_AFTER, &retry_after);
-    printf("Retry-After %" CURL_FORMAT_CURL_OFF_T "\n", retry_after);
+    curl_mprintf("Retry-After %" CURL_FORMAT_CURL_OFF_T "\n", retry_after);
   }
 
 test_cleanup:
index 80f80eae01e64bfab8af21ea5691eb22b207d304..41929500bca95a90506377c2e98c3fb5648a0dee 100644 (file)
@@ -32,13 +32,13 @@ CURLcode test(char *URL)
   struct curl_slist *icy = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 287adde8a023fa948f225c825fc07e9bb3f93c43..93bc512261a0e9bc31d7928d0631d5a04a402734 100644 (file)
@@ -61,9 +61,9 @@ CURLcode test(char *URL)
 
   ver = curl_version_info(CURLVERSION_NOW);
   if((ver->features & CURL_VERSION_THREADSAFE) == 0) {
-    fprintf(stderr, "%s:%d On Windows but the "
-            "CURL_VERSION_THREADSAFE feature flag is not set\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d On Windows but the "
+                  "CURL_VERSION_THREADSAFE feature flag is not set\n",
+                  __FILE__, __LINE__);
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -84,8 +84,8 @@ CURLcode test(char *URL)
     th = _beginthreadex(NULL, 0, run_thread, &results[i], 0, NULL);
 #endif
     if(!th) {
-      fprintf(stderr, "%s:%d Couldn't create thread, errno %lu\n",
-              __FILE__, __LINE__, GetLastError());
+      curl_mfprintf(stderr, "%s:%d Couldn't create thread, errno %lu\n",
+                    __FILE__, __LINE__, GetLastError());
       tid_count = i;
       test_failure = TEST_ERR_MAJOR_BAD;
       goto cleanup;
@@ -98,9 +98,9 @@ cleanup:
     WaitForSingleObject((HANDLE)ths[i], INFINITE);
     CloseHandle((HANDLE)ths[i]);
     if(results[i] != CURLE_OK) {
-      fprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
-              "with code %d (%s)\n", __FILE__, __LINE__,
-              i, (int) results[i], curl_easy_strerror(results[i]));
+      curl_mfprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
+                    "with code %d (%s)\n", __FILE__, __LINE__,
+                    i, (int) results[i], curl_easy_strerror(results[i]));
       test_failure = TEST_ERR_MAJOR_BAD;
     }
   }
@@ -134,9 +134,9 @@ CURLcode test(char *URL)
 
   ver = curl_version_info(CURLVERSION_NOW);
   if((ver->features & CURL_VERSION_THREADSAFE) == 0) {
-    fprintf(stderr, "%s:%d Have pthread but the "
-            "CURL_VERSION_THREADSAFE feature flag is not set\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d Have pthread but the "
+                  "CURL_VERSION_THREADSAFE feature flag is not set\n",
+                  __FILE__, __LINE__);
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -145,8 +145,8 @@ CURLcode test(char *URL)
     results[i] = CURL_LAST; /* initialize with invalid value */
     res = pthread_create(&tids[i], NULL, run_thread, &results[i]);
     if(res) {
-      fprintf(stderr, "%s:%d Couldn't create thread, errno %d\n",
-              __FILE__, __LINE__, res);
+      curl_mfprintf(stderr, "%s:%d Couldn't create thread, errno %d\n",
+                    __FILE__, __LINE__, res);
       tid_count = i;
       test_failure = TEST_ERR_MAJOR_BAD;
       goto cleanup;
@@ -157,9 +157,9 @@ cleanup:
   for(i = 0; i < tid_count; i++) {
     pthread_join(tids[i], NULL);
     if(results[i] != CURLE_OK) {
-      fprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
-              "with code %d (%s)\n", __FILE__, __LINE__,
-              i, (int) results[i], curl_easy_strerror(results[i]));
+      curl_mfprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
+                    "with code %d (%s)\n", __FILE__, __LINE__,
+                    i, (int) results[i], curl_easy_strerror(results[i]));
       test_failure = TEST_ERR_MAJOR_BAD;
     }
   }
@@ -175,9 +175,9 @@ CURLcode test(char *URL)
 
   ver = curl_version_info(CURLVERSION_NOW);
   if((ver->features & CURL_VERSION_THREADSAFE) != 0) {
-    fprintf(stderr, "%s:%d No pthread but the "
-            "CURL_VERSION_THREADSAFE feature flag is set\n",
-            __FILE__, __LINE__);
+    curl_mfprintf(stderr, "%s:%d No pthread but the "
+                  "CURL_VERSION_THREADSAFE feature flag is set\n",
+                  __FILE__, __LINE__);
     return TEST_ERR_MAJOR_BAD;
   }
   return CURLE_OK;
index 82132b9476d4d04e12087024f5d630e78f475b84..7a1037b6e385e8bfc9fd7c473b40ff9ce00dcfce 100644 (file)
@@ -30,13 +30,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -55,7 +55,7 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res != CURLE_OK) {
-    fprintf(stderr, "Failed to send DESCRIBE: %d\n", res);
+    curl_mfprintf(stderr, "Failed to send DESCRIBE: %d\n", res);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
index 3f2e97711aa022d33401826d9f3b9a78f43d829b..13e977313de70cdee1720a165cc184b690a3db2a 100644 (file)
@@ -30,13 +30,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 7f1b0562720f1b335c2e9173a310cfd750ac2bdb..df95bcd6ee263453c2c3a4b28a567567098c7636 100644 (file)
@@ -58,17 +58,18 @@ static bool is_chain_in_order(struct curl_certinfo *cert_info)
     }
 
     if(subject && issuer) {
-      printf("cert %d\n", cert);
-      printf("  subject: %s\n", subject);
-      printf("  issuer: %s\n", issuer);
+      curl_mprintf("cert %d\n", cert);
+      curl_mprintf("  subject: %s\n", subject);
+      curl_mprintf("  issuer: %s\n", issuer);
 
       if(last_issuer) {
         /* If the last certificate's issuer matches the current certificate's
          * subject, then the chain is in order */
         if(strcmp(last_issuer, subject) != 0) {
-          fprintf(stderr, "cert %d issuer does not match cert %d subject\n",
-                  cert - 1, cert);
-          fprintf(stderr, "certificate chain is not in order\n");
+          curl_mfprintf(stderr,
+                        "cert %d issuer does not match cert %d subject\n",
+                        cert - 1, cert);
+          curl_mfprintf(stderr, "certificate chain is not in order\n");
           return false;
         }
       }
@@ -77,7 +78,7 @@ static bool is_chain_in_order(struct curl_certinfo *cert_info)
     last_issuer = issuer;
   }
 
-  printf("certificate chain is in order\n");
+  curl_mprintf("certificate chain is in order\n");
   return true;
 }
 
@@ -94,13 +95,13 @@ CURLcode test(char *URL)
   CURLcode res = CURLE_OK;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 8d602849935c0b9404b0a601489faddc0180491d..cad9de7ae38351cb656c740959e001344959a958 100644 (file)
@@ -51,8 +51,8 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "curl_easy_perform() failed: %s\n",
-            curl_easy_strerror(res));
+    curl_mfprintf(stderr, "curl_easy_perform() failed: %s\n",
+                  curl_easy_strerror(res));
   }
 
 test_cleanup:
index 7e0e1d80dc7a422a2fc24dc17ee6643e649ef1d7..da92be5d47af96ab46f9f13fa3454163bad4a40d 100644 (file)
@@ -51,8 +51,8 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "curl_easy_perform() failed: %s\n",
-            curl_easy_strerror(res));
+    curl_mfprintf(stderr, "curl_easy_perform() failed: %s\n",
+                  curl_easy_strerror(res));
   }
 
 test_cleanup:
index 179db36eec69b5b274fc4bd274608a5b2aba4b1a..c41a59a1b6abd0e21e382ddcb5e093578413017d 100644 (file)
@@ -51,7 +51,7 @@ CURLcode test(char *URL)
   mc += curl_multi_remove_handle(multi, curls);
 
   if(mc) {
-    fprintf(stderr, "%d was unexpected\n", (int)mc);
+    curl_mfprintf(stderr, "%d was unexpected\n", (int)mc);
     i = CURLE_FAILED_INIT;
   }
 
index 882b778829f334541578e6e88a6b223af23edb31..5baec357d1f15017567e0f879dc7b00af3363ac7 100644 (file)
@@ -55,7 +55,7 @@ static size_t write_memory_callback(char *contents, size_t size,
   char *data = (char *)malloc(realsize + 1);
   struct curl_slist *item_append = NULL;
   if(!data) {
-    printf("not enough memory (malloc returned NULL)\n");
+    curl_mprintf("not enough memory (malloc returned NULL)\n");
     return 0;
   }
   memcpy(data, contents, realsize);
@@ -66,7 +66,7 @@ static size_t write_memory_callback(char *contents, size_t size,
     mem->contents = item_append;
   }
   else {
-    printf("not enough memory (curl_slist_append returned NULL)\n");
+    curl_mprintf("not enough memory (curl_slist_append returned NULL)\n");
     return 0;
   }
   return realsize;
@@ -112,8 +112,8 @@ test_thread(void *ptr)
       curl_easy_cleanup(curl);
       /* Check for errors */
       if(res != CURLE_OK) {
-        fprintf(stderr, "curl_easy_perform() failed: %s\n",
-                curl_easy_strerror(res));
+        curl_mfprintf(stderr, "curl_easy_perform() failed: %s\n",
+                      curl_easy_strerror(res));
         goto test_cleanup;
       }
     }
@@ -195,7 +195,7 @@ CURLcode test(char *URL)
 
   share = curl_share_init();
   if(!share) {
-    fprintf(stderr, "curl_share_init() failed\n");
+    curl_mfprintf(stderr, "curl_share_init() failed\n");
     goto test_cleanup;
   }
 
@@ -216,7 +216,7 @@ CURLcode test(char *URL)
     else {
       struct curl_slist *item = ctx[i].contents;
       while(item) {
-        printf("%s", item->data);
+        curl_mprintf("%s", item->data);
         item = item->next;
       }
     }
index d54e7c983516cba39f885270f0f09a7f672d1797..ce3a4cbe9cf2c126de141e3d7ea4cfdc8dd99196 100644 (file)
@@ -68,7 +68,7 @@ CURLcode test(char *URL)
     int num;
     mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
     if(mres != CURLM_OK) {
-      printf("curl_multi_wait() returned %d\n", mres);
+      curl_mprintf("curl_multi_wait() returned %d\n", mres);
       res = TEST_ERR_MAJOR_BAD;
       goto test_cleanup;
     }
index 9aa3466698fa4cd8544970832d1879bad91fe3a5..1a9222edc82b8b07999cb61bb95dacb672072997 100644 (file)
@@ -36,14 +36,14 @@ static curl_socket_t tst_opensocket(void *clientp,
 {
   (void)clientp;
   (void)purpose;
-  printf("[OPEN] counter: %d\n", ++testcounter);
+  curl_mprintf("[OPEN] counter: %d\n", ++testcounter);
   return socket(addr->family, addr->socktype, addr->protocol);
 }
 
 static int tst_closesocket(void *clientp, curl_socket_t sock)
 {
   (void)clientp;
-  printf("[CLOSE] counter: %d\n", testcounter--);
+  curl_mprintf("[CLOSE] counter: %d\n", testcounter--);
   return sclose(sock);
 }
 
@@ -66,13 +66,13 @@ CURLcode test(char *URL)
   char *ipstr = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -104,7 +104,7 @@ CURLcode test(char *URL)
         curl_off_t time_posttransfer;
         curl_off_t time_starttransfer;
         curl_off_t time_total;
-        fprintf(moo, "IP %s\n", ipstr);
+        curl_mfprintf(moo, "IP %s\n", ipstr);
         curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &time_namelookup);
         curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &time_connect);
         curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T,
@@ -118,48 +118,55 @@ CURLcode test(char *URL)
         /* since the timing will always vary we only compare relative
            differences between these 5 times */
         if(time_namelookup > time_connect) {
-          fprintf(moo, "namelookup vs connect: %" CURL_FORMAT_CURL_OFF_T
-                  ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
-                  (time_namelookup / 1000000),
-                  (long)(time_namelookup % 1000000),
-                  (time_connect / 1000000), (long)(time_connect % 1000000));
+          curl_mfprintf(moo, "namelookup vs connect: %" CURL_FORMAT_CURL_OFF_T
+                        ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+                        (time_namelookup / 1000000),
+                        (long)(time_namelookup % 1000000),
+                        (time_connect / 1000000),
+                        (long)(time_connect % 1000000));
         }
         if(time_connect > time_pretransfer) {
-          fprintf(moo, "connect vs pretransfer: %" CURL_FORMAT_CURL_OFF_T
-                  ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
-                  (time_connect / 1000000), (long)(time_connect % 1000000),
-                  (time_pretransfer / 1000000),
-                  (long)(time_pretransfer % 1000000));
+          curl_mfprintf(moo, "connect vs pretransfer: %"
+                        CURL_FORMAT_CURL_OFF_T
+                        ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+                        (time_connect / 1000000),
+                        (long)(time_connect % 1000000),
+                        (time_pretransfer / 1000000),
+                        (long)(time_pretransfer % 1000000));
         }
         if(time_pretransfer > time_posttransfer) {
-          fprintf(moo, "pretransfer vs posttransfer: %" CURL_FORMAT_CURL_OFF_T
-                  ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
-                  (time_pretransfer / 1000000),
-                  (long)(time_pretransfer % 1000000),
-                  (time_posttransfer / 1000000),
-                  (long)(time_posttransfer % 1000000));
+          curl_mfprintf(moo, "pretransfer vs posttransfer: %"
+                        CURL_FORMAT_CURL_OFF_T
+                        ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+                        (time_pretransfer / 1000000),
+                        (long)(time_pretransfer % 1000000),
+                        (time_posttransfer / 1000000),
+                        (long)(time_posttransfer % 1000000));
         }
         if(time_pretransfer > time_starttransfer) {
-          fprintf(moo, "pretransfer vs starttransfer: %" CURL_FORMAT_CURL_OFF_T
-                  ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
-                  (time_pretransfer / 1000000),
-                  (long)(time_pretransfer % 1000000),
-                  (time_starttransfer / 1000000),
-                  (long)(time_starttransfer % 1000000));
+          curl_mfprintf(moo, "pretransfer vs starttransfer: %"
+                        CURL_FORMAT_CURL_OFF_T
+                        ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+                        (time_pretransfer / 1000000),
+                        (long)(time_pretransfer % 1000000),
+                        (time_starttransfer / 1000000),
+                        (long)(time_starttransfer % 1000000));
         }
         if(time_starttransfer > time_total) {
-          fprintf(moo, "starttransfer vs total: %" CURL_FORMAT_CURL_OFF_T
-                  ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
-                  (time_starttransfer / 1000000),
-                  (long)(time_starttransfer % 1000000),
-                  (time_total / 1000000), (long)(time_total % 1000000));
+          curl_mfprintf(moo, "starttransfer vs total: %" CURL_FORMAT_CURL_OFF_T
+                        ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+                        (time_starttransfer / 1000000),
+                        (long)(time_starttransfer % 1000000),
+                        (time_total / 1000000),
+                        (long)(time_total % 1000000));
         }
         if(time_posttransfer > time_total) {
-          fprintf(moo, "posttransfer vs total: %" CURL_FORMAT_CURL_OFF_T
-                  ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
-                  (time_posttransfer / 1000000),
-                  (long)(time_posttransfer % 1000000),
-                  (time_total / 1000000), (long)(time_total % 1000000));
+          curl_mfprintf(moo, "posttransfer vs total: %" CURL_FORMAT_CURL_OFF_T
+                        ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+                        (time_posttransfer / 1000000),
+                        (long)(time_posttransfer % 1000000),
+                        (time_total / 1000000),
+                        (long)(time_total % 1000000));
         }
 
         fclose(moo);
index 94c9adb482c91ddcabc1efd491e03a952aba1480..c1aecdc56c199f4e9cc3d9c9d10e53629b30b9eb 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   (void)URL; /* we don't use this */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index a9f96c8ddeab32eaace6bb8399c92bbf636903d6..93d38a0b24611f7959d9684204df826565a6855a 100644 (file)
@@ -68,7 +68,7 @@ CURLcode test(char *URL)
     interval.tv_sec = 1;
     interval.tv_usec = 0;
 
-    fprintf(stderr, "curl_multi_perform()\n");
+    curl_mfprintf(stderr, "curl_multi_perform()\n");
 
     multi_perform(m, &running);
 
@@ -77,7 +77,7 @@ CURLcode test(char *URL)
       int num;
       mres = curl_multi_wait(m, NULL, 0, TEST_HANG_TIMEOUT, &num);
       if(mres != CURLM_OK) {
-        printf("curl_multi_wait() returned %d\n", mres);
+        curl_mprintf("curl_multi_wait() returned %d\n", mres);
         res = TEST_ERR_MAJOR_BAD;
         goto test_cleanup;
       }
@@ -93,20 +93,20 @@ CURLcode test(char *URL)
       /* This is where this code is expected to reach */
       int numleft;
       CURLMsg *msg = curl_multi_info_read(m, &numleft);
-      fprintf(stderr, "Expected: not running\n");
+      curl_mfprintf(stderr, "Expected: not running\n");
       if(msg && !numleft)
         res = TEST_ERR_SUCCESS; /* this is where we should be */
       else
         res = TEST_ERR_FAILURE; /* not correct */
       break; /* done */
     }
-    fprintf(stderr, "running == %d\n", running);
+    curl_mfprintf(stderr, "running == %d\n", running);
 
     FD_ZERO(&rd);
     FD_ZERO(&wr);
     FD_ZERO(&exc);
 
-    fprintf(stderr, "curl_multi_fdset()\n");
+    curl_mfprintf(stderr, "curl_multi_fdset()\n");
 
     multi_fdset(m, &rd, &wr, &exc, &maxfd);
 
index 8755c95780d8c7e6e64206e14978b63acd81a796..5c3799a230eec6575362eec4023a7118aed26aca 100644 (file)
@@ -50,15 +50,15 @@ CURLcode test(char *URL)
   const char *buf_2 = "RNTO 505-forreal";
 
   if(!libtest_arg2) {
-    fprintf(stderr, "Usage: <url> <file-to-upload>\n");
+    curl_mfprintf(stderr, "Usage: <url> <file-to-upload>\n");
     return TEST_ERR_USAGE;
   }
 
   hd_src = fopen(libtest_arg2, "rb");
   if(!hd_src) {
-    fprintf(stderr, "fopen failed with error (%d) %s\n",
-            errno, strerror(errno));
-    fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
+    curl_mfprintf(stderr, "fopen failed with error (%d) %s\n",
+                  errno, strerror(errno));
+    curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
     return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */
   }
 
@@ -70,21 +70,21 @@ CURLcode test(char *URL)
 #endif
   if(hd == -1) {
     /* can't open file, bail out */
-    fprintf(stderr, "fstat() failed with error (%d) %s\n",
-            errno, strerror(errno));
-    fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
+    curl_mfprintf(stderr, "fstat() failed with error (%d) %s\n",
+                  errno, strerror(errno));
+    curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
     fclose(hd_src);
     return TEST_ERR_MAJOR_BAD;
   }
 
   if(!file_info.st_size) {
-    fprintf(stderr, "File %s has zero size!\n", libtest_arg2);
+    curl_mfprintf(stderr, "File %s has zero size!\n", libtest_arg2);
     fclose(hd_src);
     return TEST_ERR_MAJOR_BAD;
   }
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     fclose(hd_src);
     return TEST_ERR_MAJOR_BAD;
   }
@@ -92,7 +92,7 @@ CURLcode test(char *URL)
   /* get a curl handle */
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     fclose(hd_src);
     return TEST_ERR_MAJOR_BAD;
@@ -102,7 +102,7 @@ CURLcode test(char *URL)
 
   hl = curl_slist_append(headerlist, buf_1);
   if(!hl) {
-    fprintf(stderr, "curl_slist_append() failed\n");
+    curl_mfprintf(stderr, "curl_slist_append() failed\n");
     curl_easy_cleanup(curl);
     curl_global_cleanup();
     fclose(hd_src);
@@ -110,7 +110,7 @@ CURLcode test(char *URL)
   }
   headerlist = curl_slist_append(hl, buf_2);
   if(!headerlist) {
-    fprintf(stderr, "curl_slist_append() failed\n");
+    curl_mfprintf(stderr, "curl_slist_append() failed\n");
     curl_slist_free_all(hl);
     curl_easy_cleanup(curl);
     curl_global_cleanup();
index 57b7f67fd0625aeec72b393867e187b36c7aed4e..8680c6ec6d8ece7fe784b8d9f9839f3ec974e889 100644 (file)
@@ -66,18 +66,18 @@ static void test_lock(CURL *handle, curl_lock_data data,
       locknum = 2;
       break;
     default:
-      fprintf(stderr, "lock: no such data: %d\n", (int)data);
+      curl_mfprintf(stderr, "lock: no such data: %d\n", (int)data);
       return;
   }
 
   /* detect locking of locked locks */
   if(locks[locknum]) {
-    printf("lock: double locked %s\n", what);
+    curl_mprintf("lock: double locked %s\n", what);
     return;
   }
   locks[locknum]++;
 
-  printf("lock:   %-6s [%s]: %d\n", what, user->text, user->counter);
+  curl_mprintf("lock:   %-6s [%s]: %d\n", what, user->text, user->counter);
   user->counter++;
 }
 
@@ -102,18 +102,18 @@ static void test_unlock(CURL *handle, curl_lock_data data, void *useptr)
       locknum = 2;
       break;
     default:
-      fprintf(stderr, "unlock: no such data: %d\n", (int)data);
+      curl_mfprintf(stderr, "unlock: no such data: %d\n", (int)data);
       return;
   }
 
   /* detect unlocking of unlocked locks */
   if(!locks[locknum]) {
-    printf("unlock: double unlocked %s\n", what);
+    curl_mprintf("unlock: double unlocked %s\n", what);
     return;
   }
   locks[locknum]--;
 
-  printf("unlock: %-6s [%s]: %d\n", what, user->text, user->counter);
+  curl_mprintf("unlock: %-6s [%s]: %d\n", what, user->text, user->counter);
   user->counter++;
 }
 
@@ -136,7 +136,7 @@ static void *test_fire(void *ptr)
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     return NULL;
   }
 
@@ -145,18 +145,18 @@ static void *test_fire(void *ptr)
   curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
   curl_easy_setopt(curl, CURLOPT_URL,        tdata->url);
   curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
-  printf("CURLOPT_SHARE\n");
+  curl_mprintf("CURLOPT_SHARE\n");
   curl_easy_setopt(curl, CURLOPT_SHARE, tdata->share);
 
-  printf("PERFORM\n");
+  curl_mprintf("PERFORM\n");
   code = curl_easy_perform(curl);
   if(code) {
     int i = 0;
-    fprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n",
+    curl_mfprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n",
             tdata->url, i, (int)code);
   }
 
-  printf("CLEANUP\n");
+  curl_mprintf("CLEANUP\n");
   curl_easy_cleanup(curl);
   curl_slist_free_all(headers);
 
@@ -190,44 +190,44 @@ CURLcode test(char *URL)
   user.text = "Pigs in space";
   user.counter = 0;
 
-  printf("GLOBAL_INIT\n");
+  curl_mprintf("GLOBAL_INIT\n");
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   /* prepare share */
-  printf("SHARE_INIT\n");
+  curl_mprintf("SHARE_INIT\n");
   share = curl_share_init();
   if(!share) {
-    fprintf(stderr, "curl_share_init() failed\n");
+    curl_mfprintf(stderr, "curl_share_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
   if(CURLSHE_OK == scode) {
-    printf("CURLSHOPT_LOCKFUNC\n");
+    curl_mprintf("CURLSHOPT_LOCKFUNC\n");
     scode = curl_share_setopt(share, CURLSHOPT_LOCKFUNC, test_lock);
   }
   if(CURLSHE_OK == scode) {
-    printf("CURLSHOPT_UNLOCKFUNC\n");
+    curl_mprintf("CURLSHOPT_UNLOCKFUNC\n");
     scode = curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, test_unlock);
   }
   if(CURLSHE_OK == scode) {
-    printf("CURLSHOPT_USERDATA\n");
+    curl_mprintf("CURLSHOPT_USERDATA\n");
     scode = curl_share_setopt(share, CURLSHOPT_USERDATA, &user);
   }
   if(CURLSHE_OK == scode) {
-    printf("CURL_LOCK_DATA_COOKIE\n");
+    curl_mprintf("CURL_LOCK_DATA_COOKIE\n");
     scode = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
   }
   if(CURLSHE_OK == scode) {
-    printf("CURL_LOCK_DATA_DNS\n");
+    curl_mprintf("CURL_LOCK_DATA_DNS\n");
     scode = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
   }
 
   if(CURLSHE_OK != scode) {
-    fprintf(stderr, "curl_share_setopt() failed\n");
+    curl_mfprintf(stderr, "curl_share_setopt() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -236,28 +236,28 @@ CURLcode test(char *URL)
   /* initial cookie manipulation */
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
-  printf("CURLOPT_SHARE\n");
+  curl_mprintf("CURLOPT_SHARE\n");
   test_setopt(curl, CURLOPT_SHARE,      share);
-  printf("CURLOPT_COOKIELIST injected_and_clobbered\n");
+  curl_mprintf("CURLOPT_COOKIELIST injected_and_clobbered\n");
   test_setopt(curl, CURLOPT_COOKIELIST,
                "Set-Cookie: injected_and_clobbered=yes; "
                "domain=host.foo.com; expires=Sat Feb 2 11:56:27 GMT 2030");
-  printf("CURLOPT_COOKIELIST ALL\n");
+  curl_mprintf("CURLOPT_COOKIELIST ALL\n");
   test_setopt(curl, CURLOPT_COOKIELIST, "ALL");
-  printf("CURLOPT_COOKIELIST session\n");
+  curl_mprintf("CURLOPT_COOKIELIST session\n");
   test_setopt(curl, CURLOPT_COOKIELIST, "Set-Cookie: session=elephants");
-  printf("CURLOPT_COOKIELIST injected\n");
+  curl_mprintf("CURLOPT_COOKIELIST injected\n");
   test_setopt(curl, CURLOPT_COOKIELIST,
                "Set-Cookie: injected=yes; domain=host.foo.com; "
                "expires=Sat Feb 2 11:56:27 GMT 2030");
-  printf("CURLOPT_COOKIELIST SESS\n");
+  curl_mprintf("CURLOPT_COOKIELIST SESS\n");
   test_setopt(curl, CURLOPT_COOKIELIST, "SESS");
-  printf("CLEANUP\n");
+  curl_mprintf("CLEANUP\n");
   curl_easy_cleanup(curl);
 
 
@@ -269,7 +269,7 @@ CURLcode test(char *URL)
     tdata.share = share;
 
     /* simulate thread, direct call of "thread" function */
-    printf("*** run %d\n",i);
+    curl_mprintf("*** run %d\n",i);
     test_fire(&tdata);
 
     curl_free(tdata.url);
@@ -277,10 +277,10 @@ CURLcode test(char *URL)
 
 
   /* fetch another one and save cookies */
-  printf("*** run %d\n", i);
+  curl_mprintf("*** run %d\n", i);
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -290,17 +290,17 @@ CURLcode test(char *URL)
   headers = sethost(NULL);
   test_setopt(curl, CURLOPT_HTTPHEADER, headers);
   test_setopt(curl, CURLOPT_URL,        url);
-  printf("CURLOPT_SHARE\n");
+  curl_mprintf("CURLOPT_SHARE\n");
   test_setopt(curl, CURLOPT_SHARE,      share);
-  printf("CURLOPT_COOKIEJAR\n");
+  curl_mprintf("CURLOPT_COOKIEJAR\n");
   test_setopt(curl, CURLOPT_COOKIEJAR,  JAR);
-  printf("CURLOPT_COOKIELIST FLUSH\n");
+  curl_mprintf("CURLOPT_COOKIELIST FLUSH\n");
   test_setopt(curl, CURLOPT_COOKIELIST, "FLUSH");
 
-  printf("PERFORM\n");
+  curl_mprintf("PERFORM\n");
   curl_easy_perform(curl);
 
-  printf("CLEANUP\n");
+  curl_mprintf("CLEANUP\n");
   curl_easy_cleanup(curl);
   curl_free(url);
   curl_slist_free_all(headers);
@@ -308,7 +308,7 @@ CURLcode test(char *URL)
   /* load cookies */
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -317,65 +317,65 @@ CURLcode test(char *URL)
   headers = sethost(NULL);
   test_setopt(curl, CURLOPT_HTTPHEADER, headers);
   test_setopt(curl, CURLOPT_URL,        url);
-  printf("CURLOPT_SHARE\n");
+  curl_mprintf("CURLOPT_SHARE\n");
   test_setopt(curl, CURLOPT_SHARE,      share);
-  printf("CURLOPT_COOKIELIST ALL\n");
+  curl_mprintf("CURLOPT_COOKIELIST ALL\n");
   test_setopt(curl, CURLOPT_COOKIELIST, "ALL");
-  printf("CURLOPT_COOKIEJAR\n");
+  curl_mprintf("CURLOPT_COOKIEJAR\n");
   test_setopt(curl, CURLOPT_COOKIEFILE, JAR);
-  printf("CURLOPT_COOKIELIST RELOAD\n");
+  curl_mprintf("CURLOPT_COOKIELIST RELOAD\n");
   test_setopt(curl, CURLOPT_COOKIELIST, "RELOAD");
 
   res = CURLE_OK;
 
   code = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
   if(code != CURLE_OK) {
-    fprintf(stderr, "curl_easy_getinfo() failed\n");
+    curl_mfprintf(stderr, "curl_easy_getinfo() failed\n");
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
-  printf("loaded cookies:\n");
+  curl_mprintf("loaded cookies:\n");
   if(!cookies) {
-    fprintf(stderr, "  reloading cookies from '%s' failed\n", JAR);
+    curl_mfprintf(stderr, "  reloading cookies from '%s' failed\n", JAR);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
-  printf("-----------------\n");
+  curl_mprintf("-----------------\n");
   next_cookie = cookies;
   while(next_cookie) {
-    printf("  %s\n", next_cookie->data);
+    curl_mprintf("  %s\n", next_cookie->data);
     next_cookie = next_cookie->next;
   }
-  printf("-----------------\n");
+  curl_mprintf("-----------------\n");
   curl_slist_free_all(cookies);
 
   /* try to free share, expect to fail because share is in use */
-  printf("try SHARE_CLEANUP...\n");
+  curl_mprintf("try SHARE_CLEANUP...\n");
   scode = curl_share_cleanup(share);
   if(scode == CURLSHE_OK) {
-    fprintf(stderr, "curl_share_cleanup succeed but error expected\n");
+    curl_mfprintf(stderr, "curl_share_cleanup succeed but error expected\n");
     share = NULL;
   }
   else {
-    printf("SHARE_CLEANUP failed, correct\n");
+    curl_mprintf("SHARE_CLEANUP failed, correct\n");
   }
 
 test_cleanup:
 
   /* clean up last handle */
-  printf("CLEANUP\n");
+  curl_mprintf("CLEANUP\n");
   curl_easy_cleanup(curl);
   curl_slist_free_all(headers);
   curl_free(url);
 
   /* free share */
-  printf("SHARE_CLEANUP\n");
+  curl_mprintf("SHARE_CLEANUP\n");
   scode = curl_share_cleanup(share);
   if(scode != CURLSHE_OK)
-    fprintf(stderr, "curl_share_cleanup failed, code errno %d\n",
+    curl_mfprintf(stderr, "curl_share_cleanup failed, code errno %d\n",
             (int)scode);
 
-  printf("GLOBAL_CLEANUP\n");
+  curl_mprintf("GLOBAL_CLEANUP\n");
   curl_global_cleanup();
 
   return res;
index fc25a0df60f9db5132ec4872497f826c4046ff43..8480cd7d144da7490e199d1cffc59685bdc523ae 100644 (file)
@@ -60,13 +60,13 @@ CURLcode test(char *URL)
   pooh.sizeleft = strlen(testdata);
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 8a03b3b19d679858d48164cc956b1b8e7fb2baba..3b2a93207770deecda70ce0fb4b87c29860eb471 100644 (file)
@@ -86,13 +86,13 @@ CURLcode test(char *URL)
                              custom_strdup,
                              custom_calloc);
   if(res != CURLE_OK) {
-    fprintf(stderr, "curl_global_init_mem() failed\n");
+    curl_mfprintf(stderr, "curl_global_init_mem() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -103,7 +103,7 @@ CURLcode test(char *URL)
   str = curl_easy_escape(curl, (char *)a, asize); /* uses realloc() */
 
   if(seen)
-    printf("Callbacks were invoked!\n");
+    curl_mprintf("Callbacks were invoked!\n");
 
 test_cleanup:
 
index 2abd1cb7ed299778ff87b6ab8e1112b572f9e17e..0c7a7d14935e600608bc9d25bbf18ab952b8d4d2 100644 (file)
@@ -51,7 +51,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   if(data) {
     size_t len = strlen(data);
     if(size*nmemb < len) {
-      fprintf(stderr, "read buffer is too small to run test\n");
+      curl_mfprintf(stderr, "read buffer is too small to run test\n");
       return 0;
     }
     memcpy(ptr, data, len);
@@ -70,20 +70,20 @@ CURLcode test(char *URL)
   pooh.counter = 0;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
   slist = curl_slist_append(slist, "Transfer-Encoding: chunked");
   if(!slist) {
-    fprintf(stderr, "curl_slist_append() failed\n");
+    curl_mfprintf(stderr, "curl_slist_append() failed\n");
     curl_easy_cleanup(curl);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index b357e4d683a53c509f488a4f49a503ca8d953c17..baa704a746a48284b7b61ed9fa7d29b6d5e72f8c 100644 (file)
@@ -31,13 +31,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 208245acfa617218c1faab6b33b49e168f15fa83..af40e6ee09d69594f3880be11059b2910daae288 100644 (file)
@@ -40,13 +40,13 @@ CURLcode test(char *URL)
   CURLcode res = CURLE_OK;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 73877061315edc5f866cf3435ebbb5dc4a5959a1..b0dadf21af62de116bbb37bf6973eada43f04f42 100644 (file)
@@ -31,13 +31,13 @@ CURLcode test(char *URL)
   CURLcode res = CURLE_OK;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 7edfe4e5ed47cdf56359eb14ce4e6976f316050a..4aa7245ac925d713b9f1ff72f586fc2da6ca52f7 100644 (file)
@@ -31,13 +31,13 @@ CURLcode test(char *URL)
   CURLcode res = CURLE_OK;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index fc94eaabc0b81d48e9f6dae1571da9dd4b074fc5..d9954b9208a3e41a8e34681de04de53d16ad566a 100644 (file)
@@ -31,13 +31,13 @@ CURLcode test(char *URL)
   CURLcode res = CURLE_OK;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 000e86d36d330a5d2f5edbd64e3cf0d8521cf81c..503fc428a339369375bf44485aa173c9aa7e638b 100644 (file)
@@ -172,7 +172,7 @@ CURLcode test(char *URL)
   for(i = 0; dates[i].input; i++) {
     time_t out = curl_getdate(dates[i].input, NULL);
     if(out != dates[i].output) {
-      printf("WRONGLY %s => %ld (instead of %ld)\n",
+      curl_mprintf("WRONGLY %s => %ld (instead of %ld)\n",
              dates[i].input, (long)out, (long)dates[i].output);
       error++;
     }
index 0aed4336a973f6a2dc3b7b721cc6e77c820dc69a..f23a2454c2209c04893889f211b5d94d3dda61d0 100644 (file)
@@ -57,9 +57,9 @@ static char msgbuff[256];
 static void store_errmsg(const char *msg, int err)
 {
   if(!err)
-    msnprintf(msgbuff, sizeof(msgbuff), "%s", msg);
+    curl_msnprintf(msgbuff, sizeof(msgbuff), "%s", msg);
   else
-    msnprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg,
+    curl_msnprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg,
               err, strerror(err));
 }
 
@@ -87,7 +87,7 @@ static int fopen_works(void)
     fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
     if(!fpa[i]) {
       store_errmsg("fopen failed", errno);
-      fprintf(stderr, "%s\n", msgbuff);
+      curl_mfprintf(stderr, "%s\n", msgbuff);
       ret = 0;
       break;
     }
@@ -103,20 +103,20 @@ static void rlim2str(char *buf, size_t len, rlim_t val)
 {
 #ifdef RLIM_INFINITY
   if(val == RLIM_INFINITY) {
-    msnprintf(buf, len, "INFINITY");
+    curl_msnprintf(buf, len, "INFINITY");
     return;
   }
 #endif
 #ifdef HAVE_LONGLONG
   if(sizeof(rlim_t) > sizeof(long))
-    msnprintf(buf, len, "%llu", (unsigned long long)val);
+    curl_msnprintf(buf, len, "%llu", (unsigned long long)val);
   else
 #endif
   {
     if(sizeof(rlim_t) < sizeof(long))
-      msnprintf(buf, len, "%u", (unsigned int)val);
+      curl_msnprintf(buf, len, "%u", (unsigned int)val);
     else
-      msnprintf(buf, len, "%lu", (unsigned long)val);
+      curl_msnprintf(buf, len, "%lu", (unsigned long)val);
   }
 }
 
@@ -133,23 +133,23 @@ static int test_rlimit(int keep_open)
 
   if(getrlimit(RLIMIT_NOFILE, &rl) != 0) {
     store_errmsg("getrlimit() failed", errno);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     return -1;
   }
 
   /* show initial open file limits */
 
   rlim2str(strbuff, sizeof(strbuff), rl.rlim_cur);
-  fprintf(stderr, "initial soft limit: %s\n", strbuff);
+  curl_mfprintf(stderr, "initial soft limit: %s\n", strbuff);
 
   rlim2str(strbuff, sizeof(strbuff), rl.rlim_max);
-  fprintf(stderr, "initial hard limit: %s\n", strbuff);
+  curl_mfprintf(stderr, "initial hard limit: %s\n", strbuff);
 
   /* show our constants */
 
-  fprintf(stderr, "test518 FD_SETSIZE: %d\n", FD_SETSIZE);
-  fprintf(stderr, "test518 NUM_OPEN  : %d\n", NUM_OPEN);
-  fprintf(stderr, "test518 NUM_NEEDED: %d\n", NUM_NEEDED);
+  curl_mfprintf(stderr, "test518 FD_SETSIZE: %d\n", FD_SETSIZE);
+  curl_mfprintf(stderr, "test518 NUM_OPEN  : %d\n", NUM_OPEN);
+  curl_mfprintf(stderr, "test518 NUM_NEEDED: %d\n", NUM_NEEDED);
 
   /*
    * if soft limit and hard limit are different we ask the
@@ -165,23 +165,23 @@ static int test_rlimit(int keep_open)
 #ifdef OPEN_MAX
     if((rl.rlim_cur > 0) &&
        (rl.rlim_cur < OPEN_MAX)) {
-      fprintf(stderr, "raising soft limit up to OPEN_MAX\n");
+      curl_mfprintf(stderr, "raising soft limit up to OPEN_MAX\n");
       rl.rlim_cur = OPEN_MAX;
       if(setrlimit(RLIMIT_NOFILE, &rl) != 0) {
         /* on failure don't abort just issue a warning */
         store_errmsg("setrlimit() failed", errno);
-        fprintf(stderr, "%s\n", msgbuff);
+        curl_mfprintf(stderr, "%s\n", msgbuff);
         msgbuff[0] = '\0';
       }
     }
 #endif
 
-    fprintf(stderr, "raising soft limit up to hard limit\n");
+    curl_mfprintf(stderr, "raising soft limit up to hard limit\n");
     rl.rlim_cur = rl.rlim_max;
     if(setrlimit(RLIMIT_NOFILE, &rl) != 0) {
       /* on failure don't abort just issue a warning */
       store_errmsg("setrlimit() failed", errno);
-      fprintf(stderr, "%s\n", msgbuff);
+      curl_mfprintf(stderr, "%s\n", msgbuff);
       msgbuff[0] = '\0';
     }
 
@@ -189,17 +189,17 @@ static int test_rlimit(int keep_open)
 
     if(getrlimit(RLIMIT_NOFILE, &rl) != 0) {
       store_errmsg("getrlimit() failed", errno);
-      fprintf(stderr, "%s\n", msgbuff);
+      curl_mfprintf(stderr, "%s\n", msgbuff);
       return -3;
     }
 
     /* show current open file limits */
 
     rlim2str(strbuff, sizeof(strbuff), rl.rlim_cur);
-    fprintf(stderr, "current soft limit: %s\n", strbuff);
+    curl_mfprintf(stderr, "current soft limit: %s\n", strbuff);
 
     rlim2str(strbuff, sizeof(strbuff), rl.rlim_max);
-    fprintf(stderr, "current hard limit: %s\n", strbuff);
+    curl_mfprintf(stderr, "current hard limit: %s\n", strbuff);
 
   } /* (rl.rlim_cur != rl.rlim_max) */
 
@@ -227,10 +227,10 @@ static int test_rlimit(int keep_open)
      (rl.rlim_cur <= num_open.rlim_cur)) {
     rlim2str(strbuff2, sizeof(strbuff2), rl.rlim_cur);
     rlim2str(strbuff1, sizeof(strbuff1), num_open.rlim_cur);
-    msnprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
+    curl_msnprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
               strbuff1, strbuff2);
     store_errmsg(strbuff, 0);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     return -4;
   }
 
@@ -250,22 +250,22 @@ static int test_rlimit(int keep_open)
   do {
     num_open.rlim_max = sizeof(*memchunk) * nitems;
     rlim2str(strbuff, sizeof(strbuff), num_open.rlim_max);
-    fprintf(stderr, "allocating memchunk %s byte array\n", strbuff);
+    curl_mfprintf(stderr, "allocating memchunk %s byte array\n", strbuff);
     memchunk = malloc(sizeof(*memchunk) * (size_t)nitems);
     if(!memchunk) {
-      fprintf(stderr, "memchunk, malloc() failed\n");
+      curl_mfprintf(stderr, "memchunk, malloc() failed\n");
       nitems /= 2;
     }
   } while(nitems && !memchunk);
   if(!memchunk) {
     store_errmsg("memchunk, malloc() failed", errno);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     return -5;
   }
 
   /* initialize it to fight lazy allocation */
 
-  fprintf(stderr, "initializing memchunk array\n");
+  curl_mfprintf(stderr, "initializing memchunk array\n");
 
   for(i = 0; i < nitems; i++)
     memchunk[i] = -1;
@@ -278,10 +278,11 @@ static int test_rlimit(int keep_open)
 
   if((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*testfd)) {
     rlim2str(strbuff1, sizeof(strbuff1), num_open.rlim_max);
-    msnprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
-              "file descriptors, would overflow size_t", strbuff1);
+    curl_msnprintf(strbuff, sizeof(strbuff),
+                   "unable to allocate an array for %s "
+                   "file descriptors, would overflow size_t", strbuff1);
     store_errmsg(strbuff, 0);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     free(memchunk);
     return -6;
   }
@@ -289,19 +290,19 @@ static int test_rlimit(int keep_open)
   /* allocate array for file descriptors */
 
   rlim2str(strbuff, sizeof(strbuff), num_open.rlim_max);
-  fprintf(stderr, "allocating array for %s file descriptors\n", strbuff);
+  curl_mfprintf(stderr, "allocating array for %s file descriptors\n", strbuff);
 
   testfd = malloc(sizeof(*testfd) * (size_t)(num_open.rlim_max));
   if(!testfd) {
     store_errmsg("testfd, malloc() failed", errno);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     free(memchunk);
     return -7;
   }
 
   /* initialize it to fight lazy allocation */
 
-  fprintf(stderr, "initializing testfd array\n");
+  curl_mfprintf(stderr, "initializing testfd array\n");
 
   for(num_open.rlim_cur = 0;
       num_open.rlim_cur < num_open.rlim_max;
@@ -309,15 +310,15 @@ static int test_rlimit(int keep_open)
     testfd[num_open.rlim_cur] = -1;
 
   rlim2str(strbuff, sizeof(strbuff), num_open.rlim_max);
-  fprintf(stderr, "trying to open %s file descriptors\n", strbuff);
+  curl_mfprintf(stderr, "trying to open %s file descriptors\n", strbuff);
 
   /* open a dummy descriptor */
 
   testfd[0] = open(DEV_NULL, O_RDONLY);
   if(testfd[0] < 0) {
-    msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
+    curl_msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
     store_errmsg(strbuff, errno);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     free(testfd);
     testfd = NULL;
     free(memchunk);
@@ -337,22 +338,23 @@ static int test_rlimit(int keep_open)
       testfd[num_open.rlim_cur] = -1;
 
       rlim2str(strbuff1, sizeof(strbuff1), num_open.rlim_cur);
-      msnprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
-      fprintf(stderr, "%s\n", strbuff);
+      curl_msnprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed",
+                     strbuff1);
+      curl_mfprintf(stderr, "%s\n", strbuff);
 
       rlim2str(strbuff1, sizeof(strbuff1), num_open.rlim_cur);
-      msnprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
-                strbuff1);
-      fprintf(stderr, "%s\n", strbuff);
+      curl_msnprintf(strbuff, sizeof(strbuff),
+                     "fds system limit seems close to %s", strbuff1);
+      curl_mfprintf(stderr, "%s\n", strbuff);
 
       num_open.rlim_max = NUM_NEEDED;
 
       rlim2str(strbuff2, sizeof(strbuff2), num_open.rlim_max);
       rlim2str(strbuff1, sizeof(strbuff1), num_open.rlim_cur);
-      msnprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
-                strbuff2, strbuff1);
+      curl_msnprintf(strbuff, sizeof(strbuff),
+                     "fds needed %s > system limit %s", strbuff2, strbuff1);
       store_errmsg(strbuff, 0);
-      fprintf(stderr, "%s\n", msgbuff);
+      curl_mfprintf(stderr, "%s\n", msgbuff);
 
       for(num_open.rlim_cur = 0;
           testfd[num_open.rlim_cur] >= 0;
@@ -366,7 +368,7 @@ static int test_rlimit(int keep_open)
   }
 
   rlim2str(strbuff, sizeof(strbuff), num_open.rlim_max);
-  fprintf(stderr, "%s file descriptors open\n", strbuff);
+  curl_mfprintf(stderr, "%s file descriptors open\n", strbuff);
 
 #if !defined(HAVE_POLL) && !defined(USE_WINSOCK)
 
@@ -383,10 +385,10 @@ static int test_rlimit(int keep_open)
 
   num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
   if(num_open.rlim_max > num_open.rlim_cur) {
-    msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+    curl_msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
               FD_SETSIZE);
     store_errmsg(strbuff, 0);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     close_file_descriptors();
     free(memchunk);
     return -10;
@@ -398,10 +400,10 @@ static int test_rlimit(int keep_open)
       rl.rlim_cur++) {
     if((testfd[rl.rlim_cur] > 0) &&
        ((unsigned int)testfd[rl.rlim_cur] > num_open.rlim_cur)) {
-      msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+      curl_msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
                 FD_SETSIZE);
       store_errmsg(strbuff, 0);
-      fprintf(stderr, "%s\n", msgbuff);
+      curl_mfprintf(stderr, "%s\n", msgbuff);
       close_file_descriptors();
       free(memchunk);
       return -11;
@@ -421,10 +423,11 @@ static int test_rlimit(int keep_open)
 
   if(!fopen_works()) {
     rlim2str(strbuff1, sizeof(strbuff1), num_open.rlim_max);
-    msnprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
+    curl_msnprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
               strbuff1);
-    fprintf(stderr, "%s\n", msgbuff);
-    msnprintf(strbuff, sizeof(strbuff), "fopen fails with lots of fds open");
+    curl_mfprintf(stderr, "%s\n", msgbuff);
+    curl_msnprintf(strbuff, sizeof(strbuff),
+                   "fopen fails with lots of fds open");
     store_errmsg(strbuff, 0);
     close_file_descriptors();
     free(memchunk);
@@ -453,7 +456,7 @@ CURLcode test(char *URL)
   if(!strcmp(URL, "check")) {
     /* used by the test script to ask if we can run this test or not */
     if(test_rlimit(FALSE)) {
-      fprintf(stdout, "test_rlimit problem: %s\n", msgbuff);
+      curl_mfprintf(stdout, "test_rlimit problem: %s\n", msgbuff);
       return TEST_ERR_FAILURE;
     }
     return CURLE_OK; /* sure, run this! */
@@ -468,14 +471,14 @@ CURLcode test(char *URL)
      and close them all once the test is over */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     close_file_descriptors();
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     close_file_descriptors();
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -500,7 +503,7 @@ test_cleanup:
 CURLcode test(char *URL)
 {
   (void)URL;
-  printf("system lacks necessary system function(s)");
+  curl_mprintf("system lacks necessary system function(s)");
   return 1; /* skip test */
 }
 
index fcc8a6a0407dac0ab985eb7ad45df00e0f2bbb71..2f92f73864f6e894d4ed92fa935c60fb88a6eb33 100644 (file)
@@ -31,13 +31,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 13257c4706cecbe0ce3ff223a53189865854b11d..81552019676762f1c1831cb29f552114a98a7521 100644 (file)
@@ -31,13 +31,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index dc884437519efab37b014e7a8d4aa9e4771e89ca..cc1863d148d6b9c5452c2c461be695316876b704 100644 (file)
@@ -31,13 +31,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 5c7338e7c925cf4c33aa40271449514551d98249..f130d7abaebbcab5405905d0a964270929e670c4 100644 (file)
@@ -31,13 +31,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index ec721bee251152a3bfc5c3b8d24c644c4d4bad4c..830c0d7776be432e5acbe6ca2a49e9763103114a 100644 (file)
@@ -31,13 +31,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index d98444687b118ced77cb704ae0754b628fd5abf0..e1742a4afdb3f46e441262a842c3b306947f2191 100644 (file)
@@ -46,19 +46,19 @@ CURLcode test(char *URL)
   if(!libtest_arg2) {
 #ifdef LIB529
     /* test 529 */
-    fprintf(stderr, "Usage: lib529 [url] [uploadfile]\n");
+    curl_mfprintf(stderr, "Usage: lib529 [url] [uploadfile]\n");
 #else
     /* test 525 */
-    fprintf(stderr, "Usage: lib525 [url] [uploadfile]\n");
+    curl_mfprintf(stderr, "Usage: lib525 [url] [uploadfile]\n");
 #endif
     return TEST_ERR_USAGE;
   }
 
   hd_src = fopen(libtest_arg2, "rb");
   if(!hd_src) {
-    fprintf(stderr, "fopen failed with error (%d) %s\n",
+    curl_mfprintf(stderr, "fopen failed with error (%d) %s\n",
             errno, strerror(errno));
-    fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
+    curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
     return TEST_ERR_FOPEN;
   }
 
@@ -70,9 +70,9 @@ CURLcode test(char *URL)
 #endif
   if(hd == -1) {
     /* can't open file, bail out */
-    fprintf(stderr, "fstat() failed with error (%d) %s\n",
+    curl_mfprintf(stderr, "fstat() failed with error (%d) %s\n",
             errno, strerror(errno));
-    fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
+    curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
     fclose(hd_src);
     return TEST_ERR_FSTAT;
   }
index 5fd81b51eb84189526793b5e60656f3eec4adab7..c38d6dfebaf1dd3da257c13152a2fac887454326 100644 (file)
@@ -81,7 +81,7 @@ CURLcode test(char *URL)
 
   multi_add_handle(m, curl[current]);
 
-  fprintf(stderr, "Start at URL 0\n");
+  curl_mfprintf(stderr, "Start at URL 0\n");
 
   for(;;) {
     struct timeval interval;
@@ -104,7 +104,7 @@ CURLcode test(char *URL)
       curl[current] = NULL;
 #endif
       if(++current < NUM_HANDLES) {
-        fprintf(stderr, "Advancing to URL %d\n", current);
+        curl_mfprintf(stderr, "Advancing to URL %d\n", current);
 #ifdef LIB532
         /* first remove the only handle we use */
         curl_multi_remove_handle(m, curl[0]);
index ac503be7fc4d82df29ce152b6631d3f9f4eb8da2..f577c82ad574a7f371cf2243591685d208f291c7 100644 (file)
@@ -56,7 +56,7 @@ static void removeFd(struct Sockets *sockets, curl_socket_t fd, int mention)
   int i;
 
   if(mention)
-    fprintf(stderr, "Remove socket fd %d\n", (int) fd);
+    curl_mfprintf(stderr, "Remove socket fd %d\n", (int) fd);
 
   for(i = 0; i < sockets->count; ++i) {
     if(sockets->sockets[i] == fd) {
@@ -78,7 +78,7 @@ static int addFd(struct Sockets *sockets, curl_socket_t fd, const char *what)
    * To ensure we only have each file descriptor once, we remove it then add
    * it again.
    */
-  fprintf(stderr, "Add socket fd %d for %s\n", (int) fd, what);
+  curl_mfprintf(stderr, "Add socket fd %d for %s\n", (int) fd, what);
   removeFd(sockets, fd, 0);
   /*
    * Allocate array storage when required.
@@ -120,9 +120,10 @@ static int curlSocketCallback(CURL *easy, curl_socket_t s, int action,
   (void)easy; /* unused */
   (void)socketp; /* unused */
 
-  fprintf(stderr, "CURLMOPT_SOCKETFUNCTION called: %u\n", socket_calls++);
+  curl_mfprintf(stderr, "CURLMOPT_SOCKETFUNCTION called: %u\n",
+                socket_calls++);
   if(socket_calls == max_socket_calls) {
-    fprintf(stderr, "curlSocketCallback returns error\n");
+    curl_mfprintf(stderr, "curlSocketCallback returns error\n");
     return -1;
   }
 
@@ -153,9 +154,9 @@ static int curlTimerCallback(CURLM *multi, long timeout_ms, void *userp)
   struct timeval *timeout = userp;
 
   (void)multi; /* unused */
-  fprintf(stderr, "CURLMOPT_TIMERFUNCTION called: %u\n", timer_calls++);
+  curl_mfprintf(stderr, "CURLMOPT_TIMERFUNCTION called: %u\n", timer_calls++);
   if(timer_calls == max_timer_calls) {
-    fprintf(stderr, "curlTimerCallback returns error\n");
+    curl_mfprintf(stderr, "curlTimerCallback returns error\n");
     return -1;
   }
   if(timeout_ms != -1) {
@@ -188,7 +189,7 @@ static int checkForCompletion(CURLM *curl, int *success)
         *success = 0;
     }
     else {
-      fprintf(stderr, "Got an unexpected message from curl: %i\n",
+      curl_mfprintf(stderr, "Got an unexpected message from curl: %i\n",
               message->msg);
       result = 1;
       *success = 0;
@@ -238,7 +239,7 @@ static int socket_action(CURLM *curl, curl_socket_t s, int evBitmask,
   int numhandles = 0;
   CURLMcode result = curl_multi_socket_action(curl, s, evBitmask, &numhandles);
   if(result != CURLM_OK) {
-    fprintf(stderr, "Curl error on %s (%i) %s\n",
+    curl_mfprintf(stderr, "Curl error on %s (%i) %s\n",
             info, result, curl_multi_strerror(result));
   }
   return (int)result;
@@ -278,7 +279,7 @@ static CURLcode testone(char *URL, int timercb, int socketcb)
   timer_calls = 0; /* reset the globals */
   socket_calls = 0;
 
-  fprintf(stderr, "start test: %d %d\n", timercb, socketcb);
+  curl_mfprintf(stderr, "start test: %d %d\n", timercb, socketcb);
   start_test_timing();
 
   res_global_init(CURL_GLOBAL_ALL);
@@ -354,14 +355,14 @@ static CURLcode testone(char *URL, int timercb, int socketcb)
   }
 
   if(!success) {
-    fprintf(stderr, "Error getting file.\n");
+    curl_mfprintf(stderr, "Error getting file.\n");
     res = TEST_ERR_MAJOR_BAD;
   }
 
 test_cleanup:
 
   /* proper cleanup sequence */
-  fprintf(stderr, "cleanup: %d %d\n", timercb, socketcb);
+  curl_mfprintf(stderr, "cleanup: %d %d\n", timercb, socketcb);
   curl_multi_remove_handle(m, curl);
   curl_easy_cleanup(curl);
   curl_multi_cleanup(m);
@@ -380,23 +381,23 @@ CURLcode test(char *URL)
      callback calls */
   rc = testone(URL, 0, 0);
   if(rc)
-    fprintf(stderr, "test 0/0 failed: %d\n", rc);
+    curl_mfprintf(stderr, "test 0/0 failed: %d\n", rc);
 
   rc = testone(URL, 1, 0);
   if(!rc)
-    fprintf(stderr, "test 1/0 failed: %d\n", rc);
+    curl_mfprintf(stderr, "test 1/0 failed: %d\n", rc);
 
   rc = testone(URL, 2, 0);
   if(!rc)
-    fprintf(stderr, "test 2/0 failed: %d\n", rc);
+    curl_mfprintf(stderr, "test 2/0 failed: %d\n", rc);
 
   rc = testone(URL, 0, 1);
   if(!rc)
-    fprintf(stderr, "test 0/1 failed: %d\n", rc);
+    curl_mfprintf(stderr, "test 0/1 failed: %d\n", rc);
 
   rc = testone(URL, 0, 2);
   if(!rc)
-    fprintf(stderr, "test 0/2 failed: %d\n", rc);
+    curl_mfprintf(stderr, "test 0/2 failed: %d\n", rc);
 
   return CURLE_OK;
 }
index 75fe36065e625db78e1954fda2102cbc11191167..be12105896639472fbda2534a7d3f6528c3af776 100644 (file)
@@ -55,7 +55,7 @@ CURLcode test(char *URL)
 
   multi_add_handle(m, curl);
 
-  fprintf(stderr, "Start at URL 0\n");
+  curl_mfprintf(stderr, "Start at URL 0\n");
 
   for(;;) {
     struct timeval interval;
@@ -71,7 +71,7 @@ CURLcode test(char *URL)
 
     if(!running) {
       if(!current++) {
-        fprintf(stderr, "Advancing to URL 1\n");
+        curl_mfprintf(stderr, "Advancing to URL 1\n");
         /* remove the handle we use */
         curl_multi_remove_handle(m, curl);
 
index 73edf43d4102104347e9663add64898e2e193db3..ce1df9c0dc5e6f82b699c27c765fa29cc48c137f 100644 (file)
@@ -32,7 +32,7 @@ static void proxystat(CURL *curl)
 {
   long wasproxy;
   if(!curl_easy_getinfo(curl, CURLINFO_USED_PROXY, &wasproxy)) {
-    printf("This %sthe proxy\n", wasproxy ? "used ":
+    curl_mprintf("This %sthe proxy\n", wasproxy ? "used ":
            "DID NOT use ");
   }
 }
@@ -44,13 +44,13 @@ CURLcode test(char *URL)
   struct curl_slist *host = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 2279f93b4bd912ddd520e500bc7b4e1179147679..96deb91f774e11b211fdab1b37c46a8734e74e82 100644 (file)
@@ -55,9 +55,9 @@ static char msgbuff[256];
 static void store_errmsg(const char *msg, int err)
 {
   if(!err)
-    msnprintf(msgbuff, sizeof(msgbuff), "%s", msg);
+    curl_msnprintf(msgbuff, sizeof(msgbuff), "%s", msg);
   else
-    msnprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg,
+    curl_msnprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg,
               err, strerror(err));
 }
 
@@ -85,7 +85,7 @@ static int fopen_works(void)
     fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
     if(!fpa[i]) {
       store_errmsg("fopen failed", errno);
-      fprintf(stderr, "%s\n", msgbuff);
+      curl_mfprintf(stderr, "%s\n", msgbuff);
       ret = 0;
       break;
     }
@@ -101,20 +101,20 @@ static void rlim2str(char *buf, size_t len, rlim_t val)
 {
 #ifdef RLIM_INFINITY
   if(val == RLIM_INFINITY) {
-    msnprintf(buf, len, "INFINITY");
+    curl_msnprintf(buf, len, "INFINITY");
     return;
   }
 #endif
 #ifdef HAVE_LONGLONG
   if(sizeof(rlim_t) > sizeof(long))
-    msnprintf(buf, len, "%llu", (unsigned long long)val);
+    curl_msnprintf(buf, len, "%llu", (unsigned long long)val);
   else
 #endif
   {
     if(sizeof(rlim_t) < sizeof(long))
-      msnprintf(buf, len, "%u", (unsigned int)val);
+      curl_msnprintf(buf, len, "%u", (unsigned int)val);
     else
-      msnprintf(buf, len, "%lu", (unsigned long)val);
+      curl_msnprintf(buf, len, "%lu", (unsigned long)val);
   }
 }
 
@@ -131,24 +131,25 @@ static int test_rlimit(int keep_open)
 
   if(getrlimit(RLIMIT_NOFILE, &rl) != 0) {
     store_errmsg("getrlimit() failed", errno);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     return -1;
   }
 
   /* show initial open file limits */
 
   rlim2str(strbuff, sizeof(strbuff), rl.rlim_cur);
-  fprintf(stderr, "initial soft limit: %s\n", strbuff);
+  curl_mfprintf(stderr, "initial soft limit: %s\n", strbuff);
 
   rlim2str(strbuff, sizeof(strbuff), rl.rlim_max);
-  fprintf(stderr, "initial hard limit: %s\n", strbuff);
+  curl_mfprintf(stderr, "initial hard limit: %s\n", strbuff);
 
   /* If the OS allows a HUGE number of open files, we do not run.
    * Modern debian sid reports a limit of 134217724 and this tests
    * takes minutes. */
 #define LIMIT_CAP     (256*1024)
   if(rl.rlim_cur > LIMIT_CAP) {
-    fprintf(stderr, "soft limit above %ld, not running\n", (long)LIMIT_CAP);
+    curl_mfprintf(stderr, "soft limit above %ld, not running\n",
+                  (long)LIMIT_CAP);
     return -2;
   }
 
@@ -166,23 +167,23 @@ static int test_rlimit(int keep_open)
 #ifdef OPEN_MAX
     if((rl.rlim_cur > 0) &&
        (rl.rlim_cur < OPEN_MAX)) {
-      fprintf(stderr, "raising soft limit up to OPEN_MAX\n");
+      curl_mfprintf(stderr, "raising soft limit up to OPEN_MAX\n");
       rl.rlim_cur = OPEN_MAX;
       if(setrlimit(RLIMIT_NOFILE, &rl) != 0) {
         /* on failure don't abort just issue a warning */
         store_errmsg("setrlimit() failed", errno);
-        fprintf(stderr, "%s\n", msgbuff);
+        curl_mfprintf(stderr, "%s\n", msgbuff);
         msgbuff[0] = '\0';
       }
     }
 #endif
 
-    fprintf(stderr, "raising soft limit up to hard limit\n");
+    curl_mfprintf(stderr, "raising soft limit up to hard limit\n");
     rl.rlim_cur = rl.rlim_max;
     if(setrlimit(RLIMIT_NOFILE, &rl) != 0) {
       /* on failure don't abort just issue a warning */
       store_errmsg("setrlimit() failed", errno);
-      fprintf(stderr, "%s\n", msgbuff);
+      curl_mfprintf(stderr, "%s\n", msgbuff);
       msgbuff[0] = '\0';
     }
 
@@ -190,17 +191,17 @@ static int test_rlimit(int keep_open)
 
     if(getrlimit(RLIMIT_NOFILE, &rl) != 0) {
       store_errmsg("getrlimit() failed", errno);
-      fprintf(stderr, "%s\n", msgbuff);
+      curl_mfprintf(stderr, "%s\n", msgbuff);
       return -3;
     }
 
     /* show current open file limits */
 
     rlim2str(strbuff, sizeof(strbuff), rl.rlim_cur);
-    fprintf(stderr, "current soft limit: %s\n", strbuff);
+    curl_mfprintf(stderr, "current soft limit: %s\n", strbuff);
 
     rlim2str(strbuff, sizeof(strbuff), rl.rlim_max);
-    fprintf(stderr, "current hard limit: %s\n", strbuff);
+    curl_mfprintf(stderr, "current hard limit: %s\n", strbuff);
 
   } /* (rl.rlim_cur != rl.rlim_max) */
 
@@ -230,22 +231,22 @@ static int test_rlimit(int keep_open)
   do {
     num_open.rlim_max = sizeof(*memchunk) * nitems;
     rlim2str(strbuff, sizeof(strbuff), num_open.rlim_max);
-    fprintf(stderr, "allocating memchunk %s byte array\n", strbuff);
+    curl_mfprintf(stderr, "allocating memchunk %s byte array\n", strbuff);
     memchunk = malloc(sizeof(*memchunk) * (size_t)nitems);
     if(!memchunk) {
-      fprintf(stderr, "memchunk, malloc() failed\n");
+      curl_mfprintf(stderr, "memchunk, malloc() failed\n");
       nitems /= 2;
     }
   } while(nitems && !memchunk);
   if(!memchunk) {
     store_errmsg("memchunk, malloc() failed", errno);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     return -4;
   }
 
   /* initialize it to fight lazy allocation */
 
-  fprintf(stderr, "initializing memchunk array\n");
+  curl_mfprintf(stderr, "initializing memchunk array\n");
 
   for(i = 0; i < nitems; i++)
     memchunk[i] = -1;
@@ -273,10 +274,11 @@ static int test_rlimit(int keep_open)
 
   if((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*testfd)) {
     rlim2str(strbuff1, sizeof(strbuff1), num_open.rlim_max);
-    msnprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
-              "file descriptors, would overflow size_t", strbuff1);
+    curl_msnprintf(strbuff, sizeof(strbuff),
+                   "unable to allocate an array for %s "
+                   "file descriptors, would overflow size_t", strbuff1);
     store_errmsg(strbuff, 0);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     free(memchunk);
     return -5;
   }
@@ -285,24 +287,25 @@ static int test_rlimit(int keep_open)
 
   do {
     rlim2str(strbuff, sizeof(strbuff), num_open.rlim_max);
-    fprintf(stderr, "allocating array for %s file descriptors\n", strbuff);
+    curl_mfprintf(stderr, "allocating array for %s file descriptors\n",
+                  strbuff);
 
     testfd = malloc(sizeof(*testfd) * (size_t)(num_open.rlim_max));
     if(!testfd) {
-      fprintf(stderr, "testfd, malloc() failed\n");
+      curl_mfprintf(stderr, "testfd, malloc() failed\n");
       num_open.rlim_max /= 2;
     }
   } while(num_open.rlim_max && !testfd);
   if(!testfd) {
     store_errmsg("testfd, malloc() failed", errno);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     free(memchunk);
     return -6;
   }
 
   /* initialize it to fight lazy allocation */
 
-  fprintf(stderr, "initializing testfd array\n");
+  curl_mfprintf(stderr, "initializing testfd array\n");
 
   for(num_open.rlim_cur = 0;
       num_open.rlim_cur < num_open.rlim_max;
@@ -310,15 +313,15 @@ static int test_rlimit(int keep_open)
     testfd[num_open.rlim_cur] = -1;
 
   rlim2str(strbuff, sizeof(strbuff), num_open.rlim_max);
-  fprintf(stderr, "trying to open %s file descriptors\n", strbuff);
+  curl_mfprintf(stderr, "trying to open %s file descriptors\n", strbuff);
 
   /* open a dummy descriptor */
 
   testfd[0] = open(DEV_NULL, O_RDONLY);
   if(testfd[0] < 0) {
-    msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
+    curl_msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
     store_errmsg(strbuff, errno);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     free(testfd);
     testfd = NULL;
     free(memchunk);
@@ -338,21 +341,22 @@ static int test_rlimit(int keep_open)
       testfd[num_open.rlim_cur] = -1;
 
       rlim2str(strbuff1, sizeof(strbuff1), num_open.rlim_cur);
-      msnprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
-      fprintf(stderr, "%s\n", strbuff);
+      curl_msnprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed",
+                     strbuff1);
+      curl_mfprintf(stderr, "%s\n", strbuff);
 
       rlim2str(strbuff1, sizeof(strbuff1), num_open.rlim_cur);
-      msnprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
-                strbuff1);
-      fprintf(stderr, "%s\n", strbuff);
+      curl_msnprintf(strbuff, sizeof(strbuff),
+                     "fds system limit seems close to %s", strbuff1);
+      curl_mfprintf(stderr, "%s\n", strbuff);
 
       num_open.rlim_max = num_open.rlim_cur - SAFETY_MARGIN;
 
       num_open.rlim_cur -= num_open.rlim_max;
       rlim2str(strbuff1, sizeof(strbuff1), num_open.rlim_cur);
-      msnprintf(strbuff, sizeof(strbuff), "closing %s file descriptors",
-                strbuff1);
-      fprintf(stderr, "%s\n", strbuff);
+      curl_msnprintf(strbuff, sizeof(strbuff), "closing %s file descriptors",
+                     strbuff1);
+      curl_mfprintf(stderr, "%s\n", strbuff);
 
       for(num_open.rlim_cur = num_open.rlim_max;
           testfd[num_open.rlim_cur] >= 0;
@@ -362,7 +366,8 @@ static int test_rlimit(int keep_open)
       }
 
       rlim2str(strbuff, sizeof(strbuff), num_open.rlim_max);
-      fprintf(stderr, "shrinking array for %s file descriptors\n", strbuff);
+      curl_mfprintf(stderr, "shrinking array for %s file descriptors\n",
+                    strbuff);
 
       /* we don't care if we can't shrink it */
 
@@ -377,7 +382,7 @@ static int test_rlimit(int keep_open)
   }
 
   rlim2str(strbuff, sizeof(strbuff), num_open.rlim_max);
-  fprintf(stderr, "%s file descriptors open\n", strbuff);
+  curl_mfprintf(stderr, "%s file descriptors open\n", strbuff);
 
 #if !defined(HAVE_POLL) && !defined(USE_WINSOCK)
 
@@ -394,10 +399,10 @@ static int test_rlimit(int keep_open)
 
   num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
   if(num_open.rlim_max > num_open.rlim_cur) {
-    msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+    curl_msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
               FD_SETSIZE);
     store_errmsg(strbuff, 0);
-    fprintf(stderr, "%s\n", msgbuff);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
     close_file_descriptors();
     free(memchunk);
     return -8;
@@ -409,10 +414,10 @@ static int test_rlimit(int keep_open)
       rl.rlim_cur++) {
     if((testfd[rl.rlim_cur] > 0) &&
        ((unsigned int)testfd[rl.rlim_cur] > num_open.rlim_cur)) {
-      msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+      curl_msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
                 FD_SETSIZE);
       store_errmsg(strbuff, 0);
-      fprintf(stderr, "%s\n", msgbuff);
+      curl_mfprintf(stderr, "%s\n", msgbuff);
       close_file_descriptors();
       free(memchunk);
       return -9;
@@ -432,10 +437,11 @@ static int test_rlimit(int keep_open)
 
   if(!fopen_works()) {
     rlim2str(strbuff1, sizeof(strbuff1), num_open.rlim_max);
-    msnprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
-              strbuff1);
-    fprintf(stderr, "%s\n", msgbuff);
-    msnprintf(strbuff, sizeof(strbuff), "fopen fails with lots of fds open");
+    curl_msnprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
+                   strbuff1);
+    curl_mfprintf(stderr, "%s\n", msgbuff);
+    curl_msnprintf(strbuff, sizeof(strbuff),
+                   "fopen fails with lots of fds open");
     store_errmsg(strbuff, 0);
     close_file_descriptors();
     free(memchunk);
@@ -464,7 +470,7 @@ CURLcode test(char *URL)
   if(!strcmp(URL, "check")) {
     /* used by the test script to ask if we can run this test or not */
     if(test_rlimit(FALSE)) {
-      fprintf(stdout, "test_rlimit problem: %s\n", msgbuff);
+      curl_mfprintf(stdout, "test_rlimit problem: %s\n", msgbuff);
       return TEST_ERR_FAILURE;
     }
     return CURLE_OK; /* sure, run this! */
@@ -479,14 +485,14 @@ CURLcode test(char *URL)
      and close them all once the test is over */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     close_file_descriptors();
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     close_file_descriptors();
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -511,7 +517,7 @@ test_cleanup:
 CURLcode test(char *URL)
 {
   (void)URL;
-  printf("system lacks necessary system function(s)");
+  curl_mprintf("system lacks necessary system function(s)");
   return TEST_ERR_MAJOR_BAD; /* skip test */
 }
 
index 363d0a296beabdd370384a4f07e71123e26a9953..ace839d03cafb120ca5428601f54078a84fedd31 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   struct curl_slist *slist = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 571f4046486bd55e6537dd6ff10877cbfbf6f076..42020849874ca2fca66576aff273c96524495a99 100644 (file)
@@ -169,7 +169,7 @@ static CURLcode loop(int num, CURLM *cm, const char *url, const char *userpwd,
       if(msg->msg == CURLMSG_DONE) {
         int i;
         CURL *e = msg->easy_handle;
-        fprintf(stderr, "R: %d - %s\n", (int)msg->data.result,
+        curl_mfprintf(stderr, "R: %d - %s\n", (int)msg->data.result,
                 curl_easy_strerror(msg->data.result));
         curl_multi_remove_handle(cm, e);
         curl_easy_cleanup(e);
@@ -181,7 +181,7 @@ static CURLcode loop(int num, CURLM *cm, const char *url, const char *userpwd,
         }
       }
       else
-        fprintf(stderr, "E: CURLMsg (%d)\n", (int)msg->msg);
+        curl_mfprintf(stderr, "E: CURLMsg (%d)\n", (int)msg->msg);
     }
 
     res_test_timedout();
@@ -208,12 +208,12 @@ CURLcode test(char *URL)
   if(test_argc < 4)
     return TEST_ERR_MAJOR_BAD;
 
-  msnprintf(buffer, sizeof(buffer), "Host: %s", HOST);
+  curl_msnprintf(buffer, sizeof(buffer), "Host: %s", HOST);
 
   /* now add a custom Host: header */
   headers = curl_slist_append(headers, buffer);
   if(!headers) {
-    fprintf(stderr, "curl_slist_append() failed\n");
+    curl_mfprintf(stderr, "curl_slist_append() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -234,7 +234,7 @@ CURLcode test(char *URL)
   if(res)
     goto test_cleanup;
 
-  fprintf(stderr, "lib540: now we do the request again\n");
+  curl_mfprintf(stderr, "lib540: now we do the request again\n");
 
   res = loop(1, cm, URL, PROXYUSERPWD, headers);
 
index 1e221a84da0760dc6dd5943f12545ea4d6168d06..1215206634c5884a62894595948be845b9fc620b 100644 (file)
@@ -42,15 +42,15 @@ CURLcode test(char *URL)
   struct_stat file_info;
 
   if(!libtest_arg2) {
-    fprintf(stderr, "Usage: <url> <file-to-upload>\n");
+    curl_mfprintf(stderr, "Usage: <url> <file-to-upload>\n");
     return TEST_ERR_USAGE;
   }
 
   hd_src = fopen(libtest_arg2, "rb");
   if(!hd_src) {
-    fprintf(stderr, "fopen failed with error (%d) %s\n",
+    curl_mfprintf(stderr, "fopen failed with error (%d) %s\n",
             errno, strerror(errno));
-    fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
+    curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
     return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */
   }
 
@@ -62,21 +62,21 @@ CURLcode test(char *URL)
 #endif
   if(hd == -1) {
     /* can't open file, bail out */
-    fprintf(stderr, "fstat() failed with error (%d) %s\n",
+    curl_mfprintf(stderr, "fstat() failed with error (%d) %s\n",
             errno, strerror(errno));
-    fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
+    curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
     fclose(hd_src);
     return TEST_ERR_MAJOR_BAD;
   }
 
   if(!file_info.st_size) {
-    fprintf(stderr, "File %s has zero size!\n", libtest_arg2);
+    curl_mfprintf(stderr, "File %s has zero size!\n", libtest_arg2);
     fclose(hd_src);
     return TEST_ERR_MAJOR_BAD;
   }
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     fclose(hd_src);
     return TEST_ERR_MAJOR_BAD;
   }
@@ -84,7 +84,7 @@ CURLcode test(char *URL)
   /* get a curl handle */
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     fclose(hd_src);
     return TEST_ERR_MAJOR_BAD;
index 2be67488ed0688c9e86b194ac47f07a92dbf58d9..f48c26995ee8be4495da2c357d8f03d0b149dc91 100644 (file)
@@ -39,14 +39,14 @@ CURLcode test(char *URL)
   CURLcode res = CURLE_OK;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   /* get a curl handle */
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 077cf16b6d638236813731ee24e77381a21a0787..8f8d4fd32a64adae3119c3d6b57ff93960a72620 100644 (file)
@@ -41,7 +41,7 @@ CURLcode test(char *URL)
   global_init(CURL_GLOBAL_ALL);
   easy = curl_easy_init();
   if(!easy) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     res = TEST_ERR_MAJOR_BAD;
   }
   else {
@@ -49,18 +49,18 @@ CURLcode test(char *URL)
     char *s = curl_easy_escape(easy, (const char *)a, asize);
 
     if(s) {
-      printf("%s\n", s);
+      curl_mprintf("%s\n", s);
       curl_free(s);
     }
 
     s = curl_easy_escape(easy, "", 0);
     if(s) {
-      printf("IN: '' OUT: '%s'\n", s);
+      curl_mprintf("IN: '' OUT: '%s'\n", s);
       curl_free(s);
     }
     s = curl_easy_escape(easy, " 123", 3);
     if(s) {
-      printf("IN: ' 12' OUT: '%s'\n", s);
+      curl_mprintf("IN: ' 12' OUT: '%s'\n", s);
       curl_free(s);
     }
 
index 6228e7d9f7b2c5322a681fcdf89d42e74e5dbad1..9b6874ca372123c7276b441afe2dfc58b2ccf398 100644 (file)
@@ -37,13 +37,13 @@ CURLcode test(char *URL)
   CURLcode res = CURLE_OK;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index a84ce999c85fd601c4f139f718e4a9fa3d97e36d..645f087d909dcdda926a0f695ab2fd3225d7eeb1 100644 (file)
@@ -42,17 +42,17 @@ static size_t readcallback(char  *ptr,
 
   if(*counter) {
     /* only do this once and then require a clearing of this */
-    fprintf(stderr, "READ ALREADY DONE!\n");
+    curl_mfprintf(stderr, "READ ALREADY DONE!\n");
     return 0;
   }
   (*counter)++; /* bump */
 
   if(size * nmemb >= strlen(UPLOADTHIS)) {
-    fprintf(stderr, "READ!\n");
+    curl_mfprintf(stderr, "READ!\n");
     strcpy(ptr, UPLOADTHIS);
     return strlen(UPLOADTHIS);
   }
-  fprintf(stderr, "READ NOT FINE!\n");
+  curl_mfprintf(stderr, "READ NOT FINE!\n");
   return 0;
 }
 static curlioerr ioctlcallback(CURL *handle,
@@ -62,7 +62,7 @@ static curlioerr ioctlcallback(CURL *handle,
   int *counter = (int *)clientp;
   (void)handle; /* unused */
   if(cmd == CURLIOCMD_RESTARTREAD) {
-    fprintf(stderr, "REWIND!\n");
+    curl_mfprintf(stderr, "REWIND!\n");
     *counter = 0; /* clear counter to make the read callback restart */
   }
   return CURLIOE_OK;
@@ -81,13 +81,13 @@ CURLcode test(char *URL)
 #endif
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 7bd67093f246ebc772c9a9302852503517b3bccb..eb5f4e313d4b0e2bf860693b53877dcb43251b12 100644 (file)
@@ -36,13 +36,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 0920b025a8ae30fd94b3d6ff4101544ab3da82c3..d923724f346863508ba62d760b30915d4ea2eea1 100644 (file)
@@ -48,17 +48,17 @@ void dump(const char *text,
     /* without the hex output, we can fit more on screen */
     width = 0x40;
 
-  fprintf(stream, "%s, %zu bytes (0x%zx)\n", text, size, size);
+  curl_mfprintf(stream, "%s, %zu bytes (0x%zx)\n", text, size, size);
 
   for(i = 0; i < size; i += width) {
 
-    fprintf(stream, "%04zx: ", i);
+    curl_mfprintf(stream, "%04zx: ", i);
 
     if(!nohex) {
       /* hex not disabled, show it */
       for(c = 0; c < width; c++)
         if(i + c < size)
-          fprintf(stream, "%02x ", ptr[i + c]);
+          curl_mfprintf(stream, "%02x ", ptr[i + c]);
         else
           fputs("   ", stream);
     }
@@ -70,7 +70,7 @@ void dump(const char *text,
         i += (c + 2 - width);
         break;
       }
-      fprintf(stream, "%c",
+      curl_mfprintf(stream, "%c",
               (ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
       /* check again for 0D0A, to avoid an extra \n if it's at width */
       if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
@@ -95,7 +95,7 @@ int my_trace(CURL *handle, curl_infotype type,
 
   switch(type) {
   case CURLINFO_TEXT:
-    fprintf(stderr, "== Info: %s", (char *)data);
+    curl_mfprintf(stderr, "== Info: %s", (char *)data);
     return 0;
   case CURLINFO_HEADER_OUT:
     text = "=> Send header";
@@ -145,7 +145,7 @@ static size_t write_callback(char *ptr, size_t size, size_t nmemb,
                              void *stream)
 {
   int amount = curlx_uztosi(size * nmemb);
-  printf("%.*s", amount, (char *)ptr);
+  curl_mprintf("%.*s", amount, (char *)ptr);
   (void)stream;
   return size * nmemb;
 }
@@ -155,8 +155,8 @@ static curlioerr ioctl_callback(CURL *handle, int cmd, void *clientp)
 {
   (void)clientp;
   if(cmd == CURLIOCMD_RESTARTREAD) {
-    printf("APPLICATION received a CURLIOCMD_RESTARTREAD request\n");
-    printf("APPLICATION ** REWINDING! **\n");
+    curl_mprintf("APPLICATION received a CURLIOCMD_RESTARTREAD request\n");
+    curl_mprintf("APPLICATION ** REWINDING! **\n");
     current_offset = 0;
     return CURLIOE_OK;
   }
index e33cf148ff9e1da9e99969dc57d7359d3a38977b..d6d7f7cdbbad7ac508066c96b90ad986eaaef5ba 100644 (file)
@@ -65,19 +65,19 @@ CURLcode test(char *URL)
   struct curl_slist *headerlist = NULL, *hl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
   for(i = 0; i < NUM_HEADERS; i++) {
-    int len = msnprintf(testbuf, sizeof(testbuf), "Header%d: ", i);
+    int len = curl_msnprintf(testbuf, sizeof(testbuf), "Header%d: ", i);
     memset(&testbuf[len], 'A', SIZE_HEADERS);
     testbuf[len + SIZE_HEADERS] = 0; /* null-terminate */
     hl = curl_slist_append(headerlist, testbuf);
index 10c19a38045a0df25969af92e8d9551b9ae983dc..e526631e712dbbc88397e4551ded31e5417e29db 100644 (file)
@@ -99,7 +99,7 @@ static CURLcode test_once(char *URL, bool oldstyle)
   }
 
   if(formrc)
-    printf("curl_formadd(1) = %d\n", (int)formrc);
+    curl_mprintf("curl_formadd(1) = %d\n", (int)formrc);
 
   /* Now add the same data with another name and make it not look like
      a file upload but still using the callback */
@@ -117,7 +117,7 @@ static CURLcode test_once(char *URL, bool oldstyle)
                           CURLFORM_END);
   )
   if(formrc)
-    printf("curl_formadd(2) = %d\n", (int)formrc);
+    curl_mprintf("curl_formadd(2) = %d\n", (int)formrc);
 
   CURL_IGNORE_DEPRECATION(
     /* Fill in the filename field */
@@ -128,7 +128,7 @@ static CURLcode test_once(char *URL, bool oldstyle)
                           CURLFORM_END);
   )
   if(formrc)
-    printf("curl_formadd(3) = %d\n", (int)formrc);
+    curl_mprintf("curl_formadd(3) = %d\n", (int)formrc);
 
   CURL_IGNORE_DEPRECATION(
     /* Fill in a submit field too */
@@ -140,7 +140,7 @@ static CURLcode test_once(char *URL, bool oldstyle)
                           CURLFORM_END);
   )
   if(formrc)
-    printf("curl_formadd(4) = %d\n", (int)formrc);
+    curl_mprintf("curl_formadd(4) = %d\n", (int)formrc);
 
   CURL_IGNORE_DEPRECATION(
     formrc = curl_formadd(&formpost, &lastptr,
@@ -151,11 +151,11 @@ static CURLcode test_once(char *URL, bool oldstyle)
                           CURLFORM_END);
   )
   if(formrc)
-    printf("curl_formadd(5) = %d\n", (int)formrc);
+    curl_mprintf("curl_formadd(5) = %d\n", (int)formrc);
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     CURL_IGNORE_DEPRECATION(
       curl_formfree(formpost);
     )
@@ -209,7 +209,7 @@ CURLcode test(char *URL)
   CURLcode res;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
index 7a16e2e2c8c718581f8077976a6dbaf4237aa787..3fc5f130162f96b2540e8433312edb5004ad1615 100644 (file)
@@ -49,17 +49,17 @@ static size_t readcallback(char  *ptr,
 
   if(*counter) {
     /* only do this once and then require a clearing of this */
-    fprintf(stderr, "READ ALREADY DONE!\n");
+    curl_mfprintf(stderr, "READ ALREADY DONE!\n");
     return 0;
   }
   (*counter)++; /* bump */
 
   if(size * nmemb >= strlen(uploadthis)) {
-    fprintf(stderr, "READ!\n");
+    curl_mfprintf(stderr, "READ!\n");
     strcpy(ptr, uploadthis);
     return strlen(uploadthis);
   }
-  fprintf(stderr, "READ NOT FINE!\n");
+  curl_mfprintf(stderr, "READ NOT FINE!\n");
   return 0;
 }
 static curlioerr ioctlcallback(CURL *handle,
@@ -69,7 +69,7 @@ static curlioerr ioctlcallback(CURL *handle,
   int *counter = (int *)clientp;
   (void)handle; /* unused */
   if(cmd == CURLIOCMD_RESTARTREAD) {
-    fprintf(stderr, "REWIND!\n");
+    curl_mfprintf(stderr, "REWIND!\n");
     *counter = 0; /* clear counter to make the read callback restart */
   }
   return CURLIOE_OK;
index 16844973407a5ec9d4da1719de31cc30a5544fc7..c3eeea18148372679e2b3a7c648ab86e068a6a5f 100644 (file)
@@ -35,13 +35,13 @@ CURLcode test(char *URL)
 #endif
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -88,7 +88,7 @@ again:
 #else
         if((size_t)write(STDOUT_FILENO, buf, nread) != nread) {
 #endif
-          fprintf(stderr, "write() failed: errno %d (%s)\n",
+          curl_mfprintf(stderr, "write() failed: errno %d (%s)\n",
                   errno, strerror(errno));
           res = TEST_ERR_FAILURE;
           break;
index 85cc4e20bc92e1602c6d0d9ed3fe32118960d628..8092d3967ff68cd4fbb6e0fbc6221099da9e254c 100644 (file)
@@ -166,17 +166,18 @@ static int test_unsigned_short_formatting(void)
     if(memcmp(us_test[i].result,
                us_test[i].expected,
                strlen(us_test[i].expected))) {
-      printf("unsigned short test #%.2d: Failed (Expected: %s Got: %s)\n",
-             i, us_test[i].expected, us_test[i].result);
+      curl_mprintf("unsigned short test #%.2d: Failed "
+                   "(Expected: %s Got: %s)\n",
+                   i, us_test[i].expected, us_test[i].result);
       failed++;
     }
 
   }
 
   if(!failed)
-    printf("All curl_mprintf() unsigned short tests OK!\n");
+    curl_mprintf("All curl_mprintf() unsigned short tests OK!\n");
   else
-    printf("Some curl_mprintf() unsigned short tests Failed!\n");
+    curl_mprintf("Some curl_mprintf() unsigned short tests Failed!\n");
 
   return failed;
 }
@@ -240,7 +241,7 @@ static int test_signed_short_formatting(void)
     if(memcmp(ss_test[i].result,
               ss_test[i].expected,
               strlen(ss_test[i].expected))) {
-      printf("signed short test #%.2d: Failed (Expected: %s Got: %s)\n",
+      curl_mprintf("signed short test #%.2d: Failed (Expected: %s Got: %s)\n",
              i, ss_test[i].expected, ss_test[i].result);
       failed++;
     }
@@ -248,9 +249,9 @@ static int test_signed_short_formatting(void)
   }
 
   if(!failed)
-    printf("All curl_mprintf() signed short tests OK!\n");
+    curl_mprintf("All curl_mprintf() signed short tests OK!\n");
   else
-    printf("Some curl_mprintf() signed short tests Failed!\n");
+    curl_mprintf("Some curl_mprintf() signed short tests Failed!\n");
 
   return failed;
 }
@@ -390,7 +391,7 @@ static int test_unsigned_int_formatting(void)
     if(memcmp(ui_test[i].result,
                ui_test[i].expected,
                strlen(ui_test[i].expected))) {
-      printf("unsigned int test #%.2d: Failed (Expected: %s Got: %s)\n",
+      curl_mprintf("unsigned int test #%.2d: Failed (Expected: %s Got: %s)\n",
              i, ui_test[i].expected, ui_test[i].result);
       failed++;
     }
@@ -398,9 +399,9 @@ static int test_unsigned_int_formatting(void)
   }
 
   if(!failed)
-    printf("All curl_mprintf() unsigned int tests OK!\n");
+    curl_mprintf("All curl_mprintf() unsigned int tests OK!\n");
   else
-    printf("Some curl_mprintf() unsigned int tests Failed!\n");
+    curl_mprintf("Some curl_mprintf() unsigned int tests Failed!\n");
 
   return failed;
 }
@@ -618,7 +619,7 @@ static int test_signed_int_formatting(void)
     if(memcmp(si_test[i].result,
               si_test[i].expected,
               strlen(si_test[i].expected))) {
-      printf("signed int test #%.2d: Failed (Expected: %s Got: %s)\n",
+      curl_mprintf("signed int test #%.2d: Failed (Expected: %s Got: %s)\n",
              i, si_test[i].expected, si_test[i].result);
       failed++;
     }
@@ -626,9 +627,9 @@ static int test_signed_int_formatting(void)
   }
 
   if(!failed)
-    printf("All curl_mprintf() signed int tests OK!\n");
+    curl_mprintf("All curl_mprintf() signed int tests OK!\n");
   else
-    printf("Some curl_mprintf() signed int tests Failed!\n");
+    curl_mprintf("Some curl_mprintf() signed int tests Failed!\n");
 
   return failed;
 }
@@ -767,7 +768,7 @@ static int test_unsigned_long_formatting(void)
     if(memcmp(ul_test[i].result,
                ul_test[i].expected,
                strlen(ul_test[i].expected))) {
-      printf("unsigned long test #%.2d: Failed (Expected: %s Got: %s)\n",
+      curl_mprintf("unsigned long test #%.2d: Failed (Expected: %s Got: %s)\n",
              i, ul_test[i].expected, ul_test[i].result);
       failed++;
     }
@@ -775,9 +776,9 @@ static int test_unsigned_long_formatting(void)
   }
 
   if(!failed)
-    printf("All curl_mprintf() unsigned long tests OK!\n");
+    curl_mprintf("All curl_mprintf() unsigned long tests OK!\n");
   else
-    printf("Some curl_mprintf() unsigned long tests Failed!\n");
+    curl_mprintf("Some curl_mprintf() unsigned long tests Failed!\n");
 
   return failed;
 }
@@ -995,7 +996,7 @@ static int test_signed_long_formatting(void)
     if(memcmp(sl_test[i].result,
               sl_test[i].expected,
               strlen(sl_test[i].expected))) {
-      printf("signed long test #%.2d: Failed (Expected: %s Got: %s)\n",
+      curl_mprintf("signed long test #%.2d: Failed (Expected: %s Got: %s)\n",
              i, sl_test[i].expected, sl_test[i].result);
       failed++;
     }
@@ -1003,9 +1004,9 @@ static int test_signed_long_formatting(void)
   }
 
   if(!failed)
-    printf("All curl_mprintf() signed long tests OK!\n");
+    curl_mprintf("All curl_mprintf() signed long tests OK!\n");
   else
-    printf("Some curl_mprintf() signed long tests Failed!\n");
+    curl_mprintf("Some curl_mprintf() signed long tests Failed!\n");
 
   return failed;
 }
@@ -1110,7 +1111,7 @@ static int test_curl_off_t_formatting(void)
     if(memcmp(co_test[i].result,
               co_test[i].expected,
               strlen(co_test[i].expected))) {
-      printf("curl_off_t test #%.2d: Failed (Expected: %s Got: %s)\n",
+      curl_mprintf("curl_off_t test #%.2d: Failed (Expected: %s Got: %s)\n",
              i, co_test[i].expected, co_test[i].result);
       failed++;
     }
@@ -1118,9 +1119,9 @@ static int test_curl_off_t_formatting(void)
   }
 
   if(!failed)
-    printf("All curl_mprintf() curl_off_t tests OK!\n");
+    curl_mprintf("All curl_mprintf() curl_off_t tests OK!\n");
   else
-    printf("Some curl_mprintf() curl_off_t tests Failed!\n");
+    curl_mprintf("Some curl_mprintf() curl_off_t tests Failed!\n");
 
   return failed;
 }
@@ -1129,7 +1130,7 @@ static int _string_check(int linenumber, char *buf, const char *buf2)
 {
   if(strcmp(buf, buf2)) {
     /* they shouldn't differ */
-    printf("sprintf line %d failed:\nwe      '%s'\nsystem: '%s'\n",
+    curl_mprintf("sprintf line %d failed:\nwe      '%s'\nsystem: '%s'\n",
            linenumber, buf, buf2);
     return 1;
   }
@@ -1142,7 +1143,7 @@ static int _strlen_check(int linenumber, char *buf, size_t len)
   size_t buflen = strlen(buf);
   if(len != buflen) {
     /* they shouldn't differ */
-    printf("sprintf strlen:%d failed:\nwe '%zu'\nsystem: '%zu'\n",
+    curl_mprintf("sprintf strlen:%d failed:\nwe '%zu'\nsystem: '%zu'\n",
            linenumber, buflen, len);
     return 1;
   }
@@ -1181,9 +1182,9 @@ static int test_string_formatting(void)
   errors += string_check(buf, "foo       ");
 
   if(!errors)
-    printf("All curl_mprintf() strings tests OK!\n");
+    curl_mprintf("All curl_mprintf() strings tests OK!\n");
   else
-    printf("Some curl_mprintf() string tests Failed!\n");
+    curl_mprintf("Some curl_mprintf() string tests Failed!\n");
 
   return errors;
 }
@@ -1302,7 +1303,7 @@ static int test_weird_arguments(void)
                       0, 1, 2, 3, 4, 5, 6, 7); /* 8 */
 
   if(rc != 128) {
-    printf("curl_mprintf() returned %d and not 128!\n", rc);
+    curl_mprintf("curl_mprintf() returned %d and not 128!\n", rc);
     errors++;
   }
 
@@ -1354,7 +1355,7 @@ static int test_weird_arguments(void)
                       0, 1, 2, 3, 4, 5, 6, 7, 8);   /* 9 */
 
   if(rc) {
-    printf("curl_mprintf() returned %d and not 0\n", rc);
+    curl_mprintf("curl_mprintf() returned %d and not 0\n", rc);
     errors++;
   }
 
@@ -1363,7 +1364,7 @@ static int test_weird_arguments(void)
   errors += test_width_precision();
 
   if(errors)
-    printf("Some curl_mprintf() weird arguments tests failed!\n");
+    curl_mprintf("Some curl_mprintf() weird arguments tests failed!\n");
 
   return errors;
 }
@@ -1475,9 +1476,9 @@ static int test_float_formatting(void)
   errors += strlen_check(buf, 5);
 
   if(!errors)
-    printf("All float strings tests OK!\n");
+    curl_mprintf("All float strings tests OK!\n");
   else
-    printf("test_float_formatting Failed!\n");
+    curl_mprintf("test_float_formatting Failed!\n");
 
   return errors;
 }
@@ -1517,9 +1518,9 @@ static int test_oct_hex_formatting(void)
 #endif
 
   if(!errors)
-    printf("All curl_mprintf() octal & hexadecimal tests OK!\n");
+    curl_mprintf("All curl_mprintf() octal & hexadecimal tests OK!\n");
   else
-    printf("Some curl_mprintf() octal & hexadecimal tests Failed!\n");
+    curl_mprintf("Some curl_mprintf() octal & hexadecimal tests Failed!\n");
 
   return errors;
 }
index 3fdc3b508da748e84c39f28be57b5d58268baf3b..3f1724a1e332dd368dac1b44d229e2151c9e4e23 100644 (file)
@@ -36,7 +36,7 @@ CURLcode test(char *URL)
   (void)URL; /* we don't use this */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
index aee660bb4f1851d368004605ba2b7d5a1b396b28..621b90e611195d66faf091fe04b5c943410a3a20 100644 (file)
@@ -32,13 +32,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 92cfbe962aa87208033f5b8f2964eb2a251c479a..fa9c75bac6454725c75f3691c6f8efa097b9ea5e 100644 (file)
@@ -43,14 +43,14 @@ CURLcode test(char *URL)
   CURLcode res = CURLE_OK;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   /* get a curl handle */
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 7d0cf8d59d0d4d41cdf3e9ff6f62ad75af51e221..11c9ab6e7b165692a531a24b9fbcf6e502b0b0c6 100644 (file)
@@ -53,7 +53,7 @@ CURLcode test(char *URL)
 
   multi_add_handle(m, curl);
 
-  fprintf(stderr, "Start at URL 0\n");
+  curl_mfprintf(stderr, "Start at URL 0\n");
 
   for(;;) {
     struct timeval interval;
index 89ad0c40df95272b327c48cee266b1628d222f9b..358e133a22d8d2d278b6af272b77e85bd21c47e9 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   double content_length = 3;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -57,7 +57,7 @@ CURLcode test(char *URL)
     )
     moo = fopen(libtest_arg2, "wb");
     if(moo) {
-      fprintf(moo, "CL %.0f\n", content_length);
+      curl_mfprintf(moo, "CL %.0f\n", content_length);
       fclose(moo);
     }
   }
index 21338e03ecd384c273b61991a9f39d7aa1c1ab3a..9c36cfa420fed40b1e8f274a6abbf28ba3ce5280 100644 (file)
@@ -35,13 +35,13 @@ CURLcode test(char *URL)
   struct curl_slist *custom_headers = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index e5e619c025a4e6e2cfe2a90c8f8b40a3dac42b9e..f3e68c2da3ce833c141295a907ea206c073d27e6 100644 (file)
@@ -53,13 +53,13 @@ CURLcode test(char *URL)
   struct curl_slist *custom_headers = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -80,7 +80,7 @@ CURLcode test(char *URL)
 
   sdp = open(libtest_arg2, O_RDONLY);
   if(sdp == -1) {
-    fprintf(stderr, "can't open %s\n", libtest_arg2);
+    curl_mfprintf(stderr, "can't open %s\n", libtest_arg2);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -89,7 +89,7 @@ CURLcode test(char *URL)
 
   sdpf = fopen(libtest_arg2, "rb");
   if(!sdpf) {
-    fprintf(stderr, "can't fopen %s\n", libtest_arg2);
+    curl_mfprintf(stderr, "can't fopen %s\n", libtest_arg2);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
index 3f735ae79a80c54a9b57356ad94680741ef60a2a..f5d124f4d98739aaafc5cf0dce334cec9a64f411 100644 (file)
@@ -44,19 +44,19 @@ CURLcode test(char *URL)
 
   FILE *idfile = fopen(libtest_arg2, "wb");
   if(!idfile) {
-    fprintf(stderr, "couldn't open the Session ID File\n");
+    curl_mfprintf(stderr, "couldn't open the Session ID File\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     fclose(idfile);
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     fclose(idfile);
     return TEST_ERR_MAJOR_BAD;
@@ -71,7 +71,7 @@ CURLcode test(char *URL)
   test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP);
   res = curl_easy_perform(curl);
   if(res != (int)CURLE_BAD_FUNCTION_ARGUMENT) {
-    fprintf(stderr, "This should have failed. "
+    curl_mfprintf(stderr, "This should have failed. "
             "Cannot setup without a Transport: header");
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
@@ -96,7 +96,7 @@ CURLcode test(char *URL)
       goto test_cleanup;
 
     curl_easy_getinfo(curl, CURLINFO_RTSP_SESSION_ID, &rtsp_session_id);
-    fprintf(idfile, "Got Session ID: [%s]\n", rtsp_session_id);
+    curl_mfprintf(idfile, "Got Session ID: [%s]\n", rtsp_session_id);
     rtsp_session_id = NULL;
 
     stream_uri = suburl(URL, request++);
index 49c768abd31e94e333a3079b057d0213d21b6e15..8f803b656ad9c323cf3b03f3863d3fbafd38a56e 100644 (file)
@@ -38,13 +38,13 @@ CURLcode test(char *URL)
   char *stream_uri = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -68,7 +68,7 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res != (int)CURLE_RTSP_CSEQ_ERROR) {
-    fprintf(stderr, "Failed to detect CSeq mismatch");
+    curl_mfprintf(stderr, "Failed to detect CSeq mismatch");
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -107,7 +107,7 @@ CURLcode test(char *URL)
     res = CURLE_OK;
   }
   else {
-    fprintf(stderr, "Failed to detect a Session ID mismatch");
+    curl_mfprintf(stderr, "Failed to detect a Session ID mismatch");
     res = TEST_ERR_FAILURE;
   }
 
index b7868e0a32f73d2f7d9d9a5fc05078d4b36fac4d..fe0f7e05efcbf1257e62087420a2c218496f3eb4 100644 (file)
@@ -64,10 +64,11 @@ static size_t rtp_write(char *ptr, size_t size, size_t nmemb, void *stream)
 
   message_size = curlx_uztosi(size * nmemb) - 4;
 
-  printf("RTP: message size %d, channel %d\n", message_size, channel);
+  curl_mprintf("RTP: message size %d, channel %d\n", message_size, channel);
   if(message_size != coded_size) {
-    printf("RTP embedded size (%d) does not match the write size (%d).\n",
-           coded_size, message_size);
+    curl_mprintf("RTP embedded size (%d) does not match "
+                 "the write size (%d).\n",
+                 coded_size, message_size);
     return failure;
   }
 
@@ -75,13 +76,13 @@ static size_t rtp_write(char *ptr, size_t size, size_t nmemb, void *stream)
   for(i = 0; i < message_size; i += RTP_DATA_SIZE) {
     if(message_size - i > RTP_DATA_SIZE) {
       if(memcmp(RTP_DATA, data + i, RTP_DATA_SIZE) != 0) {
-        printf("RTP PAYLOAD CORRUPTED [%s]\n", data + i);
+        curl_mprintf("RTP PAYLOAD CORRUPTED [%s]\n", data + i);
         /* return failure; */
       }
     }
     else {
       if(memcmp(RTP_DATA, data + i, message_size - i) != 0) {
-        printf("RTP PAYLOAD END CORRUPTED (%d), [%s]\n",
+        curl_mprintf("RTP PAYLOAD END CORRUPTED (%d), [%s]\n",
                message_size - i, data + i);
         /* return failure; */
       }
@@ -89,7 +90,7 @@ static size_t rtp_write(char *ptr, size_t size, size_t nmemb, void *stream)
   }
 
   rtp_packet_count++;
-  fprintf(stderr, "packet count is %d\n", rtp_packet_count);
+  curl_mfprintf(stderr, "packet count is %d\n", rtp_packet_count);
 
   return size * nmemb;
 }
@@ -109,19 +110,19 @@ CURLcode test(char *URL)
 
   FILE *protofile = fopen(libtest_arg2, "wb");
   if(!protofile) {
-    fprintf(stderr, "Couldn't open the protocol dump file\n");
+    curl_mfprintf(stderr, "Couldn't open the protocol dump file\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     fclose(protofile);
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     fclose(protofile);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -193,11 +194,11 @@ CURLcode test(char *URL)
   if(res)
     goto test_cleanup;
 
-  fprintf(stderr, "PLAY COMPLETE\n");
+  curl_mfprintf(stderr, "PLAY COMPLETE\n");
 
   /* Use Receive to get the rest of the data */
   while(!res && rtp_packet_count < 19) {
-    fprintf(stderr, "LOOPY LOOP!\n");
+    curl_mfprintf(stderr, "LOOPY LOOP!\n");
     test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_RECEIVE);
     res = curl_easy_perform(curl);
   }
index 86a0f7b33103673dd8ee1b5cd038784df5686481..5f5722113451d3a6ce0a4c0ac37258d146510da3 100644 (file)
@@ -53,13 +53,13 @@ CURLcode test(char *URL)
   struct curl_slist *custom_headers = NULL;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -99,7 +99,7 @@ CURLcode test(char *URL)
   /* PUT style GET_PARAMETERS */
   params = open(libtest_arg2, O_RDONLY);
   if(params == -1) {
-    fprintf(stderr, "can't open %s\n", libtest_arg2);
+    curl_mfprintf(stderr, "can't open %s\n", libtest_arg2);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -108,7 +108,7 @@ CURLcode test(char *URL)
 
   paramsf = fopen(libtest_arg2, "rb");
   if(!paramsf) {
-    fprintf(stderr, "can't fopen %s\n", libtest_arg2);
+    curl_mfprintf(stderr, "can't fopen %s\n", libtest_arg2);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
index 04bc9ded77c4a60bf6e47fb9e1a50fc203cc78ca..40af2212c9d4e1feb3032abcdafaa7edf088458f 100644 (file)
@@ -97,7 +97,7 @@ CURLcode test(char *URL)
 
   curl_easy_getinfo(c, CURLINFO_CONNECT_TIME, &connect_time);
   if(connect_time < dbl_epsilon) {
-    fprintf(stderr, "connect time %e is < epsilon %e\n",
+    curl_mfprintf(stderr, "connect time %e is < epsilon %e\n",
             connect_time, dbl_epsilon);
     res = TEST_ERR_MAJOR_BAD;
   }
index 0d107ef11385bdb0d2a5580115794f2bcaf8489e..4675f2d60fbba0586880244fce36b405cd01cb21 100644 (file)
@@ -31,7 +31,7 @@ static int new_fnmatch(void *ptr,
                        const char *pattern, const char *string)
 {
   (void)ptr;
-  fprintf(stderr, "lib574: match string '%s' against pattern '%s'\n",
+  curl_mfprintf(stderr, "lib574: match string '%s' against pattern '%s'\n",
           string, pattern);
   return CURL_FNMATCHFUNC_MATCH;
 }
@@ -42,13 +42,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -60,12 +60,12 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "curl_easy_perform() failed %d\n", res);
+    curl_mfprintf(stderr, "curl_easy_perform() failed %d\n", res);
     goto test_cleanup;
   }
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "curl_easy_perform() failed %d\n", res);
+    curl_mfprintf(stderr, "curl_easy_perform() failed %d\n", res);
     goto test_cleanup;
   }
 
index db5a41aad6ccc2dbbb8bc3f5992537dd1ff1a3b4..014fd896ac74123bf2712dc708e48a311493c58f 100644 (file)
@@ -38,45 +38,46 @@ long chunk_bgn(const void *f, void *ptr, int remains)
   struct chunk_data *ch_d = ptr;
   ch_d->remains = remains;
 
-  printf("=============================================================\n");
-  printf("Remains:      %d\n", remains);
-  printf("Filename:     %s\n", finfo->filename);
+  curl_mprintf("=================================="
+               "===========================\n");
+  curl_mprintf("Remains:      %d\n", remains);
+  curl_mprintf("Filename:     %s\n", finfo->filename);
   if(finfo->strings.perm) {
-    printf("Permissions:  %s", finfo->strings.perm);
+    curl_mprintf("Permissions:  %s", finfo->strings.perm);
     if(finfo->flags & CURLFINFOFLAG_KNOWN_PERM)
-      printf(" (parsed => %o)", finfo->perm);
-    printf("\n");
+      curl_mprintf(" (parsed => %o)", finfo->perm);
+    curl_mprintf("\n");
   }
-  printf("Size:         %ldB\n", (long)finfo->size);
+  curl_mprintf("Size:         %ldB\n", (long)finfo->size);
   if(finfo->strings.user)
-    printf("User:         %s\n", finfo->strings.user);
+    curl_mprintf("User:         %s\n", finfo->strings.user);
   if(finfo->strings.group)
-    printf("Group:        %s\n", finfo->strings.group);
+    curl_mprintf("Group:        %s\n", finfo->strings.group);
   if(finfo->strings.time)
-    printf("Time:         %s\n", finfo->strings.time);
-  printf("Filetype:     ");
+    curl_mprintf("Time:         %s\n", finfo->strings.time);
+  curl_mprintf("Filetype:     ");
   switch(finfo->filetype) {
   case CURLFILETYPE_FILE:
-    printf("regular file\n");
+    curl_mprintf("regular file\n");
     break;
   case CURLFILETYPE_DIRECTORY:
-    printf("directory\n");
+    curl_mprintf("directory\n");
     break;
   case CURLFILETYPE_SYMLINK:
-    printf("symlink\n");
-    printf("Target:       %s\n", finfo->strings.target);
+    curl_mprintf("symlink\n");
+    curl_mprintf("Target:       %s\n", finfo->strings.target);
     break;
   default:
-    printf("other type\n");
+    curl_mprintf("other type\n");
     break;
   }
   if(finfo->filetype == CURLFILETYPE_FILE) {
     ch_d->print_content = 1;
-    printf("Content:\n"
+    curl_mprintf("Content:\n"
       "-------------------------------------------------------------\n");
   }
   if(strcmp(finfo->filename, "someothertext.txt") == 0) {
-    printf("# THIS CONTENT WAS SKIPPED IN CHUNK_BGN CALLBACK #\n");
+    curl_mprintf("# THIS CONTENT WAS SKIPPED IN CHUNK_BGN CALLBACK #\n");
     return CURL_CHUNK_BGN_FUNC_SKIP;
   }
   return CURL_CHUNK_BGN_FUNC_OK;
@@ -88,10 +89,12 @@ long chunk_end(void *ptr)
   struct chunk_data *ch_d = ptr;
   if(ch_d->print_content) {
     ch_d->print_content = 0;
-    printf("-------------------------------------------------------------\n");
+    curl_mprintf("-------------------------------------------"
+                 "------------------\n");
   }
   if(ch_d->remains == 1)
-    printf("=============================================================\n");
+    curl_mprintf("==========================================="
+                 "==================\n");
   return CURL_CHUNK_END_FUNC_OK;
 }
 
index af42e206b8b2566cab05fa278267ea4bc6c23e11..0f4a04bcaa535ab91a0a982685d358ec3956ed33 100644 (file)
@@ -41,9 +41,9 @@ static int progress_callback(void *clientp, double dltotal, double dlnow,
 
   if(moo) {
     if((size_t)ultotal == data_size && (size_t)ulnow == data_size)
-      fprintf(moo, "PASSED, UL data matched data size\n");
+      curl_mfprintf(moo, "PASSED, UL data matched data size\n");
     else
-      fprintf(moo, "Progress callback called with UL %f out of %f\n",
+      curl_mfprintf(moo, "Progress callback called with UL %f out of %f\n",
               ulnow, ultotal);
     fclose(moo);
   }
@@ -56,13 +56,13 @@ CURLcode test(char *URL)
   CURLcode res = CURLE_OK;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 21904c1e8bf34cb12853f7242c55b53ce9b7e618..c9bde3eb7027cf93b1cb2b4587a16efdc62cf95a 100644 (file)
@@ -45,12 +45,12 @@ static size_t last_ul_total = 0;
 static void progress_final_report(void)
 {
   FILE *moo = fopen(libtest_arg2, "ab");
-  fprintf(moo ? moo : stderr, "Progress: end UL %zu/%zu\n",
+  curl_mfprintf(moo ? moo : stderr, "Progress: end UL %zu/%zu\n",
                               last_ul, last_ul_total);
   if(moo)
     fclose(moo);
   else
-    fprintf(stderr, "Progress: end UL, can't open %s\n", libtest_arg2);
+    curl_mfprintf(stderr, "Progress: end UL, can't open %s\n", libtest_arg2);
   started = FALSE;
 }
 
@@ -69,12 +69,13 @@ static int progress_callback(void *clientp, double dltotal, double dlnow,
   last_ul_total = (size_t)ultotal;
   if(!started) {
     FILE *moo = fopen(libtest_arg2, "ab");
-    fprintf(moo ? moo : stderr, "Progress: start UL %zu/%zu\n",
+    curl_mfprintf(moo ? moo : stderr, "Progress: start UL %zu/%zu\n",
                                 last_ul, last_ul_total);
     if(moo)
       fclose(moo);
     else
-      fprintf(stderr, "Progress: start UL, can't open %s\n", libtest_arg2);
+      curl_mfprintf(stderr, "Progress: start UL, can't open %s\n",
+                    libtest_arg2);
     started = TRUE;
   }
 
@@ -109,20 +110,20 @@ CURLcode test(char *URL)
   pooh.counter = 0;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
   slist = curl_slist_append(slist, "Transfer-Encoding: chunked");
   if(!slist) {
-    fprintf(stderr, "curl_slist_append() failed\n");
+    curl_mfprintf(stderr, "curl_slist_append() failed\n");
     curl_easy_cleanup(curl);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 44705c6e21bf4d8d6095b6926f59755e4b7954a9..2d2f2bcb7a23ca1f3b9018c2d06eb6cf22606048 100644 (file)
@@ -49,7 +49,7 @@ static void removeFd(struct Sockets *sockets, curl_socket_t fd, int mention)
   int i;
 
   if(mention)
-    fprintf(stderr, "Remove socket fd %d\n", (int) fd);
+    curl_mfprintf(stderr, "Remove socket fd %d\n", (int) fd);
 
   for(i = 0; i < sockets->count; ++i) {
     if(sockets->sockets[i] == fd) {
@@ -70,7 +70,7 @@ static void addFd(struct Sockets *sockets, curl_socket_t fd, const char *what)
    * To ensure we only have each file descriptor once, we remove it then add
    * it again.
    */
-  fprintf(stderr, "Add socket fd %d for %s\n", (int) fd, what);
+  curl_mfprintf(stderr, "Add socket fd %d for %s\n", (int) fd, what);
   removeFd(sockets, fd, 0);
   /*
    * Allocate array storage when required.
@@ -83,7 +83,7 @@ static void addFd(struct Sockets *sockets, curl_socket_t fd, const char *what)
   }
   else if(sockets->count >= sockets->max_count) {
     /* this can't happen in normal cases */
-    fprintf(stderr, "too many file handles error\n");
+    curl_mfprintf(stderr, "too many file handles error\n");
     exit(2);
   }
   /*
@@ -156,7 +156,7 @@ static int checkForCompletion(CURLM *curl, int *success)
         *success = 0;
     }
     else {
-      fprintf(stderr, "Got an unexpected message from curl: %i\n",
+      curl_mfprintf(stderr, "Got an unexpected message from curl: %i\n",
               (int)message->msg);
       result = 1;
       *success = 0;
@@ -206,7 +206,7 @@ static void notifyCurl(CURLM *curl, curl_socket_t s, int evBitmask,
   int numhandles = 0;
   CURLMcode result = curl_multi_socket_action(curl, s, evBitmask, &numhandles);
   if(result != CURLM_OK) {
-    fprintf(stderr, "Curl error on %s (%i) %s\n",
+    curl_mfprintf(stderr, "Curl error on %s (%i) %s\n",
             info, result, curl_multi_strerror(result));
   }
 }
@@ -243,15 +243,15 @@ CURLcode test(char *URL)
   start_test_timing();
 
   if(!libtest_arg3) {
-    fprintf(stderr, "Usage: lib582 [url] [filename] [username]\n");
+    curl_mfprintf(stderr, "Usage: lib582 [url] [filename] [username]\n");
     return TEST_ERR_USAGE;
   }
 
   hd_src = fopen(libtest_arg2, "rb");
   if(!hd_src) {
-    fprintf(stderr, "fopen() failed with error (%d) %s\n",
+    curl_mfprintf(stderr, "fopen() failed with error (%d) %s\n",
             errno, strerror(errno));
-    fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
+    curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
     return TEST_ERR_FOPEN;
   }
 
@@ -263,13 +263,13 @@ CURLcode test(char *URL)
 #endif
   if(hd == -1) {
     /* can't open file, bail out */
-    fprintf(stderr, "fstat() failed with error (%d) %s\n",
+    curl_mfprintf(stderr, "fstat() failed with error (%d) %s\n",
             errno, strerror(errno));
-    fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
+    curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
     fclose(hd_src);
     return TEST_ERR_FSTAT;
   }
-  fprintf(stderr, "Set to upload %d bytes\n", (int)file_info.st_size);
+  curl_mfprintf(stderr, "Set to upload %d bytes\n", (int)file_info.st_size);
 
   res_global_init(CURL_GLOBAL_ALL);
   if(res) {
@@ -344,7 +344,7 @@ CURLcode test(char *URL)
   }
 
   if(!success) {
-    fprintf(stderr, "Error uploading file.\n");
+    curl_mfprintf(stderr, "Error uploading file.\n");
     res = TEST_ERR_MAJOR_BAD;
   }
 
index 0ccf5c65a6fe674bdda1a1af92288d5f36d515fe..8ddcaa317213add3ae6f031cf14394a9c11228fa 100644 (file)
@@ -63,21 +63,21 @@ CURLcode test(char *URL)
   /* this tests if removing an easy handle immediately after multi
      perform has been called succeeds or not. */
 
-  fprintf(stderr, "curl_multi_perform()...\n");
+  curl_mfprintf(stderr, "curl_multi_perform()...\n");
 
   multi_perform(multiHandle, &stillRunning);
 
-  fprintf(stderr, "curl_multi_perform() succeeded\n");
+  curl_mfprintf(stderr, "curl_multi_perform() succeeded\n");
 
-  fprintf(stderr, "curl_multi_remove_handle()...\n");
+  curl_mfprintf(stderr, "curl_multi_remove_handle()...\n");
   mres = curl_multi_remove_handle(multiHandle, curl);
   if(mres) {
-    fprintf(stderr, "curl_multi_remove_handle() failed, "
+    curl_mfprintf(stderr, "curl_multi_remove_handle() failed, "
             "with code %d\n", (int)mres);
     res = TEST_ERR_MULTI;
   }
   else
-    fprintf(stderr, "curl_multi_remove_handle() succeeded\n");
+    curl_mfprintf(stderr, "curl_multi_remove_handle() succeeded\n");
 
 test_cleanup:
 
index c6d9f7d7f178dca59428623a335b7d9e8f24ade1..2712df74f7fff91f763a767b7038f86c182f073f 100644 (file)
@@ -61,10 +61,10 @@ static void test_lock(CURL *handle, curl_lock_data data,
       what = "ssl_session";
       break;
     default:
-      fprintf(stderr, "lock: no such data: %d\n", (int)data);
+      curl_mfprintf(stderr, "lock: no such data: %d\n", (int)data);
       return;
   }
-  printf("lock:   %-6s [%s]: %d\n", what, user->text, user->counter);
+  curl_mprintf("lock:   %-6s [%s]: %d\n", what, user->text, user->counter);
   user->counter++;
 }
 
@@ -88,10 +88,10 @@ static void test_unlock(CURL *handle, curl_lock_data data, void *useptr)
       what = "ssl_session";
       break;
     default:
-      fprintf(stderr, "unlock: no such data: %d\n", (int)data);
+      curl_mfprintf(stderr, "unlock: no such data: %d\n", (int)data);
       return;
   }
-  printf("unlock: %-6s [%s]: %d\n", what, user->text, user->counter);
+  curl_mprintf("unlock: %-6s [%s]: %d\n", what, user->text, user->counter);
   user->counter++;
 }
 
@@ -104,25 +104,25 @@ static void *test_fire(void *ptr)
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     return NULL;
   }
 
   curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
   curl_easy_setopt(curl, CURLOPT_VERBOSE,    1L);
   curl_easy_setopt(curl, CURLOPT_URL,        tdata->url);
-  printf("CURLOPT_SHARE\n");
+  curl_mprintf("CURLOPT_SHARE\n");
   curl_easy_setopt(curl, CURLOPT_SHARE, tdata->share);
 
-  printf("PERFORM\n");
+  curl_mprintf("PERFORM\n");
   code = curl_easy_perform(curl);
   if(code != CURLE_OK) {
     int i = 0;
-    fprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n",
+    curl_mfprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n",
             tdata->url, i, (int)code);
   }
 
-  printf("CLEANUP\n");
+  curl_mprintf("CLEANUP\n");
   curl_easy_cleanup(curl);
 
   return NULL;
@@ -143,41 +143,41 @@ CURLcode test(char *URL)
   user.text = "Pigs in space";
   user.counter = 0;
 
-  printf("GLOBAL_INIT\n");
+  curl_mprintf("GLOBAL_INIT\n");
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   /* prepare share */
-  printf("SHARE_INIT\n");
+  curl_mprintf("SHARE_INIT\n");
   share = curl_share_init();
   if(!share) {
-    fprintf(stderr, "curl_share_init() failed\n");
+    curl_mfprintf(stderr, "curl_share_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
   if(CURLSHE_OK == scode) {
-    printf("CURLSHOPT_LOCKFUNC\n");
+    curl_mprintf("CURLSHOPT_LOCKFUNC\n");
     scode = curl_share_setopt(share, CURLSHOPT_LOCKFUNC, test_lock);
   }
   if(CURLSHE_OK == scode) {
-    printf("CURLSHOPT_UNLOCKFUNC\n");
+    curl_mprintf("CURLSHOPT_UNLOCKFUNC\n");
     scode = curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, test_unlock);
   }
   if(CURLSHE_OK == scode) {
-    printf("CURLSHOPT_USERDATA\n");
+    curl_mprintf("CURLSHOPT_USERDATA\n");
     scode = curl_share_setopt(share, CURLSHOPT_USERDATA, &user);
   }
   if(CURLSHE_OK == scode) {
-    printf("CURL_LOCK_DATA_SSL_SESSION\n");
+    curl_mprintf("CURL_LOCK_DATA_SSL_SESSION\n");
     scode = curl_share_setopt(share, CURLSHOPT_SHARE,
                               CURL_LOCK_DATA_SSL_SESSION);
   }
 
   if(CURLSHE_OK != scode) {
-    fprintf(stderr, "curl_share_setopt() failed\n");
+    curl_mfprintf(stderr, "curl_share_setopt() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -192,16 +192,16 @@ CURLcode test(char *URL)
     tdata.share = share;
 
     /* simulate thread, direct call of "thread" function */
-    printf("*** run %d\n",i);
+    curl_mprintf("*** run %d\n",i);
     test_fire(&tdata);
   }
 
 
   /* fetch another one */
-  printf("*** run %d\n", i);
+  curl_mprintf("*** run %d\n", i);
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -209,37 +209,37 @@ CURLcode test(char *URL)
 
   url = URL;
   test_setopt(curl, CURLOPT_URL, url);
-  printf("CURLOPT_SHARE\n");
+  curl_mprintf("CURLOPT_SHARE\n");
   test_setopt(curl, CURLOPT_SHARE, share);
 
-  printf("PERFORM\n");
+  curl_mprintf("PERFORM\n");
   res = curl_easy_perform(curl);
 
   /* try to free share, expect to fail because share is in use */
-  printf("try SHARE_CLEANUP...\n");
+  curl_mprintf("try SHARE_CLEANUP...\n");
   scode = curl_share_cleanup(share);
   if(scode == CURLSHE_OK) {
-    fprintf(stderr, "curl_share_cleanup succeed but error expected\n");
+    curl_mfprintf(stderr, "curl_share_cleanup succeed but error expected\n");
     share = NULL;
   }
   else {
-    printf("SHARE_CLEANUP failed, correct\n");
+    curl_mprintf("SHARE_CLEANUP failed, correct\n");
   }
 
 test_cleanup:
 
   /* clean up last handle */
-  printf("CLEANUP\n");
+  curl_mprintf("CLEANUP\n");
   curl_easy_cleanup(curl);
 
   /* free share */
-  printf("SHARE_CLEANUP\n");
+  curl_mprintf("SHARE_CLEANUP\n");
   scode = curl_share_cleanup(share);
   if(scode != CURLSHE_OK)
-    fprintf(stderr, "curl_share_cleanup failed, code errno %d\n",
+    curl_mfprintf(stderr, "curl_share_cleanup failed, code errno %d\n",
             (int)scode);
 
-  printf("GLOBAL_CLEANUP\n");
+  curl_mprintf("GLOBAL_CLEANUP\n");
   curl_global_cleanup();
 
   return res;
index eb800f8574edc1da5661d96fa7af9824b7d91163..d2faa5f00dfb5653fe3d61262ca31ca173b71c30 100644 (file)
@@ -31,13 +31,13 @@ CURLcode test(char *URL)
   CURLcode res = CURLE_OK;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index f07bc9a0f5beba0147b8c3bae91c1cff4f2e90b8..caa50ffce3f7eb3ee56f190342669baed5c10c03 100644 (file)
@@ -45,13 +45,13 @@ CURLcode test(char *URL)
   long usedauth = 0;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -73,7 +73,7 @@ CURLcode test(char *URL)
 
   res = curl_easy_getinfo(curl, CURLINFO_PROXYAUTH_USED, &usedauth);
   if(CURLAUTH_NTLM != usedauth) {
-    printf("CURLINFO_PROXYAUTH_USED did not say NTLM\n");
+    curl_mprintf("CURLINFO_PROXYAUTH_USED did not say NTLM\n");
   }
 
 test_cleanup:
index ae2885d832c80e291535423be8889a4fc2239e40..ce2b855a41224bb937c9a29e8d95beb6cf83b8f5 100644 (file)
@@ -49,9 +49,9 @@ CURLcode test(char *URL)
 
   upload = fopen(libtest_arg3, "rb");
   if(!upload) {
-    fprintf(stderr, "fopen() failed with error (%d) %s\n",
+    curl_mfprintf(stderr, "fopen() failed with error (%d) %s\n",
             errno, strerror(errno));
-    fprintf(stderr, "Error opening file '%s'\n", libtest_arg3);
+    curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg3);
     return TEST_ERR_FOPEN;
   }
 
index 8c67076b495d1c50e022023803b7d401e97f2763..96d6662769c442881fe6652286b0b2a9528fb464 100644 (file)
@@ -31,13 +31,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -51,7 +51,7 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "retrieve 1 failed\n");
+    curl_mfprintf(stderr, "retrieve 1 failed\n");
     goto test_cleanup;
   }
 
@@ -63,7 +63,7 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res)
-    fprintf(stderr, "retrieve 2 failed\n");
+    curl_mfprintf(stderr, "retrieve 2 failed\n");
 
 test_cleanup:
 
index 391b9f2d54d9bd87d8ccb2f7b2f8f3a3700a9a99..11fe8fe9808e583361b24e3d68e3cadeae48ddf4 100644 (file)
@@ -34,7 +34,7 @@ static int progress_callback(void *clientp, double dltotal,
 
   if((dltotal > 0.0) && (dlnow > dltotal)) {
     /* this should not happen with test case 599 */
-    printf("%.0f > %.0f !!\n", dltotal, dlnow);
+    curl_mprintf("%.0f > %.0f !!\n", dltotal, dlnow);
     return -1;
   }
 
@@ -48,13 +48,13 @@ CURLcode test(char *URL)
   double content_length = 0.0;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -88,7 +88,7 @@ CURLcode test(char *URL)
     )
     moo = fopen(libtest_arg2, "wb");
     if(moo) {
-      fprintf(moo, "CL %.0f\n", content_length);
+      curl_mfprintf(moo, "CL %.0f\n", content_length);
       fclose(moo);
     }
   }
index d25f3ec6e0f304cfb7c317cbe11716f1192b7c02..49ab41bb12d1d2ea669c6025e2cbbe4fc25401ca 100644 (file)
@@ -77,14 +77,14 @@ static CURLcode test_once(char *URL, bool oldstyle)
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
 
   mime = curl_mime_init(curl);
   if(!mime) {
-    fprintf(stderr, "curl_mime_init() failed\n");
+    curl_mfprintf(stderr, "curl_mime_init() failed\n");
     curl_easy_cleanup(curl);
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -92,7 +92,7 @@ static CURLcode test_once(char *URL, bool oldstyle)
 
   part = curl_mime_addpart(mime);
   if(!part) {
-    fprintf(stderr, "curl_mime_addpart(1) failed\n");
+    curl_mfprintf(stderr, "curl_mime_addpart(1) failed\n");
     curl_mime_free(mime);
     curl_easy_cleanup(curl);
     curl_global_cleanup();
@@ -119,7 +119,7 @@ static CURLcode test_once(char *URL, bool oldstyle)
   }
 
   if(res)
-    printf("curl_mime_xxx(1) = %s\n", curl_easy_strerror(res));
+    curl_mprintf("curl_mime_xxx(1) = %s\n", curl_easy_strerror(res));
 
   /* Now add the same data with another name and make it not look like
      a file upload but still using the callback */
@@ -132,7 +132,7 @@ static CURLcode test_once(char *URL, bool oldstyle)
 
   part = curl_mime_addpart(mime);
   if(!part) {
-    fprintf(stderr, "curl_mime_addpart(2) failed\n");
+    curl_mfprintf(stderr, "curl_mime_addpart(2) failed\n");
     curl_mime_free(mime);
     curl_easy_cleanup(curl);
     curl_global_cleanup();
@@ -145,11 +145,11 @@ static CURLcode test_once(char *URL, bool oldstyle)
                             NULL, NULL, &pooh2);
 
   if(res)
-    printf("curl_mime_xxx(2) = %s\n", curl_easy_strerror(res));
+    curl_mprintf("curl_mime_xxx(2) = %s\n", curl_easy_strerror(res));
 
   part = curl_mime_addpart(mime);
   if(!part) {
-    fprintf(stderr, "curl_mime_addpart(3) failed\n");
+    curl_mfprintf(stderr, "curl_mime_addpart(3) failed\n");
     curl_mime_free(mime);
     curl_easy_cleanup(curl);
     curl_global_cleanup();
@@ -163,12 +163,12 @@ static CURLcode test_once(char *URL, bool oldstyle)
                          CURL_ZERO_TERMINATED);
 
   if(res)
-    printf("curl_mime_xxx(3) = %s\n", curl_easy_strerror(res));
+    curl_mprintf("curl_mime_xxx(3) = %s\n", curl_easy_strerror(res));
 
   /* Fill in a submit field too */
   part = curl_mime_addpart(mime);
   if(!part) {
-    fprintf(stderr, "curl_mime_addpart(4) failed\n");
+    curl_mfprintf(stderr, "curl_mime_addpart(4) failed\n");
     curl_mime_free(mime);
     curl_easy_cleanup(curl);
     curl_global_cleanup();
@@ -180,11 +180,11 @@ static CURLcode test_once(char *URL, bool oldstyle)
                          CURL_ZERO_TERMINATED);
 
   if(res)
-    printf("curl_mime_xxx(4) = %s\n", curl_easy_strerror(res));
+    curl_mprintf("curl_mime_xxx(4) = %s\n", curl_easy_strerror(res));
 
   part = curl_mime_addpart(mime);
   if(!part) {
-    fprintf(stderr, "curl_mime_addpart(5) failed\n");
+    curl_mfprintf(stderr, "curl_mime_addpart(5) failed\n");
     curl_mime_free(mime);
     curl_easy_cleanup(curl);
     curl_global_cleanup();
@@ -197,7 +197,7 @@ static CURLcode test_once(char *URL, bool oldstyle)
     res = curl_mime_data(part, "blah blah", 9);
 
   if(res)
-    printf("curl_mime_xxx(5) = %s\n", curl_easy_strerror(res));
+    curl_mprintf("curl_mime_xxx(5) = %s\n", curl_easy_strerror(res));
 
   /* First set the URL that is about to receive our POST. */
   test_setopt(curl, CURLOPT_URL, URL);
@@ -254,7 +254,7 @@ CURLcode test(char *URL)
   CURLcode res;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
index f0d459e663bfc05070c5386d5700464a29cd9da9..c9fae96009661d1961bd1cf04295f64915e11ab8 100644 (file)
@@ -60,7 +60,7 @@ CURLcode test(char *URL)
   long contentlength = 0;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -87,7 +87,7 @@ CURLcode test(char *URL)
                           CURLFORM_END);
   )
   if(formrc) {
-    printf("curl_formadd(1) = %d\n", (int) formrc);
+    curl_mprintf("curl_formadd(1) = %d\n", (int) formrc);
     goto test_cleanup;
   }
 
@@ -110,7 +110,7 @@ CURLcode test(char *URL)
                           CURLFORM_END);
   )
   if(formrc) {
-    printf("curl_formadd(2) = %d\n", (int) formrc);
+    curl_mprintf("curl_formadd(2) = %d\n", (int) formrc);
     goto test_cleanup;
   }
 
@@ -131,7 +131,7 @@ CURLcode test(char *URL)
                           CURLFORM_END);
   )
   if(formrc) {
-    printf("curl_formadd(3) = %d\n", (int) formrc);
+    curl_mprintf("curl_formadd(3) = %d\n", (int) formrc);
     goto test_cleanup;
   }
 
@@ -144,7 +144,7 @@ CURLcode test(char *URL)
                           CURLFORM_END);
   )
   if(formrc) {
-    printf("curl_formadd(4) = %d\n", (int) formrc);
+    curl_mprintf("curl_formadd(4) = %d\n", (int) formrc);
     goto test_cleanup;
   }
 
@@ -166,7 +166,7 @@ CURLcode test(char *URL)
                           CURLFORM_END);
   )
   if(formrc) {
-    printf("curl_formadd(5) = %d\n", (int) formrc);
+    curl_mprintf("curl_formadd(5) = %d\n", (int) formrc);
     goto test_cleanup;
   }
 
@@ -179,13 +179,13 @@ CURLcode test(char *URL)
                           CURLFORM_END);
   )
   if(formrc) {
-    printf("curl_formadd(6) = %d\n", (int) formrc);
+    curl_mprintf("curl_formadd(6) = %d\n", (int) formrc);
     goto test_cleanup;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     goto test_cleanup;
   }
 
index 7fb97def86501ac3f013c47a5c3a19e576a2b98f..c62823e7d072a0c7c0146c37ec2014b00edaa645 100644 (file)
@@ -45,7 +45,7 @@ CURLcode test(char *URL)
   testbuf[sizeof(testbuf)-1] = 0; /* null-terminate */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -57,12 +57,12 @@ CURLcode test(char *URL)
                           CURLFORM_END);
   )
   if(formrc)
-    printf("curl_formadd(1) = %d\n", (int) formrc);
+    curl_mprintf("curl_formadd(1) = %d\n", (int) formrc);
 
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     CURL_IGNORE_DEPRECATION(
       curl_formfree(formpost);
     )
index 591aa7269a31addb8d8383c9a91e399ef091805c..d6be151b18488817dbab68ce8869374b40b3514c 100644 (file)
@@ -43,13 +43,13 @@ CURLcode test(char *URL)
     memset(&testbuf[i * 10], 65 + (i % 26), 10);
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -57,41 +57,41 @@ CURLcode test(char *URL)
   /* Build mime structure. */
   mime = curl_mime_init(curl);
   if(!mime) {
-    fprintf(stderr, "curl_mime_init() failed\n");
+    curl_mfprintf(stderr, "curl_mime_init() failed\n");
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
   part = curl_mime_addpart(mime);
   if(!part) {
-    fprintf(stderr, "curl_mime_addpart() failed\n");
+    curl_mfprintf(stderr, "curl_mime_addpart() failed\n");
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
   res = curl_mime_filename(part, "myfile.jpg");
   if(res) {
-    fprintf(stderr, "curl_mime_filename() failed\n");
+    curl_mfprintf(stderr, "curl_mime_filename() failed\n");
     goto test_cleanup;
   }
   res = curl_mime_type(part, "image/jpeg");
   if(res) {
-    fprintf(stderr, "curl_mime_type() failed\n");
+    curl_mfprintf(stderr, "curl_mime_type() failed\n");
     goto test_cleanup;
   }
   res = curl_mime_data(part, testbuf, sizeof(testbuf));
   if(res) {
-    fprintf(stderr, "curl_mime_data() failed\n");
+    curl_mfprintf(stderr, "curl_mime_data() failed\n");
     goto test_cleanup;
   }
   res = curl_mime_encoder(part, "base64");
   if(res) {
-    fprintf(stderr, "curl_mime_encoder() failed\n");
+    curl_mfprintf(stderr, "curl_mime_encoder() failed\n");
     goto test_cleanup;
   }
 
   /* Prepare recipients. */
   recipients = curl_slist_append(NULL, "someone@example.com");
   if(!recipients) {
-    fprintf(stderr, "curl_slist_append() failed\n");
+    curl_mfprintf(stderr, "curl_slist_append() failed\n");
     goto test_cleanup;
   }
 
index 93c47612d707e10f2ecce65839b3c1c8800b973c..6a2daee3d9b3cd7eb0f5012da20dba16a646632f 100644 (file)
@@ -78,7 +78,7 @@ CURLcode test(char *URL)
    */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -119,7 +119,7 @@ CURLcode test(char *URL)
   /* Duplicate the handle. */
   easy2 = curl_easy_duphandle(easy);
   if(!easy2) {
-    fprintf(stderr, "curl_easy_duphandle() failed\n");
+    curl_mfprintf(stderr, "curl_easy_duphandle() failed\n");
     res = TEST_ERR_FAILURE;
     goto test_cleanup;
   }
@@ -132,7 +132,7 @@ CURLcode test(char *URL)
   /* Perform on the first handle: should not send any data. */
   res = curl_easy_perform(easy);
   if(res != CURLE_OK) {
-    fprintf(stderr, "curl_easy_perform(original) failed\n");
+    curl_mfprintf(stderr, "curl_easy_perform(original) failed\n");
     goto test_cleanup;
   }
 
@@ -140,7 +140,7 @@ CURLcode test(char *URL)
      duplicated properly, it should cause a valgrind error. */
   res = curl_easy_perform(easy2);
   if(res != CURLE_OK) {
-    fprintf(stderr, "curl_easy_perform(duplicated) failed\n");
+    curl_mfprintf(stderr, "curl_easy_perform(duplicated) failed\n");
     goto test_cleanup;
   }
 
@@ -151,7 +151,7 @@ CURLcode test(char *URL)
   easy2 = NULL;  /* Already cleaned up. */
 
   if(pooh.freecount != 2) {
-    fprintf(stderr, "free_callback() called %d times instead of 2\n",
+    curl_mfprintf(stderr, "free_callback() called %d times instead of 2\n",
             pooh.freecount);
     res = TEST_ERR_FAILURE;
     goto test_cleanup;
index 79654cb0784206815be97d27ee32dfd8427a7769..adb3313c948421388ed1cbfb4f606665dceb417a 100644 (file)
@@ -36,7 +36,7 @@ resolver_alloc_cb_fail(void *resolver_state, void *reserved, void *userdata)
 
   cb_count++;
   if(strcmp(userdata, TEST_DATA_STRING)) {
-    fprintf(stderr, "Invalid test data received");
+    curl_mfprintf(stderr, "Invalid test data received");
     exit(1);
   }
 
@@ -51,7 +51,7 @@ resolver_alloc_cb_pass(void *resolver_state, void *reserved, void *userdata)
 
   cb_count++;
   if(strcmp(userdata, TEST_DATA_STRING)) {
-    fprintf(stderr, "Invalid test data received");
+    curl_mfprintf(stderr, "Invalid test data received");
     exit(1);
   }
 
@@ -64,12 +64,12 @@ CURLcode test(char *URL)
   CURLcode res = CURLE_OK;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -83,7 +83,7 @@ CURLcode test(char *URL)
   /* this should fail */
   res = curl_easy_perform(curl);
   if(res != CURLE_COULDNT_RESOLVE_HOST) {
-    fprintf(stderr, "curl_easy_perform should have returned "
+    curl_mfprintf(stderr, "curl_easy_perform should have returned "
             "CURLE_COULDNT_RESOLVE_HOST but instead returned error %d\n", res);
     if(res == CURLE_OK)
       res = TEST_ERR_FAILURE;
@@ -95,12 +95,12 @@ CURLcode test(char *URL)
   /* this should succeed */
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "curl_easy_perform failed.\n");
+    curl_mfprintf(stderr, "curl_easy_perform failed.\n");
     goto test_cleanup;
   }
 
   if(cb_count != 2) {
-    fprintf(stderr, "Unexpected number of callbacks: %d\n", cb_count);
+    curl_mfprintf(stderr, "Unexpected number of callbacks: %d\n", cb_count);
     res = TEST_ERR_FAILURE;
     goto test_cleanup;
   }
index 59d947e23744f38364a9f38896583ee39821725f..6254d528c5154636950fe4fd4dd41294d2b54840 100644 (file)
@@ -44,13 +44,13 @@ CURLcode test(char *URL)
   urlp = curl_url();
 
   if(!urlp) {
-    fprintf(stderr, "problem init URL api.");
+    curl_mfprintf(stderr, "problem init URL api.");
     goto test_cleanup;
   }
 
   uc = curl_url_set(urlp, CURLUPART_URL, URL, 0);
   if(uc) {
-    fprintf(stderr, "problem setting CURLUPART_URL: %s.",
+    curl_mfprintf(stderr, "problem setting CURLUPART_URL: %s.",
             curl_url_strerror(uc));
     goto test_cleanup;
   }
@@ -64,8 +64,9 @@ CURLcode test(char *URL)
   res = curl_easy_perform(handle);
 
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr, "%s:%d curl_easy_perform() failed "
+                  "with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
 
index bdd879b02b7eecf9b185df423cc3d4a6fadbc1e1..c14173db43ff013a4f768de9b17bf8aeafbf0798 100644 (file)
@@ -43,7 +43,7 @@ CURLcode test(char *URL)
   urlp = curl_url();
 
   if(!urlp) {
-    fprintf(stderr, "problem init URL api.");
+    curl_mfprintf(stderr, "problem init URL api.");
     goto test_cleanup;
   }
 
@@ -51,7 +51,7 @@ CURLcode test(char *URL)
   if(curl_url_set(urlp, CURLUPART_HOST, "www.example.com", 0) ||
      curl_url_set(urlp, CURLUPART_SCHEME, "http", 0) ||
      curl_url_set(urlp, CURLUPART_PORT, "80", 0)) {
-    fprintf(stderr, "problem setting CURLUPART");
+    curl_mfprintf(stderr, "problem setting CURLUPART");
     goto test_cleanup;
   }
 
@@ -62,8 +62,9 @@ CURLcode test(char *URL)
   res = curl_easy_perform(handle);
 
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr, "%s:%d curl_easy_perform() failed "
+                  "with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
 
index 10df4988854f64feafae4c6c4431af4b1d4980de..170237671a8b8b4d51551a372a39b596ea85af04 100644 (file)
@@ -32,20 +32,20 @@ CURLcode test(char *URL)
    struct curl_slist *slist = NULL;
 
    if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-     fprintf(stderr, "curl_global_init() failed\n");
+     curl_mfprintf(stderr, "curl_global_init() failed\n");
      return TEST_ERR_MAJOR_BAD;
    }
 
    curl = curl_easy_init();
    if(!curl) {
-     fprintf(stderr, "curl_easy_init() failed\n");
+     curl_mfprintf(stderr, "curl_easy_init() failed\n");
      res = TEST_ERR_MAJOR_BAD;
      goto test_cleanup;
    }
 
    /* test: CURLFTPMETHOD_SINGLECWD with absolute path should
             skip CWD to entry path */
-   newURL = aprintf("%s/folderA/661", URL);
+   newURL = curl_maprintf("%s/folderA/661", URL);
    test_setopt(curl, CURLOPT_URL, newURL);
    test_setopt(curl, CURLOPT_VERBOSE, 1L);
    test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
@@ -55,7 +55,7 @@ CURLcode test(char *URL)
      goto test_cleanup;
 
    curl_free(newURL);
-   newURL = aprintf("%s/folderB/661", URL);
+   newURL = curl_maprintf("%s/folderB/661", URL);
    test_setopt(curl, CURLOPT_URL, newURL);
    res = curl_easy_perform(curl);
    if(res != CURLE_REMOTE_FILE_NOT_FOUND)
@@ -66,13 +66,13 @@ CURLcode test(char *URL)
    curl_easy_cleanup(curl);
    curl = curl_easy_init();
    if(!curl) {
-     fprintf(stderr, "curl_easy_init() failed\n");
+     curl_mfprintf(stderr, "curl_easy_init() failed\n");
      res = TEST_ERR_MAJOR_BAD;
      goto test_cleanup;
    }
 
    curl_free(newURL);
-   newURL = aprintf("%s/folderA/661", URL);
+   newURL = curl_maprintf("%s/folderA/661", URL);
    test_setopt(curl, CURLOPT_URL, newURL);
    test_setopt(curl, CURLOPT_VERBOSE, 1L);
    test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
@@ -83,7 +83,7 @@ CURLcode test(char *URL)
 
    /* curve ball: CWD /folderB before reusing connection with _NOCWD */
    curl_free(newURL);
-   newURL = aprintf("%s/folderB/661", URL);
+   newURL = curl_maprintf("%s/folderB/661", URL);
    test_setopt(curl, CURLOPT_URL, newURL);
    test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
    res = curl_easy_perform(curl);
@@ -91,7 +91,7 @@ CURLcode test(char *URL)
      goto test_cleanup;
 
    curl_free(newURL);
-   newURL = aprintf("%s/folderA/661", URL);
+   newURL = curl_maprintf("%s/folderA/661", URL);
    test_setopt(curl, CURLOPT_URL, newURL);
    test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
    res = curl_easy_perform(curl);
@@ -103,14 +103,14 @@ CURLcode test(char *URL)
    curl_easy_cleanup(curl);
    curl = curl_easy_init();
    if(!curl) {
-     fprintf(stderr, "curl_easy_init() failed\n");
+     curl_mfprintf(stderr, "curl_easy_init() failed\n");
      res = TEST_ERR_MAJOR_BAD;
      goto test_cleanup;
    }
 
    slist = curl_slist_append(NULL, "SYST");
    if(!slist) {
-     fprintf(stderr, "curl_slist_append() failed\n");
+     curl_mfprintf(stderr, "curl_slist_append() failed\n");
      res = TEST_ERR_MAJOR_BAD;
      goto test_cleanup;
    }
@@ -129,7 +129,7 @@ CURLcode test(char *URL)
    curl_easy_cleanup(curl);
    curl = curl_easy_init();
    if(!curl) {
-     fprintf(stderr, "curl_easy_init() failed\n");
+     curl_mfprintf(stderr, "curl_easy_init() failed\n");
      res = TEST_ERR_MAJOR_BAD;
      goto test_cleanup;
    }
@@ -158,7 +158,7 @@ CURLcode test(char *URL)
 test_cleanup:
 
    if(res)
-     fprintf(stderr, "test encountered error %d\n", res);
+     curl_mfprintf(stderr, "test encountered error %d\n", res);
    curl_slist_free_all(slist);
    curl_free(newURL);
    curl_easy_cleanup(curl);
index dd172be4ab2a95c1f6be6a7b072aa822a612b9f9..4d2df8e0f1e64e340de39f07292334b53017c3e3 100644 (file)
@@ -45,13 +45,13 @@ CURLcode test(char *URL)
       testbuf[i] = (char) (0x41 + i % 26); /* A...Z */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -59,34 +59,34 @@ CURLcode test(char *URL)
   /* Build mime structure. */
   mime = curl_mime_init(curl);
   if(!mime) {
-    fprintf(stderr, "curl_mime_init() failed\n");
+    curl_mfprintf(stderr, "curl_mime_init() failed\n");
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
   part = curl_mime_addpart(mime);
   if(!part) {
-    fprintf(stderr, "curl_mime_addpart() failed\n");
+    curl_mfprintf(stderr, "curl_mime_addpart() failed\n");
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
   res = curl_mime_name(part, "upfile");
   if(res) {
-    fprintf(stderr, "curl_mime_name() failed\n");
+    curl_mfprintf(stderr, "curl_mime_name() failed\n");
     goto test_cleanup;
   }
   res = curl_mime_filename(part, "myfile.txt");
   if(res) {
-    fprintf(stderr, "curl_mime_filename() failed\n");
+    curl_mfprintf(stderr, "curl_mime_filename() failed\n");
     goto test_cleanup;
   }
   res = curl_mime_data(part, testbuf, sizeof(testbuf));
   if(res) {
-    fprintf(stderr, "curl_mime_data() failed\n");
+    curl_mfprintf(stderr, "curl_mime_data() failed\n");
     goto test_cleanup;
   }
   res = curl_mime_encoder(part, "binary");
   if(res) {
-    fprintf(stderr, "curl_mime_encoder() failed\n");
+    curl_mfprintf(stderr, "curl_mime_encoder() failed\n");
     goto test_cleanup;
   }
 
index 3d02595ba87b2d62c4da9d58c29c7a2d6a810a69..70856fcaa870e9d9294250508ed725d11e1502f2 100644 (file)
@@ -68,7 +68,7 @@ CURLcode test(char *URL)
    */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -101,7 +101,7 @@ CURLcode test(char *URL)
   /* Send data. */
   res = curl_easy_perform(easy);
   if(res != CURLE_OK) {
-    fprintf(stderr, "curl_easy_perform() failed\n");
+    curl_mfprintf(stderr, "curl_easy_perform() failed\n");
   }
 
 test_cleanup:
index 141e0ea5716ef8309a99e178a08e48039fa043ee..ef000510b1125de1a218942968ff1f8e01a76968 100644 (file)
@@ -61,7 +61,7 @@ CURLcode test(char *URL)
    */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -105,7 +105,7 @@ CURLcode test(char *URL)
   /* Send data. */
   res = curl_easy_perform(easy);
   if(res != CURLE_OK) {
-    fprintf(stderr, "curl_easy_perform() failed\n");
+    curl_mfprintf(stderr, "curl_easy_perform() failed\n");
   }
 
 test_cleanup:
index 2a9c21f298c9349585ba1c663ae3b1855955a135..6198b9069254abd61de975fe06a3f7623c70d05a 100644 (file)
@@ -61,7 +61,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   case 3:
     return 0;
   }
-  fprintf(stderr, "Read callback called after EOF\n");
+  curl_mfprintf(stderr, "Read callback called after EOF\n");
   exit(1);
 }
 
@@ -80,7 +80,7 @@ static int xferinfo(void *clientp, curl_off_t dltotal, curl_off_t dlnow,
     time_t delta = time(NULL) - pooh->origin;
 
     if(delta >= 4 * PAUSE_TIME) {
-      fprintf(stderr, "unpausing failed: drain problem?\n");
+      curl_mfprintf(stderr, "unpausing failed: drain problem?\n");
       return CURLE_ABORTED_BY_CALLBACK;
     }
 
@@ -118,7 +118,7 @@ CURLcode test(char *URL)
    */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -141,7 +141,7 @@ CURLcode test(char *URL)
   part = curl_mime_addpart(mime);
   res = curl_mime_name(part, testname);
   if(res != CURLE_OK) {
-    fprintf(stderr,
+    curl_mfprintf(stderr,
             "Something went wrong when building the mime structure: %d\n",
             res);
     goto test_cleanup;
@@ -163,7 +163,7 @@ CURLcode test(char *URL)
                           CURLFORM_END);
   )
   if(formrc) {
-    fprintf(stderr, "curl_formadd() = %d\n", (int) formrc);
+    curl_mfprintf(stderr, "curl_formadd() = %d\n", (int) formrc);
     goto test_cleanup;
   }
 
@@ -196,7 +196,7 @@ CURLcode test(char *URL)
       time_t delta = time(NULL) - pooh.origin;
 
       if(delta >= 4 * PAUSE_TIME) {
-        fprintf(stderr, "unpausing failed: drain problem?\n");
+        curl_mfprintf(stderr, "unpausing failed: drain problem?\n");
         res = CURLE_OPERATION_TIMEDOUT;
         break;
       }
@@ -220,7 +220,7 @@ CURLcode test(char *URL)
 #endif
     rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcept, &timeout);
     if(rc == -1) {
-      fprintf(stderr, "Select error\n");
+      curl_mfprintf(stderr, "Select error\n");
       break;
     }
   }
index 39e16e0f5f3d0f65e2000c700d991842c71a89b8..2a979a223cd4747a83af2a840da8605e8a8567e8 100644 (file)
@@ -45,13 +45,13 @@ CURLcode test(char *URL)
   urlp = curl_url();
 
   if(!urlp) {
-    fprintf(stderr, "problem init URL api.");
+    curl_mfprintf(stderr, "problem init URL api.");
     goto test_cleanup;
   }
 
   uc = curl_url_set(urlp, CURLUPART_URL, URL, 0);
   if(uc) {
-    fprintf(stderr, "problem setting CURLUPART_URL: %s.",
+    curl_mfprintf(stderr, "problem setting CURLUPART_URL: %s.",
             curl_url_strerror(uc));
     goto test_cleanup;
   }
@@ -65,8 +65,9 @@ CURLcode test(char *URL)
   res = curl_easy_perform(handle);
 
   if(res) {
-    fprintf(stderr, "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-            __FILE__, __LINE__, res, curl_easy_strerror(res));
+    curl_mfprintf(stderr, "%s:%d curl_easy_perform() failed "
+                  "with code %d (%s)\n",
+                  __FILE__, __LINE__, res, curl_easy_strerror(res));
     goto test_cleanup;
   }
 
index fc292705a59f12a373ca748a882e9745d851dc59..ec2b23576ec8777af279899a1c3f3bf587503c96 100644 (file)
@@ -31,13 +31,13 @@ CURLcode test(char *URL)
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -50,7 +50,7 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res) {
-    fprintf(stderr, "retrieve 1 failed\n");
+    curl_mfprintf(stderr, "retrieve 1 failed\n");
     goto test_cleanup;
   }
 
@@ -59,7 +59,7 @@ CURLcode test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res)
-    fprintf(stderr, "retrieve 2 failed\n");
+    curl_mfprintf(stderr, "retrieve 2 failed\n");
 
 test_cleanup:
 
index ebb9f40848fc2a38ab72a7a9d4e8ed6041de2096..daabd68faebf3ff9c525edd6ad21f972f999aa57 100644 (file)
@@ -65,7 +65,7 @@ CURLcode test(char *URL)
         curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sock);
         if(sock == CURL_SOCKET_BAD)
           goto test_cleanup;
-        printf("Connected fine, extracted socket. Moving on\n");
+        curl_mprintf("Connected fine, extracted socket. Moving on\n");
       }
     }
 
@@ -88,7 +88,7 @@ CURLcode test(char *URL)
           continue;
         }
         else if(ec) {
-          fprintf(stderr, "curl_easy_send() failed, with code %d (%s)\n",
+          curl_mfprintf(stderr, "curl_easy_send() failed, with code %d (%s)\n",
                   (int)ec, curl_easy_strerror(ec));
           res = ec;
           goto test_cleanup;
@@ -109,7 +109,7 @@ CURLcode test(char *URL)
           continue;
         }
         else if(ec) {
-          fprintf(stderr, "curl_easy_recv() failed, with code %d (%s)\n",
+          curl_mfprintf(stderr, "curl_easy_recv() failed, with code %d (%s)\n",
                   (int)ec, curl_easy_strerror(ec));
           res = ec;
           goto test_cleanup;
index 3d830354a0c9e02c09d1c635b540dcb79d1dbd43..c5646502c3de8c80346313836eefddbfe709b75b 100644 (file)
@@ -73,7 +73,7 @@ static CURLcode test_cert_blob(const char *url, const char *cafile)
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     return CURLE_FAILED_INIT;
   }
 
@@ -109,7 +109,7 @@ CURLcode test(char *URL)
     if(e) {
       w = curl_easy_setopt(e, CURLOPT_CAINFO_BLOB, &blob);
       if(w)
-        printf("CURLOPT_CAINFO_BLOB is not supported\n");
+        curl_mprintf("CURLOPT_CAINFO_BLOB is not supported\n");
       curl_easy_cleanup(e);
     }
     res = w;
index 6057eaeafbc680345fc8728279dfbf568a48c96d..81c0fcc9571af2361df06fd2313cab42ca59a40a 100644 (file)
@@ -33,13 +33,13 @@ CURLcode test(char *URL)
   int count = 0;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -61,7 +61,7 @@ CURLcode test(char *URL)
     if(res)
       goto test_cleanup;
     if(CURLAUTH_NTLM != usedauth) {
-      printf("CURLINFO_HTTPAUTH_USED did not say NTLM\n");
+      curl_mprintf("CURLINFO_HTTPAUTH_USED did not say NTLM\n");
     }
 
     /* set a new URL for the second, so that we don't restart NTLM */
index b4f662c5e4619f8a3c242cd4d1f118e3134130bc..d38c5e436d8884db16080b38a69c765839cc274f 100644 (file)
@@ -47,7 +47,7 @@ CURLcode test(char *URL)
    */
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -77,7 +77,7 @@ CURLcode test(char *URL)
 
   /* Check for errors */
   if(res != CURLE_OK)
-    fprintf(stderr, "curl_easy_perform() 1 failed: %s\n",
+    curl_mfprintf(stderr, "curl_easy_perform() 1 failed: %s\n",
             curl_easy_strerror(res));
   else {
     /* phase two, create a mime struct using the mime1 handle */
@@ -91,7 +91,7 @@ CURLcode test(char *URL)
     res = curl_mime_subparts(part, mime1);
 
     if(res != CURLE_OK)
-      fprintf(stderr, "curl_mime_subparts() failed: %sn",
+      curl_mfprintf(stderr, "curl_mime_subparts() failed: %sn",
               curl_easy_strerror(res));
     else {
       mime1 = NULL;
@@ -101,7 +101,7 @@ CURLcode test(char *URL)
 
       /* Check for errors */
       if(res != CURLE_OK)
-        fprintf(stderr, "curl_easy_perform() 2 failed: %s\n",
+        curl_mfprintf(stderr, "curl_easy_perform() 2 failed: %s\n",
                 curl_easy_strerror(res));
     }
   }
index db648f35a16535c6bac3b72ee27e7434790de785..6481844699bdd89a5a686ebf60e6a5abf884bd8e 100644 (file)
@@ -36,12 +36,12 @@ static CURLcode send_request(CURL *curl, const char *url, int seq,
   size_t len = strlen(url) + 4 + 1;
   char *full_url = malloc(len);
   if(!full_url) {
-    fprintf(stderr, "Not enough memory for full url\n");
+    curl_mfprintf(stderr, "Not enough memory for full url\n");
     return CURLE_OUT_OF_MEMORY;
   }
 
-  msnprintf(full_url, len, "%s%04d", url, seq);
-  fprintf(stderr, "Sending new request %d to %s with credential %s "
+  curl_msnprintf(full_url, len, "%s%04d", url, seq);
+  curl_mfprintf(stderr, "Sending new request %d to %s with credential %s "
           "(auth %ld)\n", seq, full_url, userpwd, auth_scheme);
   test_setopt(curl, CURLOPT_URL, full_url);
   test_setopt(curl, CURLOPT_VERBOSE, 1L);
@@ -92,12 +92,12 @@ CURLcode test(char *url)
 
   if(main_auth_scheme == CURLAUTH_NONE ||
       fallback_auth_scheme == CURLAUTH_NONE) {
-    fprintf(stderr, "auth schemes not found on commandline\n");
+    curl_mfprintf(stderr, "auth schemes not found on commandline\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -105,7 +105,7 @@ CURLcode test(char *url)
 
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
@@ -123,7 +123,7 @@ CURLcode test(char *url)
   /* Send wrong password twice, then right password */
   curl = curl_easy_init();
   if(!curl) {
-    fprintf(stderr, "curl_easy_init() failed\n");
+    curl_mfprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
   }
index 9cbcb50bb55ff92a2b619d51d5e374670f21b37e..61fedc41ed738c561faf9796c323a65a17344782 100644 (file)
@@ -54,7 +54,7 @@ static size_t callback(char *ptr, size_t size, size_t nmemb, void *data)
     code = curl_easy_getinfo(ntlm_easy[idx], CURLINFO_LASTSOCKET, &longdata);
   )
   if(CURLE_OK != code) {
-    fprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
+    curl_mfprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
             "with code %d (%s)\n",
             __FILE__, __LINE__, (int)code, curl_easy_strerror(code));
     ntlmcb_res = TEST_ERR_MAJOR_BAD;
@@ -74,7 +74,7 @@ static size_t callback(char *ptr, size_t size, size_t nmemb, void *data)
     else if(sock != ntlm_sockets[idx]) {
       /* An easy handle with a socket different to previously
          tracked one, log and fail right away. Known bug #37. */
-      fprintf(stderr, "Handle %d started on socket %d and moved to %d\n",
+      curl_mfprintf(stderr, "Handle %d started on socket %d and moved to %d\n",
               curlx_sztosi(idx), (int)ntlm_sockets[idx], (int)sock);
       ntlmcb_res = TEST_ERR_MAJOR_BAD;
       return failure;
@@ -103,7 +103,7 @@ CURLcode test(char *url)
   start_test_timing();
 
   if(!full_url) {
-    fprintf(stderr, "Not enough memory for full url\n");
+    curl_mfprintf(stderr, "Not enough memory for full url\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -134,11 +134,11 @@ CURLcode test(char *url)
       easy_init(ntlm_easy[num_handles]);
 
       if(num_handles % 3 == 2) {
-        msnprintf(full_url, urllen, "%s0200", url);
+        curl_msnprintf(full_url, urllen, "%s0200", url);
         easy_setopt(ntlm_easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
       }
       else {
-        msnprintf(full_url, urllen, "%s0100", url);
+        curl_msnprintf(full_url, urllen, "%s0100", url);
         easy_setopt(ntlm_easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
       }
       easy_setopt(ntlm_easy[num_handles], CURLOPT_FRESH_CONNECT, 1L);
@@ -160,7 +160,7 @@ CURLcode test(char *url)
 
     multi_perform(multi, &running);
 
-    fprintf(stderr, "%s:%d running %d state %d\n",
+    curl_mfprintf(stderr, "%s:%d running %d state %d\n",
             __FILE__, __LINE__, running, state);
 
     abort_on_test_timeout();
@@ -178,22 +178,23 @@ CURLcode test(char *url)
 
     if(state == NeedSocketForNewHandle) {
       if(maxfd != -1 && !found_new_socket) {
-        fprintf(stderr, "Warning: socket did not open immediately for new "
-                "handle (trying again)\n");
+        curl_mfprintf(stderr,
+                      "Warning: socket did not open immediately for new "
+                      "handle (trying again)\n");
         continue;
       }
       state = num_handles < MAX_EASY_HANDLES ? ReadyForNewHandle
                                              : NoMoreHandles;
-      fprintf(stderr, "%s:%d new state %d\n",
-              __FILE__, __LINE__, state);
+      curl_mfprintf(stderr, "%s:%d new state %d\n",
+                    __FILE__, __LINE__, state);
     }
 
     multi_timeout(multi, &timeout);
 
     /* At this point, timeout is guaranteed to be greater or equal than -1. */
 
-    fprintf(stderr, "%s:%d num_handles %d timeout %ld running %d\n",
-            __FILE__, __LINE__, num_handles, timeout, running);
+    curl_mfprintf(stderr, "%s:%d num_handles %d timeout %ld running %d\n",
+                  __FILE__, __LINE__, num_handles, timeout, running);
 
     if(timeout != -1L) {
       int itimeout;
@@ -227,7 +228,7 @@ test_cleanup:
   /* proper cleanup sequence - type PB */
 
   for(i = 0; i < MAX_EASY_HANDLES; i++) {
-    printf("Data connection %d: %d\n", i, ntlm_counter[i]);
+    curl_mprintf("Data connection %d: %d\n", i, ntlm_counter[i]);
     curl_multi_remove_handle(multi, ntlm_easy[i]);
     curl_easy_cleanup(ntlm_easy[i]);
   }
index 182f4f79494b586c6c3cb266cf5db5beca96c40d..76164199e36a9b38640283de56465b7c2b29ad12 100644 (file)
@@ -37,17 +37,17 @@ static int prereq_callback(void *clientp,
   PRCS *prereq_cb = (PRCS *)clientp;
 
   if(prereq_cb->ipv6) {
-    printf("Connected to [%s]\n", conn_primary_ip);
-    printf("Connected from [%s]\n", conn_local_ip);
+    curl_mprintf("Connected to [%s]\n", conn_primary_ip);
+    curl_mprintf("Connected from [%s]\n", conn_local_ip);
   }
   else {
-    printf("Connected to %s\n", conn_primary_ip);
-    printf("Connected from %s\n", conn_local_ip);
+    curl_mprintf("Connected to %s\n", conn_primary_ip);
+    curl_mprintf("Connected from %s\n", conn_local_ip);
   }
 
-  printf("Remote port = %d\n", conn_primary_port);
-  printf("Local port = %d\n", conn_local_port);
-  printf("Returning = %d\n", prereq_cb->prereq_retcode);
+  curl_mprintf("Remote port = %d\n", conn_primary_port);
+  curl_mprintf("Local port = %d\n", conn_local_port);
+  curl_mprintf("Returning = %d\n", prereq_cb->prereq_retcode);
   return prereq_cb->prereq_retcode;
 }
 
@@ -85,8 +85,9 @@ CURLcode test(char *URL)
 
     ret = curl_easy_perform(curl);
     if(ret) {
-      fprintf(stderr, "%s:%d curl_easy_perform() failed with code %d (%s)\n",
-          __FILE__, __LINE__, ret, curl_easy_strerror(ret));
+      curl_mfprintf(stderr,
+                    "%s:%d curl_easy_perform() failed with code %d (%s)\n",
+                    __FILE__, __LINE__, ret, curl_easy_strerror(ret));
       goto test_cleanup;
     }
   }
diff --git a/tests/libtest/memptr.c b/tests/libtest/memptr.c
new file mode 100644 (file)
index 0000000..9f24103
--- /dev/null
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ * SPDX-License-Identifier: curl
+ *
+ ***************************************************************************/
+#include "test.h"
+#include "curl_memory.h"
+
+#ifndef CURL_STATICLIB
+
+#if defined(_MSC_VER) && defined(_DLL)
+#  pragma warning(push)
+#  pragma warning(disable:4232) /* MSVC extension, dllimport identity */
+#endif
+
+/* when libcurl is *not* static and we build libtests, the global pointers in
+   curl_memory.c is not available unless we provide them like this */
+
+curl_malloc_callback Curl_cmalloc = (curl_malloc_callback)malloc;
+curl_free_callback Curl_cfree = (curl_free_callback)free;
+curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc;
+curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)strdup;
+curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc;
+#if defined(_WIN32) && defined(UNICODE)
+curl_wcsdup_callback Curl_cwcsdup = wcsdup;
+#endif
+
+#if defined(_MSC_VER) && defined(_DLL)
+#  pragma warning(pop)
+#endif
+
+#endif /* !CURL_STATICLIB */
index ab024374280ba264c534ca4b9a413a30a5194a7a..46aeeefaa12a4a37835b203f8b57c0327987f102 100644 (file)
@@ -142,7 +142,7 @@ extern int unitfail;
 
 #define exe_easy_init(A,Y,Z) do {                                 \
   if(((A) = curl_easy_init()) == NULL) {                          \
-    fprintf(stderr, "%s:%d curl_easy_init() failed\n", (Y), (Z)); \
+    curl_mfprintf(stderr, "%s:%d curl_easy_init() failed\n", (Y), (Z)); \
     res = TEST_ERR_EASY_INIT;                                     \
   }                                                               \
 } while(0)
@@ -163,7 +163,7 @@ extern int unitfail;
 
 #define exe_multi_init(A,Y,Z) do {                                 \
   if(((A) = curl_multi_init()) == NULL) {                          \
-    fprintf(stderr, "%s:%d curl_multi_init() failed\n", (Y), (Z)); \
+    curl_mfprintf(stderr, "%s:%d curl_multi_init() failed\n", (Y), (Z)); \
     res = TEST_ERR_MULTI;                                          \
   }                                                                \
 } while(0)
@@ -185,7 +185,7 @@ extern int unitfail;
 #define exe_easy_setopt(A,B,C,Y,Z) do {                    \
   CURLcode ec;                                             \
   if((ec = curl_easy_setopt((A), (B), (C))) != CURLE_OK) { \
-    fprintf(stderr, "%s:%d curl_easy_setopt() failed, "    \
+    curl_mfprintf(stderr, "%s:%d curl_easy_setopt() failed, "    \
             "with code %d (%s)\n",                         \
             (Y), (Z), (int)ec, curl_easy_strerror(ec));    \
     res = ec;                                              \
@@ -209,7 +209,7 @@ extern int unitfail;
 #define exe_multi_setopt(A, B, C, Y, Z) do {                \
   CURLMcode ec;                                             \
   if((ec = curl_multi_setopt((A), (B), (C))) != CURLM_OK) { \
-    fprintf(stderr, "%s:%d curl_multi_setopt() failed, "    \
+    curl_mfprintf(stderr, "%s:%d curl_multi_setopt() failed, "    \
             "with code %d (%s)\n",                          \
             (Y), (Z), (int)ec, curl_multi_strerror(ec));    \
     res = TEST_ERR_MULTI;                                   \
@@ -233,7 +233,7 @@ extern int unitfail;
 #define exe_multi_add_handle(A,B,Y,Z) do {                   \
   CURLMcode ec;                                              \
   if((ec = curl_multi_add_handle((A), (B))) != CURLM_OK) {   \
-    fprintf(stderr, "%s:%d curl_multi_add_handle() failed, " \
+    curl_mfprintf(stderr, "%s:%d curl_multi_add_handle() failed, " \
             "with code %d (%s)\n",                           \
             (Y), (Z), (int)ec, curl_multi_strerror(ec));     \
     res = TEST_ERR_MULTI;                                    \
@@ -257,7 +257,7 @@ extern int unitfail;
 #define exe_multi_remove_handle(A,B,Y,Z) do {                   \
   CURLMcode ec;                                                 \
   if((ec = curl_multi_remove_handle((A), (B))) != CURLM_OK) {   \
-    fprintf(stderr, "%s:%d curl_multi_remove_handle() failed, " \
+    curl_mfprintf(stderr, "%s:%d curl_multi_remove_handle() failed, " \
             "with code %d (%s)\n",                              \
             (Y), (Z), (int)ec, curl_multi_strerror(ec));        \
     res = TEST_ERR_MULTI;                                       \
@@ -282,13 +282,13 @@ extern int unitfail;
 #define exe_multi_perform(A,B,Y,Z) do {                          \
   CURLMcode ec;                                                  \
   if((ec = curl_multi_perform((A), (B))) != CURLM_OK) {          \
-    fprintf(stderr, "%s:%d curl_multi_perform() failed, "        \
+    curl_mfprintf(stderr, "%s:%d curl_multi_perform() failed, "        \
             "with code %d (%s)\n",                               \
             (Y), (Z), (int)ec, curl_multi_strerror(ec));         \
     res = TEST_ERR_MULTI;                                        \
   }                                                              \
   else if(*((B)) < 0) {                                          \
-    fprintf(stderr, "%s:%d curl_multi_perform() succeeded, "     \
+    curl_mfprintf(stderr, "%s:%d curl_multi_perform() succeeded, "     \
             "but returned invalid running_handles value (%d)\n", \
             (Y), (Z), (int)*((B)));                              \
     res = TEST_ERR_NUM_HANDLES;                                  \
@@ -312,13 +312,13 @@ extern int unitfail;
 #define exe_multi_fdset(A, B, C, D, E, Y, Z) do {                    \
   CURLMcode ec;                                                      \
   if((ec = curl_multi_fdset((A), (B), (C), (D), (E))) != CURLM_OK) { \
-    fprintf(stderr, "%s:%d curl_multi_fdset() failed, "              \
+    curl_mfprintf(stderr, "%s:%d curl_multi_fdset() failed, "              \
             "with code %d (%s)\n",                                   \
             (Y), (Z), (int)ec, curl_multi_strerror(ec));             \
     res = TEST_ERR_MULTI;                                            \
   }                                                                  \
   else if(*((E)) < -1) {                                             \
-    fprintf(stderr, "%s:%d curl_multi_fdset() succeeded, "           \
+    curl_mfprintf(stderr, "%s:%d curl_multi_fdset() succeeded, "           \
             "but returned invalid max_fd value (%d)\n",              \
             (Y), (Z), (int)*((E)));                                  \
     res = TEST_ERR_NUM_HANDLES;                                      \
@@ -342,13 +342,13 @@ extern int unitfail;
 #define exe_multi_timeout(A,B,Y,Z) do {                      \
   CURLMcode ec;                                              \
   if((ec = curl_multi_timeout((A), (B))) != CURLM_OK) {      \
-    fprintf(stderr, "%s:%d curl_multi_timeout() failed, "    \
+    curl_mfprintf(stderr, "%s:%d curl_multi_timeout() failed, "    \
             "with code %d (%s)\n",                           \
             (Y), (Z), (int)ec, curl_multi_strerror(ec));     \
     res = TEST_ERR_BAD_TIMEOUT;                              \
   }                                                          \
   else if(*((B)) < -1L) {                                    \
-    fprintf(stderr, "%s:%d curl_multi_timeout() succeeded, " \
+    curl_mfprintf(stderr, "%s:%d curl_multi_timeout() succeeded, " \
             "but returned invalid timeout value (%ld)\n",    \
             (Y), (Z), (long)*((B)));                         \
     res = TEST_ERR_BAD_TIMEOUT;                              \
@@ -372,13 +372,13 @@ extern int unitfail;
 #define exe_multi_poll(A,B,C,D,E,Y,Z) do {                          \
   CURLMcode ec;                                                     \
   if((ec = curl_multi_poll((A), (B), (C), (D), (E))) != CURLM_OK) { \
-    fprintf(stderr, "%s:%d curl_multi_poll() failed, "              \
+    curl_mfprintf(stderr, "%s:%d curl_multi_poll() failed, "              \
             "with code %d (%s)\n",                                  \
             (Y), (Z), (int)ec, curl_multi_strerror(ec));            \
     res = TEST_ERR_MULTI;                                           \
   }                                                                 \
   else if(*((E)) < 0) {                                             \
-    fprintf(stderr, "%s:%d curl_multi_poll() succeeded, "           \
+    curl_mfprintf(stderr, "%s:%d curl_multi_poll() succeeded, "           \
             "but returned invalid numfds value (%d)\n",             \
             (Y), (Z), (int)*((E)));                                 \
     res = TEST_ERR_NUM_HANDLES;                                     \
@@ -402,7 +402,7 @@ extern int unitfail;
 #define exe_multi_wakeup(A,Y,Z) do {                     \
   CURLMcode ec;                                          \
   if((ec = curl_multi_wakeup((A))) != CURLM_OK) {        \
-    fprintf(stderr, "%s:%d curl_multi_wakeup() failed, " \
+    curl_mfprintf(stderr, "%s:%d curl_multi_wakeup() failed, " \
             "with code %d (%s)\n",                       \
             (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
     res = TEST_ERR_MULTI;                                \
@@ -427,7 +427,7 @@ extern int unitfail;
     int ec;                                                     \
     if(select_wrapper((A), (B), (C), (D), (E)) == -1) {         \
       ec = SOCKERRNO;                                           \
-      fprintf(stderr, "%s:%d select() failed, with "            \
+      curl_mfprintf(stderr, "%s:%d select() failed, with "            \
               "errno %d (%s)\n",                                \
               (Y), (Z), ec, strerror(ec));                      \
       res = TEST_ERR_SELECT;                                    \
@@ -455,7 +455,7 @@ extern int unitfail;
 #define exe_test_timedout(Y,Z) do {                                       \
   long timediff = tutil_tvdiff(tutil_tvnow(), tv_test_start);             \
   if(timediff > (TEST_HANG_TIMEOUT)) {                                    \
-    fprintf(stderr, "%s:%d ABORTING TEST, since it seems "                \
+    curl_mfprintf(stderr, "%s:%d ABORTING TEST, since it seems "          \
             "that it would have run forever (%ld ms > %ld ms)\n",         \
             (Y), (Z), timediff, (long) (TEST_HANG_TIMEOUT));              \
     res = TEST_ERR_RUNS_FOREVER;                                          \
@@ -479,7 +479,7 @@ extern int unitfail;
 #define exe_global_init(A,Y,Z) do {                     \
   CURLcode ec;                                          \
   if((ec = curl_global_init((A))) != CURLE_OK) {        \
-    fprintf(stderr, "%s:%d curl_global_init() failed, " \
+    curl_mfprintf(stderr, "%s:%d curl_global_init() failed, " \
             "with code %d (%s)\n",                      \
             (Y), (Z), (int)ec, curl_easy_strerror(ec)); \
     res = ec;                                           \
@@ -506,7 +506,7 @@ extern int unitfail;
   CURLcode test(char *URL)                      \
   {                                             \
     (void)URL;                                  \
-    fprintf(stderr, "Missing support\n");       \
+    curl_mfprintf(stderr, "Missing support\n");       \
     return CURLE_UNSUPPORTED_PROTOCOL;          \
   }
 #endif
@@ -524,7 +524,7 @@ extern CURLcode test(char *URL); /* the actual test function provided by each
   CURLcode test(char *URL)                      \
   {                                             \
     (void)URL;                                  \
-    fprintf(stderr, "Missing support\n");       \
+    curl_mfprintf(stderr, "Missing support\n");       \
     return CURLE_UNSUPPORTED_PROTOCOL;          \
   }
 #endif
index fd4cb5bb47b6d52528040fa97844d9949c097fce..63bd17fe343b1c2ce0872793686e09f3340a8972 100644 (file)
@@ -45,18 +45,18 @@ void libtest_debug_dump(const char *timebuf, const char *text, FILE *stream,
     /* without the hex output, we can fit more on screen */
     width = 0x40;
 
-  fprintf(stream, "%s%s, %zu bytes (0x%zx)\n", timebuf, text,
-          size, size);
+  curl_mfprintf(stream, "%s%s, %zu bytes (0x%zx)\n", timebuf, text,
+                size, size);
 
   for(i = 0; i < size; i += width) {
 
-    fprintf(stream, "%04zx: ", i);
+    curl_mfprintf(stream, "%04zx: ", i);
 
     if(!nohex) {
       /* hex not disabled, show it */
       for(c = 0; c < width; c++)
         if(i + c < size)
-          fprintf(stream, "%02x ", ptr[i + c]);
+          curl_mfprintf(stream, "%02x ", ptr[i + c]);
         else
           fputs("   ", stream);
     }
@@ -69,8 +69,9 @@ void libtest_debug_dump(const char *timebuf, const char *text, FILE *stream,
         i += (c + 2 - width);
         break;
       }
-      fprintf(stream, "%c", ((ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80)) ?
-              ptr[i + c] : '.');
+      curl_mfprintf(stream, "%c",
+                    ((ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80)) ?
+                    ptr[i + c] : '.');
       /* check again for 0D0A, to avoid an extra \n if it's at width */
       if(nohex &&
          (i + c + 2 < size) && (ptr[i + c + 1] == 0x0D) &&
@@ -108,13 +109,13 @@ int libtest_debug_cb(CURL *handle, curl_infotype type,
     }
     secs = epoch_offset + tv.tv_sec;
     now = localtime(&secs);  /* not thread safe but we don't care */
-    msnprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld ",
-              now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
+    curl_msnprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld ",
+                   now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
   }
 
   switch(type) {
   case CURLINFO_TEXT:
-    fprintf(stderr, "%s== Info: %s", timestr, (char *)data);
+    curl_mfprintf(stderr, "%s== Info: %s", timestr, (char *)data);
     return 0;
   case CURLINFO_HEADER_OUT:
     text = "=> Send header";
index 840d6ece8fe83d0c86bb40939257ce0dc9802206..8ff5c65c3a567bc3e25bb097595635112002617d 100644 (file)
@@ -50,6 +50,7 @@ foreach(_target IN LISTS SERVERPROGS)
   target_include_directories(${_target_name} PRIVATE
     "${PROJECT_BINARY_DIR}/lib"           # for "curl_config.h"
     "${PROJECT_SOURCE_DIR}/lib"           # for "curl_setup.h"
+    "${PROJECT_SOURCE_DIR}/lib/curlx"     # for curlx
     "${PROJECT_SOURCE_DIR}/src"           # for "tool_binmode.h", "tool_xattr.h"
     "${PROJECT_SOURCE_DIR}/tests/server"  # for "first.h"
   )
index cee7f81c5eb02f7412bb0c74a823ace377e29da9..a99f14c8357c5008357874a5efc45834140a5d07 100644 (file)
@@ -36,6 +36,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc
 AM_CPPFLAGS = -I$(top_srcdir)/include        \
               -I$(top_builddir)/lib          \
               -I$(top_srcdir)/lib            \
+              -I$(top_srcdir)/lib/curlx      \
               -I$(top_srcdir)/src            \
               -I$(top_srcdir)/tests/server
 
index 8a22e483b74e1b4d561ca0b1d907f9e02519c439..f678453877b06e664e51b3b8e29c07800f492310 100644 (file)
@@ -31,12 +31,12 @@ MEMDEBUG = \
 CURLX_SRCS = \
   ../../lib/mprintf.c \
   ../../lib/nonblock.c \
-  ../../lib/strparse.c \
+  ../../lib/curlx/strparse.c \
   ../../lib/strequal.c \
-  ../../lib/warnless.c \
-  ../../lib/timediff.c \
-  ../../lib/timeval.c \
-  ../../lib/dynbuf.c \
+  ../../lib/curlx/warnless.c \
+  ../../lib/curlx/timediff.c \
+  ../../lib/curlx/timeval.c \
+  ../../lib/curlx/dynbuf.c \
   ../../lib/strcase.c \
   ../../lib/strdup.c \
   ../../lib/curl_get_line.c \
@@ -44,14 +44,14 @@ CURLX_SRCS = \
   ../../lib/version_win32.c
 
 CURLX_HDRS = \
-  ../../lib/curlx.h \
+  ../../lib/curlx/curlx.h \
   ../../lib/curl_ctype.h \
   ../../lib/nonblock.h \
   ../../lib/strcase.h \
-  ../../lib/warnless.h \
-  ../../lib/timediff.h \
-  ../../lib/timeval.h \
-  ../../lib/dynbuf.h \
+  ../../lib/curlx/warnless.h \
+  ../../lib/curlx/timediff.h \
+  ../../lib/curlx/timeval.h \
+  ../../lib/curlx/dynbuf.h \
   ../../lib/strcase.h \
   ../../lib/strdup.h \
   ../../lib/curl_get_line.h \
@@ -64,8 +64,8 @@ UTIL = \
   util.c \
   util.h \
   server_setup.h \
-  ../../lib/base64.c \
-  ../../lib/curl_base64.h \
+  ../../lib/curlx/base64.c \
+  ../../lib/curlx/base64.h \
   ../../lib/strerror.c \
   ../../lib/strerror.h
 
index 514fb72e19caae6cf29b5320bbab2728092e800a..0c83dac8ba181844894796f5887b8ca1073ef98e 100644 (file)
@@ -51,7 +51,7 @@
 
 #include <ctype.h>
 
-#include "curlx.h" /* from the private lib dir */
+#include <curlx.h> /* from the private lib dir */
 #include "getpart.h"
 #include "util.h"
 #include "server_sockaddr.h"
index 7f3108f47bd9c010c32d1a8d73c19895bd682d4e..a3ea8669ddab9d69b09f1a379146494e2725964e 100644 (file)
 #include "curl/curl.h"
 #include "warnless.h"
 #else
-#include "curlx.h" /* from the private lib dir */
+#include <curlx.h> /* from the private lib dir */
 #endif
 
-#include "curl_base64.h"
 #include "curl_memory.h"
 
 #ifndef TEST
index 408e7ac927e4cd29ce70c4a638b8fe5c1cbb5464..744517077c50a5b9adf9616e36e7f7c4a5e36e61 100644 (file)
 #include <netdb.h>
 #endif
 
-#include "curlx.h" /* from the private lib dir */
+#include <curlx.h> /* from the private lib dir */
 #include "getpart.h"
 #include "server_sockaddr.h"
-#include "warnless.h"
 
 #include "tool_binmode.h"
 
index 964fe692f7fed1b53e64ac576540759620778511..71d185299a0e64a10f797a85b64ee899f1110e61 100644 (file)
@@ -48,7 +48,7 @@
 #include <netinet/tcp.h> /* for TCP_NODELAY */
 #endif
 
-#include "curlx.h" /* from the private lib dir */
+#include <curlx.h> /* from the private lib dir */
 #include "getpart.h"
 #include "util.h"
 #include "server_sockaddr.h"
@@ -431,7 +431,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
     if(got_exit_signal)
       return 1; /* done */
 
-    if((req->cl == 0) && strncasecompare("Content-Length:", line, 15)) {
+    if((req->cl == 0) && curl_strnequal("Content-Length:", line, 15)) {
       /* If we don't ignore content-length, we read it and we read the whole
          request including the body before we return. If we've been told to
          ignore the content-length, we will return as soon as all headers
@@ -451,7 +451,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
         logmsg("... but will abort after %zu bytes", req->cl);
       break;
     }
-    else if(strncasecompare("Transfer-Encoding: chunked", line,
+    else if(curl_strnequal("Transfer-Encoding: chunked", line,
                             strlen("Transfer-Encoding: chunked"))) {
       /* chunked data coming in */
       chunked = TRUE;
index 6fb8a4d18c0bbb11ad7fe0bb3b113e8d86a59bcb..7ce7e0966dc74a7c73781f5cfb702ff0cecd2f33 100644 (file)
 #include <netdb.h>
 #endif
 
-#include "curlx.h" /* from the private lib dir */
+#include <curlx.h> /* from the private lib dir */
 #include "inet_pton.h"
 #include "util.h"
 #include "server_sockaddr.h"
 #include "timediff.h"
-#include "warnless.h"
 
 #include "tool_binmode.h"
 
index 4c9edd02744503d79daad6d8ef0daadc9f12946a..cd12a3d07c4f9a273bfcb57635822c67b9573b93 100644 (file)
 #include <netdb.h>
 #endif
 
-#include "curlx.h" /* from the private lib dir */
+#include <curlx.h> /* from the private lib dir */
 #include "inet_pton.h"
 #include "util.h"
 #include "server_sockaddr.h"
-#include "warnless.h"
-
 #include "tool_binmode.h"
 
 /* include memdebug.h last */
index d4abe3cb38a8861ee3551a1b47a490fad555bf56..d7471c61072cfc30a4bfddb9028382569932ad5c 100644 (file)
@@ -49,7 +49,7 @@
 #include <netinet/tcp.h> /* for TCP_NODELAY */
 #endif
 
-#include "curlx.h" /* from the private lib dir */
+#include <curlx.h> /* from the private lib dir */
 #include "getpart.h"
 #include "inet_pton.h"
 #include "util.h"
@@ -583,7 +583,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
     if(got_exit_signal)
       return 1; /* done */
 
-    if((req->cl == 0) && strncasecompare("Content-Length:", line, 15)) {
+    if((req->cl == 0) && curl_strnequal("Content-Length:", line, 15)) {
       /* If we don't ignore content-length, we read it and we read the whole
          request including the body before we return. If we've been told to
          ignore the content-length, we will return as soon as all headers
@@ -605,13 +605,13 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
       if(req->skip)
         logmsg("... but will abort after %zu bytes", req->cl);
     }
-    else if(strncasecompare("Transfer-Encoding: chunked", line,
+    else if(curl_strnequal("Transfer-Encoding: chunked", line,
                             strlen("Transfer-Encoding: chunked"))) {
       /* chunked data coming in */
       chunked = TRUE;
     }
     else if(req->noexpect &&
-            strncasecompare("Expect: 100-continue", line,
+            curl_strnequal("Expect: 100-continue", line,
                             strlen("Expect: 100-continue"))) {
       if(req->cl)
         req->cl = 0;
index 683aafa2c2dd57a9e61b937be0136656b2ecc7d9..30f9be9efff80f51cd1782853585b2de7f6eb581 100644 (file)
@@ -83,7 +83,7 @@
 
 #include <ctype.h>
 
-#include "curlx.h" /* from the private lib dir */
+#include <curlx.h> /* from the private lib dir */
 #include "getpart.h"
 #include "util.h"
 #include "server_sockaddr.h"
index fe1315284dae7a963d5be26c8c07216341fd21f4..25f848ed29bb5e4cc21acfef4030836da444fbe0 100644 (file)
@@ -45,7 +45,7 @@
 #include "strerror.h"
 #endif
 
-#include "curlx.h" /* from the private lib dir */
+#include <curlx.h> /* from the private lib dir */
 #include "util.h"
 
 /* need init from main() */
index aac31b6256f8686ffa3ca719da2fe871b10e650b..923d11c4044626409a457adf2e4f1a3d3dfca686 100644 (file)
  ***************************************************************************/
 #include "server_setup.h"
 
+#include <curl/mprintf.h>
+
+/* make the test servers use the libcurl *printf family */
+# 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
+
 enum {
   DOCNUMBER_NOTHING    = -7,
   DOCNUMBER_QUIT       = -6,
index 2959615a9a920a13bbb1587b06ecbfd94f65b023..6d57c790725e76a89cf92e499a44bf4822ff00ee 100644 (file)
@@ -47,6 +47,7 @@ foreach(_target IN LISTS TOOLPROGS)
   target_include_directories(${_target_name} PRIVATE
     "${PROJECT_BINARY_DIR}/lib"            # for "curl_config.h"
     "${PROJECT_SOURCE_DIR}/lib"            # for "curl_setup.h"
+    "${PROJECT_SOURCE_DIR}/lib/curlx"      # for curlx
     "${PROJECT_SOURCE_DIR}/src"
     "${PROJECT_SOURCE_DIR}/tests/libtest"
     "${PROJECT_SOURCE_DIR}/tests/unit"     # for curlcheck.h
index 0a09a850a2d3fb223d7e3f6c10ac15ace048c588..92e160b2d3a3b52ddc9c940505553bc26b581adc 100644 (file)
@@ -35,6 +35,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc
 AM_CPPFLAGS = -I$(top_srcdir)/include        \
               -I$(top_builddir)/lib          \
               -I$(top_srcdir)/lib            \
+              -I$(top_srcdir)/lib/curlx      \
               -I$(top_srcdir)/src            \
               -I$(top_srcdir)/tests/libtest  \
               -I$(top_srcdir)/tests/unit     \
@@ -48,7 +49,7 @@ CFLAGS += @CURL_CFLAG_EXTRAS@
 LIBS = $(BLANK_AT_MAKETIME)
 
 LDADD = $(top_builddir)/src/libcurltool.la   \
-        $(top_builddir)/lib/libcurlu.la      \
+        $(top_builddir)/lib/libcurl.la      \
         @LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@
 
 AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS
index b606669a96c100ff395032b8e7f3a441b67ffda3..069fc768ba9b18db8ff30c2256d79d5dd56bff5d 100644 (file)
@@ -47,6 +47,7 @@ foreach(_target IN LISTS UNITPROGS)
   target_include_directories(${_target_name} PRIVATE
     "${PROJECT_BINARY_DIR}/lib"            # for "curl_config.h"
     "${PROJECT_SOURCE_DIR}/lib"            # for "curl_setup.h"
+    "${PROJECT_SOURCE_DIR}/lib/curlx"      # for curlx
     "${PROJECT_SOURCE_DIR}/src"
     "${PROJECT_SOURCE_DIR}/tests/libtest"
   )
index 006722d77031ce43c5da61ea256c1ba751e5be7d..9cf63aca139001fe31d691a95eaf61ab3dac1e3e 100644 (file)
@@ -35,6 +35,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc
 AM_CPPFLAGS = -I$(top_srcdir)/include        \
               -I$(top_builddir)/lib          \
               -I$(top_srcdir)/lib            \
+              -I$(top_srcdir)/lib/curlx      \
               -I$(top_srcdir)/src            \
               -I$(top_srcdir)/tests/libtest  \
               -I$(top_srcdir)/tests/unit
index 280b8b1b5664726dbb78bec814bd08d2c7646078..362e5e687bcaa2e21efa13e2f85acfa5756f173f 100644 (file)
 #include "test.h"
 
 /* The fail macros mark the current test step as failed, and continue */
-#define fail_if(expr, msg)                                       \
+#define fail_if(expr, msg)                                             \
+  do {                                                                 \
+    if(expr) {                                                         \
+      curl_mfprintf(stderr, "%s:%d FAILED Assertion '%s' met: %s\n",   \
+                    __FILE__, __LINE__, #expr, msg);                   \
+      unitfail++;                                                      \
+    }                                                                  \
+  } while(0)
+
+#define fail_unless(expr, msg)                                   \
   do {                                                           \
-    if(expr) {                                                   \
-      fprintf(stderr, "%s:%d FAILED Assertion '%s' met: %s\n",   \
-              __FILE__, __LINE__, #expr, msg);                   \
+    if(!(expr)) {                                                \
+      curl_mfprintf(stderr, "%s:%d Assertion '%s' FAILED: %s\n", \
+                    __FILE__, __LINE__, #expr, msg);             \
       unitfail++;                                                \
     }                                                            \
   } while(0)
 
-#define fail_unless(expr, msg)                             \
-  do {                                                     \
-    if(!(expr)) {                                          \
-      fprintf(stderr, "%s:%d Assertion '%s' FAILED: %s\n", \
-              __FILE__, __LINE__, #expr, msg);             \
-      unitfail++;                                          \
-    }                                                      \
-  } while(0)
-
 #define verify_memory(dynamic, check, len)                              \
   do {                                                                  \
     if(dynamic && memcmp(dynamic, check, len)) {                        \
-      fprintf(stderr, "%s:%d Memory buffer FAILED match size %d. "      \
-              "'%s' is not\n", __FILE__, __LINE__, len,                 \
-              hexdump((const unsigned char *)check, len));              \
-      fprintf(stderr, "%s:%d the same as '%s'\n", __FILE__, __LINE__,   \
-              hexdump((const unsigned char *)dynamic, len));            \
+      curl_mfprintf(stderr, "%s:%d Memory buffer FAILED match size %d. " \
+                    "'%s' is not\n", __FILE__, __LINE__, len,           \
+                    hexdump((const unsigned char *)check, len));        \
+      curl_mfprintf(stderr, "%s:%d the same as '%s'\n", __FILE__, __LINE__, \
+                    hexdump((const unsigned char *)dynamic, len));      \
       unitfail++;                                                       \
     }                                                                   \
   } while(0)
 
 /* fail() is for when the test case figured out by itself that a check
    proved a failure */
-#define fail(msg) do {                                                 \
-    fprintf(stderr, "%s:%d test FAILED: '%s'\n",                       \
-            __FILE__, __LINE__, msg);                                  \
-    unitfail++;                                                        \
+#define fail(msg) do {                                                  \
+    curl_mfprintf(stderr, "%s:%d test FAILED: '%s'\n",                  \
+                  __FILE__, __LINE__, msg);                             \
+    unitfail++;                                                         \
   } while(0)
 
-
 /* The abort macros mark the current test step as failed, and exit the test */
-#define abort_if(expr, msg)                                     \
-  do {                                                          \
-    if(expr) {                                                  \
-      fprintf(stderr, "%s:%d ABORT assertion '%s' met: %s\n",   \
-              __FILE__, __LINE__, #expr, msg);                  \
-      unitfail++;                                               \
-      goto unit_test_abort;                                     \
-    }                                                           \
+#define abort_if(expr, msg)                                           \
+  do {                                                                \
+    if(expr) {                                                        \
+      curl_mfprintf(stderr, "%s:%d ABORT assertion '%s' met: %s\n",   \
+                    __FILE__, __LINE__, #expr, msg);                  \
+      unitfail++;                                                     \
+      goto unit_test_abort;                                           \
+    }                                                                 \
   } while(0)
 
 #define abort_unless(expr, msg)                                         \
   do {                                                                  \
     if(!(expr)) {                                                       \
-      fprintf(stderr, "%s:%d ABORT assertion '%s' failed: %s\n",        \
-              __FILE__, __LINE__, #expr, msg);                          \
+      curl_mfprintf(stderr, "%s:%d ABORT assertion '%s' failed: %s\n",  \
+                    __FILE__, __LINE__, #expr, msg);                    \
       unitfail++;                                                       \
       goto unit_test_abort;                                             \
     }                                                                   \
   } while(0)
 
-#define unittest_abort(msg)                                   \
-  do {                                                        \
-    fprintf(stderr, "%s:%d test ABORTED: '%s'\n",             \
-            __FILE__, __LINE__, msg);                         \
-    unitfail++;                                               \
-    goto unit_test_abort;                                     \
+#define unittest_abort(msg)                                         \
+  do {                                                              \
+    curl_mfprintf(stderr, "%s:%d test ABORTED: '%s'\n",             \
+                  __FILE__, __LINE__, msg);                         \
+    unitfail++;                                                     \
+    goto unit_test_abort;                                           \
   } while(0)
 
 
index 83c58177dba2aad547b3270d03d27891f5ac0663..d0e85f634fdc0eae06329e99632654402505ff4d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "urldata.h"
 #include "url.h" /* for Curl_safefree */
-#include "curl_base64.h"
+#include "curlx/base64.h"
 #include "memdebug.h" /* LAST include file */
 
 static struct Curl_easy *testdata;
@@ -57,86 +57,86 @@ size_t size = 0;
 unsigned char anychar = 'x';
 CURLcode rc;
 
-rc = Curl_base64_encode("i", 1, &output, &size);
+rc = curlx_base64_encode("i", 1, &output, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 4, "size should be 4");
 verify_memory(output, "aQ==", 4);
 Curl_safefree(output);
 
-rc = Curl_base64_encode("ii", 2, &output, &size);
+rc = curlx_base64_encode("ii", 2, &output, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 4, "size should be 4");
 verify_memory(output, "aWk=", 4);
 Curl_safefree(output);
 
-rc = Curl_base64_encode("iii", 3, &output, &size);
+rc = curlx_base64_encode("iii", 3, &output, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 4, "size should be 4");
 verify_memory(output, "aWlp", 4);
 Curl_safefree(output);
 
-rc = Curl_base64_encode("iiii", 4, &output, &size);
+rc = curlx_base64_encode("iiii", 4, &output, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 8, "size should be 8");
 verify_memory(output, "aWlpaQ==", 8);
 Curl_safefree(output);
 
-rc = Curl_base64_encode("\xff\x01\xfe\x02", 4, &output, &size);
+rc = curlx_base64_encode("\xff\x01\xfe\x02", 4, &output, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 8, "size should be 8");
 verify_memory(output, "/wH+Ag==", 8);
 Curl_safefree(output);
 
-rc = Curl_base64url_encode("\xff\x01\xfe\x02", 4, &output, &size);
+rc = curlx_base64url_encode("\xff\x01\xfe\x02", 4, &output, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 6, "size should be 6");
 verify_memory(output, "_wH-Ag", 6);
 Curl_safefree(output);
 
-rc = Curl_base64url_encode("iiii", 4, &output, &size);
+rc = curlx_base64url_encode("iiii", 4, &output, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 6, "size should be 6");
 verify_memory(output, "aWlpaQ", 6);
 Curl_safefree(output);
 
 /* 0 length makes it do strlen() */
-rc = Curl_base64_encode("iiii", 0, &output, &size);
+rc = curlx_base64_encode("iiii", 0, &output, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 8, "size should be 8");
 verify_memory(output, "aWlpaQ==", 8);
 Curl_safefree(output);
 
-rc = Curl_base64_encode("", 0, &output, &size);
+rc = curlx_base64_encode("", 0, &output, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 0, "size should be 0");
 fail_unless(output && !output[0], "output should be a zero-length string");
 Curl_safefree(output);
 
-rc = Curl_base64url_encode("", 0, &output, &size);
+rc = curlx_base64url_encode("", 0, &output, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 0, "size should be 0");
 fail_unless(output && !output[0], "output should be a zero-length string");
 Curl_safefree(output);
 
-rc = Curl_base64_decode("aWlpaQ==", &decoded, &size);
+rc = curlx_base64_decode("aWlpaQ==", &decoded, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 4, "size should be 4");
 verify_memory(decoded, "iiii", 4);
 Curl_safefree(decoded);
 
-rc = Curl_base64_decode("aWlp", &decoded, &size);
+rc = curlx_base64_decode("aWlp", &decoded, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 3, "size should be 3");
 verify_memory(decoded, "iii", 3);
 Curl_safefree(decoded);
 
-rc = Curl_base64_decode("aWk=", &decoded, &size);
+rc = curlx_base64_decode("aWk=", &decoded, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 2, "size should be 2");
 verify_memory(decoded, "ii", 2);
 Curl_safefree(decoded);
 
-rc = Curl_base64_decode("aQ==", &decoded, &size);
+rc = curlx_base64_decode("aQ==", &decoded, &size);
 fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
 fail_unless(size == 1, "size should be 1");
 verify_memory(decoded, "i", 2);
@@ -145,7 +145,7 @@ Curl_safefree(decoded);
 /* This is illegal input as the data is too short */
 size = 1; /* not zero */
 decoded = &anychar; /* not NULL */
-rc = Curl_base64_decode("aQ", &decoded, &size);
+rc = curlx_base64_decode("aQ", &decoded, &size);
 fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
             "return code should be CURLE_BAD_CONTENT_ENCODING");
 fail_unless(size == 0, "size should be 0");
@@ -154,7 +154,7 @@ fail_if(decoded, "returned pointer should be NULL");
 /* This is illegal input as it contains three padding characters */
 size = 1; /* not zero */
 decoded = &anychar; /* not NULL */
-rc = Curl_base64_decode("a===", &decoded, &size);
+rc = curlx_base64_decode("a===", &decoded, &size);
 fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
             "return code should be CURLE_BAD_CONTENT_ENCODING");
 fail_unless(size == 0, "size should be 0");
@@ -163,7 +163,7 @@ fail_if(decoded, "returned pointer should be NULL");
 /* This is illegal input as it contains a padding character mid input */
 size = 1; /* not zero */
 decoded = &anychar; /* not NULL */
-rc = Curl_base64_decode("a=Q=", &decoded, &size);
+rc = curlx_base64_decode("a=Q=", &decoded, &size);
 fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
             "return code should be CURLE_BAD_CONTENT_ENCODING");
 fail_unless(size == 0, "size should be 0");
@@ -172,7 +172,7 @@ fail_if(decoded, "returned pointer should be NULL");
 /* This is also illegal input as it contains a padding character mid input */
 size = 1; /* not zero */
 decoded = &anychar; /* not NULL */
-rc = Curl_base64_decode("aWlpa=Q=", &decoded, &size);
+rc = curlx_base64_decode("aWlpa=Q=", &decoded, &size);
 fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
             "return code should be CURLE_BAD_CONTENT_ENCODING");
 fail_unless(size == 0, "size should be 0");
@@ -181,7 +181,7 @@ fail_if(decoded, "returned pointer should be NULL");
 /* This is garbage input as it contains an illegal base64 character */
 size = 1; /* not zero */
 decoded = &anychar; /* not NULL */
-rc = Curl_base64_decode("a\x1f==", &decoded, &size);
+rc = curlx_base64_decode("a\x1f==", &decoded, &size);
 fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
             "return code should be CURLE_BAD_CONTENT_ENCODING");
 fail_unless(size == 0, "size should be 0");
index 3c0cbabca74e5a618244a1a61e2e06afaf6d1d38..2df5f284a2271f480ebce5a7cd2b32de795054d0 100644 (file)
@@ -33,7 +33,7 @@
 #  include <arpa/inet.h>
 #endif
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "hash.h"
 #include "hostip.h"
@@ -94,7 +94,7 @@ static struct Curl_addrinfo *fake_ai(void)
 
 static CURLcode create_node(void)
 {
-  data_key = aprintf("%s:%d", "dummy", 0);
+  data_key = curl_maprintf("%s:%d", "dummy", 0);
   if(!data_key)
     return CURLE_OUT_OF_MEMORY;
 
index 2bd2f9b46546ef470c9327963f1d40b0c3107895..2cbab546d82773412df4e8e89167b7dd805e58c3 100644 (file)
@@ -99,8 +99,8 @@ UNITTEST_START
     int rem = (i + 7)%NUM_NODES;
     printf("Tree look:\n");
     splayprint(root, 0, 1);
-    printf("remove pointer %d, payload %zu\n", rem,
-           *(size_t *)Curl_splayget(&nodes[rem]));
+    curl_mprintf("remove pointer %d, payload %zu\n", rem,
+                 *(size_t *)Curl_splayget(&nodes[rem]));
     rc = Curl_splayremove(root, &nodes[rem], &root);
     if(rc) {
       /* failed! */
@@ -132,9 +132,9 @@ UNITTEST_START
     tv_now.tv_usec = i;
     root = Curl_splaygetbest(tv_now, root, &removed);
     while(removed) {
-      printf("removed payload %zu[%zu]\n",
-             *(size_t *)Curl_splayget(removed) / 10,
-             *(size_t *)Curl_splayget(removed) % 10);
+      curl_mprintf("removed payload %zu[%zu]\n",
+                   *(size_t *)Curl_splayget(removed) / 10,
+                   *(size_t *)Curl_splayget(removed) % 10);
       root = Curl_splaygetbest(tv_now, root, &removed);
     }
   }
index 46c3eb0e0002f160ca8bc08595a9e4ddb6d27122..3f5ee334bb9636eb31da793795a44aa48e7beea1 100644 (file)
@@ -52,7 +52,7 @@ UNITTEST_START
   size_t i;
 
   for(i = 0; i < CURL_ARRAYSIZE(tests); i++) {
-    timediff_t result = Curl_timediff(tests[i].first, tests[i].second);
+    timediff_t result = curlx_timediff(tests[i].first, tests[i].second);
     if(result != tests[i].result) {
       printf("%ld.%06u to %ld.%06u got %d, but expected %ld\n",
              (long)tests[i].first.tv_sec,
index b467fe6f0810e6dc64f89bd6d7ee7553cb191c23..130fc0748fcd88872ed473b95a05205a43c506a0 100644 (file)
@@ -128,21 +128,21 @@ UNITTEST_START
     abort_if(err && out, "returned error with output");
 
     if(out && pairs[i].output && strcmp(out, pairs[i].output)) {
-      fprintf(stderr, "Test %u: '%s' gave '%s' instead of '%s'\n",
-              i, pairs[i].input, out, pairs[i].output);
+      curl_mfprintf(stderr, "Test %u: '%s' gave '%s' instead of '%s'\n",
+                    i, pairs[i].input, out, pairs[i].output);
       fail("Test case output mismatched");
       fails++;
     }
     else if((!out && pairs[i].output) ||
             (out && !pairs[i].output)) {
-      fprintf(stderr, "Test %u: '%s' gave '%s' instead of '%s'\n",
-              i, pairs[i].input, out ? out : "(null)",
-              pairs[i].output ? pairs[i].output : "(null)");
+      curl_mfprintf(stderr, "Test %u: '%s' gave '%s' instead of '%s'\n",
+                    i, pairs[i].input, out ? out : "(null)",
+                    pairs[i].output ? pairs[i].output : "(null)");
       fail("Test case output mismatched");
       fails++;
     }
     else
-      fprintf(stderr, "Test %u: OK\n", i);
+      curl_mfprintf(stderr, "Test %u: OK\n", i);
     free(out);
   }
 
index bf65d9231a4d2e18e681c11ed7cbeb640b4c909f..1ac2fa9be9bc8440f5f02baa38608ad068105982 100644 (file)
@@ -103,13 +103,13 @@ UNITTEST_START
                                              strlen(tests[i].pattern),
                                              tests[i].host,
                                              strlen(tests[i].host))) {
-      fprintf(stderr,
-              "HOST: %s\n"
-              "PTRN: %s\n"
-              "did %sMATCH\n",
-              tests[i].host,
-              tests[i].pattern,
-              tests[i].match ? "NOT ": "");
+      curl_mfprintf(stderr,
+                    "HOST: %s\n"
+                    "PTRN: %s\n"
+                    "did %sMATCH\n",
+                    tests[i].host,
+                    tests[i].pattern,
+                    tests[i].match ? "NOT ": "");
       unitfail++;
     }
   }
index 6e886d45e5254e03dc2448f36b819e81b30a632d..5fb2659235a8be3e351900029a504340ccc16ca8 100644 (file)
@@ -56,16 +56,17 @@ static bool usec_matches_seconds(timediff_t time_usec, int expected_seconds)
 {
   int time_sec = (int)(time_usec / usec_magnitude);
   bool same = (time_sec == expected_seconds);
-  fprintf(stderr, "is %d us same as %d seconds? %s\n",
-          (int)time_usec, expected_seconds,
-          same ? "Yes" : "No");
+  curl_mfprintf(stderr, "is %d us same as %d seconds? %s\n",
+                (int)time_usec, expected_seconds,
+                same ? "Yes" : "No");
   return same;
 }
 
 static void expect_timer_seconds(struct Curl_easy *data, int seconds)
 {
   char msg[64];
-  msnprintf(msg, sizeof(msg), "about %d seconds should have passed", seconds);
+  curl_msnprintf(msg, sizeof(msg), "about %d seconds should have passed",
+                 seconds);
   fail_unless(usec_matches_seconds(data->progress.t_nslookup, seconds), msg);
   fail_unless(usec_matches_seconds(data->progress.t_connect, seconds), msg);
   fail_unless(usec_matches_seconds(data->progress.t_appconnect, seconds), msg);
@@ -82,7 +83,7 @@ static void expect_timer_seconds(struct Curl_easy *data, int seconds)
  * be 3 seconds. */
 UNITTEST_START
   struct Curl_easy data;
-  struct curltime now = Curl_now();
+  struct curltime now = curlx_now();
 
   data.progress.t_nslookup = 0;
   data.progress.t_connect = 0;
index 4c7b794ab8389f0ede7975285ff0e0cc9b445c9d..cc0c19384ff11ed2daecfe2c053bdede9b7da2ef 100644 (file)
  ***************************************************************************/
 #include "curlcheck.h"
 
-#include "curlx.h"
+#include <curlx.h>
 
 #include "hash.h"
 
-#include "memdebug.h" /* LAST include file */
+#include <memdebug.h> /* LAST include file */
 
 static struct Curl_hash hash_static;
 
@@ -40,7 +40,7 @@ static void mydtor(void *p)
 static CURLcode unit_setup(void)
 {
   Curl_hash_init(&hash_static, 7, Curl_hash_str,
-                 Curl_str_key_compare, mydtor);
+                 curlx_str_key_compare, mydtor);
   return CURLE_OK;
 }
 
index 46492424c565a694bf61dfec8786b24a8e8d82f7..78f7fd8fcf0b0f63ab144085d219ed4665f0d5c0 100644 (file)
  ***************************************************************************/
 #include "curlcheck.h"
 
-#include "curlx.h"
-
+#include <curlx.h>
 #include "hash.h"
-
-#include "memdebug.h" /* LAST include file */
+#include <memdebug.h> /* LAST include file */
 
 static struct Curl_hash hash_static;
 static const size_t slots = 3;
@@ -51,7 +49,7 @@ static void my_elem_dtor(void *key, size_t key_len, void *p)
 static CURLcode unit_setup(void)
 {
   Curl_hash_init(&hash_static, slots, Curl_hash_str,
-                 Curl_str_key_compare, mydtor);
+                 curlx_str_key_compare, mydtor);
   return CURLE_OK;
 }
 
@@ -76,8 +74,9 @@ UNITTEST_START
      Curl_hash_str(key2, strlen(key2), slots) != 0 ||
      Curl_hash_str(key3, strlen(key3), slots) != 2 ||
      Curl_hash_str(key4, strlen(key4), slots) != 1)
-    fprintf(stderr, "Warning: hashes are not computed as expected on this "
-            "architecture; test coverage will be less comprehensive\n");
+    curl_mfprintf(stderr,
+                  "Warning: hashes are not computed as expected on this "
+                  "architecture; test coverage will be less comprehensive\n");
 
   nodep = Curl_hash_add(&hash_static, &key1, strlen(key1), &key1);
   fail_unless(nodep, "insertion into hash failed");
index 2904b4cce4140b44cf7fffb6a103858096d87fbc..62dde130af05e26f0bc3f0be7312b689e0352f0c 100644 (file)
@@ -136,7 +136,7 @@ UNITTEST_START
 
     Curl_loadhostpairs(easy);
 
-    entry_id = (void *)aprintf("%s:%d", tests[i].host, tests[i].port);
+    entry_id = (void *)curl_maprintf("%s:%d", tests[i].host, tests[i].port);
     if(!entry_id)
       goto error;
     dns = Curl_hash_pick(&multi->dnscache.entries,
@@ -158,56 +158,60 @@ UNITTEST_START
 
       if(addr && !Curl_addr2string(addr->ai_addr, addr->ai_addrlen,
                                    ipaddress, &port)) {
-        fprintf(stderr, "%s:%d tests[%d] failed. getaddressinfo failed.\n",
-                __FILE__, __LINE__, i);
+        curl_mfprintf(stderr, "%s:%d tests[%d] failed. "
+                      "getaddressinfo failed.\n",
+                      __FILE__, __LINE__, i);
         problem = true;
         break;
       }
 
       if(addr && !tests[i].address[j]) {
-        fprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
-                "is %s but tests[%d].address[%d] is NULL.\n",
-                __FILE__, __LINE__, i, ipaddress, i, j);
+        curl_mfprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
+                      "is %s but tests[%d].address[%d] is NULL.\n",
+                      __FILE__, __LINE__, i, ipaddress, i, j);
         problem = true;
         break;
       }
 
       if(!addr && tests[i].address[j]) {
-        fprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
-                "is NULL but tests[%d].address[%d] is %s.\n",
-                __FILE__, __LINE__, i, i, j, tests[i].address[j]);
+        curl_mfprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
+                      "is NULL but tests[%d].address[%d] is %s.\n",
+                      __FILE__, __LINE__, i, i, j, tests[i].address[j]);
         problem = true;
         break;
       }
 
       if(!curl_strequal(ipaddress, tests[i].address[j])) {
-        fprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
-                "%s is not equal to tests[%d].address[%d] %s.\n",
-                __FILE__, __LINE__, i, ipaddress, i, j, tests[i].address[j]);
+        curl_mfprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
+                      "%s is not equal to tests[%d].address[%d] %s.\n",
+                      __FILE__, __LINE__, i, ipaddress, i, j,
+                      tests[i].address[j]);
         problem = true;
         break;
       }
 
       if(port != tests[i].port) {
-        fprintf(stderr, "%s:%d tests[%d] failed. the retrieved port "
-                "for tests[%d].address[%d] is %d but tests[%d].port is %d.\n",
-                __FILE__, __LINE__, i, i, j, port, i, tests[i].port);
+        curl_mfprintf(stderr, "%s:%d tests[%d] failed. the retrieved port "
+                      "for tests[%d].address[%d] is %d "
+                      "but tests[%d].port is %d.\n",
+                      __FILE__, __LINE__, i, i, j, port, i, tests[i].port);
         problem = true;
         break;
       }
 
       if(dns->timestamp && tests[i].permanent) {
-        fprintf(stderr, "%s:%d tests[%d] failed. the timestamp is not zero "
-                "but tests[%d].permanent is TRUE\n",
-                __FILE__, __LINE__, i, i);
+        curl_mfprintf(stderr,
+                      "%s:%d tests[%d] failed. the timestamp is not zero "
+                      "but tests[%d].permanent is TRUE\n",
+                      __FILE__, __LINE__, i, i);
         problem = true;
         break;
       }
 
       if(dns->timestamp == 0 && !tests[i].permanent) {
-        fprintf(stderr, "%s:%d tests[%d] failed. the timestamp is zero "
-                "but tests[%d].permanent is FALSE\n",
-                __FILE__, __LINE__, i, i);
+        curl_mfprintf(stderr, "%s:%d tests[%d] failed. the timestamp is zero "
+                      "but tests[%d].permanent is FALSE\n",
+                      __FILE__, __LINE__, i, i);
         problem = true;
         break;
       }
index 45bc3cfcd8b7f5ad0726008ecf09799483122b5a..c0b4058e26b68777932b4a835eca6b628f4db966 100644 (file)
@@ -137,7 +137,7 @@ UNITTEST_START
     if(Curl_loadhostpairs(easy))
       goto error;
 
-    entry_id = (void *)aprintf("%s:%d", tests[i].host, tests[i].port);
+    entry_id = (void *)curl_maprintf("%s:%d", tests[i].host, tests[i].port);
     if(!entry_id)
       goto error;
 
@@ -157,40 +157,43 @@ UNITTEST_START
 
       if(addr && !Curl_addr2string(addr->ai_addr, addr->ai_addrlen,
                                    ipaddress, &port)) {
-        fprintf(stderr, "%s:%d tests[%d] failed. Curl_addr2string failed.\n",
-                __FILE__, __LINE__, i);
+        curl_mfprintf(stderr,
+                      "%s:%d tests[%d] failed. Curl_addr2string failed.\n",
+                      __FILE__, __LINE__, i);
         problem = true;
         break;
       }
 
       if(addr && !tests[i].address[j]) {
-        fprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
-                "is %s but tests[%d].address[%d] is NULL.\n",
-                __FILE__, __LINE__, i, ipaddress, i, j);
+        curl_mfprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
+                      "is %s but tests[%d].address[%d] is NULL.\n",
+                      __FILE__, __LINE__, i, ipaddress, i, j);
         problem = true;
         break;
       }
 
       if(!addr && tests[i].address[j]) {
-        fprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
-                "is NULL but tests[%d].address[%d] is %s.\n",
-                __FILE__, __LINE__, i, i, j, tests[i].address[j]);
+        curl_mfprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
+                      "is NULL but tests[%d].address[%d] is %s.\n",
+                      __FILE__, __LINE__, i, i, j, tests[i].address[j]);
         problem = true;
         break;
       }
 
       if(!curl_strequal(ipaddress, tests[i].address[j])) {
-        fprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
-                "%s is not equal to tests[%d].address[%d] %s.\n",
-                __FILE__, __LINE__, i, ipaddress, i, j, tests[i].address[j]);
+        curl_mfprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
+                      "%s is not equal to tests[%d].address[%d] %s.\n",
+                      __FILE__, __LINE__, i, ipaddress, i, j,
+                      tests[i].address[j]);
         problem = true;
         break;
       }
 
       if(port != tests[i].port) {
-        fprintf(stderr, "%s:%d tests[%d] failed. the retrieved port "
-                "for tests[%d].address[%d] is %d but tests[%d].port is %d.\n",
-                __FILE__, __LINE__, i, i, j, port, i, tests[i].port);
+        curl_mfprintf(stderr, "%s:%d tests[%d] failed. the retrieved port "
+                      "for tests[%d].address[%d] is %d "
+                      "but tests[%d].port is %d.\n",
+                      __FILE__, __LINE__, i, i, j, port, i, tests[i].port);
         problem = true;
         break;
       }
index 3258fd225ef66ab8118929b8bc21b28fb8e21807..5cb96cfd9f451b0ea38ff1ed1637a3c386270d3d 100644 (file)
@@ -134,9 +134,9 @@ UNITTEST_START
   for(i = 0; list4[i].a; i++) {
     bool match = Curl_cidr4_match(list4[i].a, list4[i].n, list4[i].bits);
     if(match != list4[i].match) {
-      fprintf(stderr, "%s in %s/%u should %smatch\n",
-              list4[i].a, list4[i].n, list4[i].bits,
-              list4[i].match ? "": "not ");
+      curl_mfprintf(stderr, "%s in %s/%u should %smatch\n",
+                    list4[i].a, list4[i].n, list4[i].bits,
+                    list4[i].match ? "": "not ");
       err++;
     }
   }
@@ -144,9 +144,9 @@ UNITTEST_START
   for(i = 0; list6[i].a; i++) {
     bool match = Curl_cidr6_match(list6[i].a, list6[i].n, list6[i].bits);
     if(match != list6[i].match) {
-      fprintf(stderr, "%s in %s/%u should %smatch\n",
-              list6[i].a, list6[i].n, list6[i].bits,
-              list6[i].match ? "": "not ");
+      curl_mfprintf(stderr, "%s in %s/%u should %smatch\n",
+                    list6[i].a, list6[i].n, list6[i].bits,
+                    list6[i].match ? "": "not ");
       err++;
     }
   }
@@ -154,9 +154,9 @@ UNITTEST_START
   for(i = 0; list[i].a; i++) {
     bool match = Curl_check_noproxy(list[i].a, list[i].n);
     if(match != list[i].match) {
-      fprintf(stderr, "%s in %s should %smatch\n",
-              list[i].a, list[i].n,
-              list[i].match ? "": "not ");
+      curl_mfprintf(stderr, "%s in %s should %smatch\n",
+                    list[i].a, list[i].n,
+                    list[i].match ? "": "not ");
       err++;
     }
   }
index 3fe0c0c20dc688c00f29eb3441411208cde95ddb..20067c67e97938838111e654e7deee34fb539289 100644 (file)
  ***************************************************************************/
 #include "curlcheck.h"
 
-#include "curlx.h"
-
-#include "uint-hash.h"
-
-#include "memdebug.h" /* LAST include file */
+#include <curlx.h>
+#include <uint-hash.h>
+#include <memdebug.h> /* LAST include file */
 
 static struct uint_hash hash_static;
 
index 93ebc590d3fca0edb4f2619b62b5b13dbe95125c..53b44c00bc5e550e967e0e2d2134642447359874 100644 (file)
@@ -164,20 +164,20 @@ UNITTEST_START
     DOHcode rc = doh_req_encode(req[i].name, req[i].type,
                                 buffer, sizeof(buffer), &size);
     if(rc != req[i].rc) {
-      fprintf(stderr, "req %zu: Expected return code %d got %d\n", i,
-              req[i].rc, rc);
+      curl_mfprintf(stderr, "req %zu: Expected return code %d got %d\n", i,
+                    req[i].rc, rc);
       abort_if(rc != req[i].rc, "return code");
     }
     if(size != req[i].size) {
-      fprintf(stderr, "req %zu: Expected size %zu got %zu\n", i,
-              req[i].size, size);
-      fprintf(stderr, "DNS encode made: %s\n", hexdump(buffer, size));
+      curl_mfprintf(stderr, "req %zu: Expected size %zu got %zu\n", i,
+                    req[i].size, size);
+      curl_mfprintf(stderr, "DNS encode made: %s\n", hexdump(buffer, size));
       abort_if(size != req[i].size, "size");
     }
     if(req[i].packet && memcmp(req[i].packet, buffer, size)) {
-      fprintf(stderr, "DNS encode made: %s\n", hexdump(buffer, size));
-      fprintf(stderr, "... instead of: %s\n",
-             hexdump((const unsigned char *)req[i].packet, size));
+      curl_mfprintf(stderr, "DNS encode made: %s\n", hexdump(buffer, size));
+      curl_mfprintf(stderr, "... instead of: %s\n",
+                    hexdump((const unsigned char *)req[i].packet, size));
       abort_if(req[i].packet && memcmp(req[i].packet, buffer, size),
                "contents");
     }
@@ -193,8 +193,8 @@ UNITTEST_START
     rc = doh_resp_decode((const unsigned char *)resp[i].packet, resp[i].size,
                          resp[i].type, &d);
     if(rc != resp[i].rc) {
-      fprintf(stderr, "resp %zu: Expected return code %d got %d\n", i,
-              resp[i].rc, rc);
+      curl_mfprintf(stderr, "resp %zu: Expected return code %d got %d\n", i,
+                    resp[i].rc, rc);
       abort_if(rc != resp[i].rc, "return code");
     }
     len = sizeof(buffer);
@@ -205,7 +205,7 @@ UNITTEST_START
       a = &d.addr[u];
       if(resp[i].type == DNS_TYPE_A) {
         p = &a->ip.v4[0];
-        msnprintf(ptr, len, "%u.%u.%u.%u ", p[0], p[1], p[2], p[3]);
+        curl_msnprintf(ptr, len, "%u.%u.%u.%u ", p[0], p[1], p[2], p[3]);
         o = strlen(ptr);
         len -= o;
         ptr += o;
@@ -214,28 +214,28 @@ UNITTEST_START
         int j;
         for(j = 0; j < 16; j += 2) {
           size_t l;
-          msnprintf(ptr, len, "%s%02x%02x", j?":":"", a->ip.v6[j],
-                   a->ip.v6[j + 1]);
+          curl_msnprintf(ptr, len, "%s%02x%02x", j?":":"", a->ip.v6[j],
+                         a->ip.v6[j + 1]);
           l = strlen(ptr);
           len -= l;
           ptr += l;
         }
-        msnprintf(ptr, len, " ");
+        curl_msnprintf(ptr, len, " ");
         len--;
         ptr++;
       }
     }
     for(u = 0; u < d.numcname; u++) {
       size_t o;
-      msnprintf(ptr, len, "%s ", Curl_dyn_ptr(&d.cname[u]));
+      curl_msnprintf(ptr, len, "%s ", curlx_dyn_ptr(&d.cname[u]));
       o = strlen(ptr);
       len -= o;
       ptr += o;
     }
     de_cleanup(&d);
     if(resp[i].out && strcmp((char *)buffer, resp[i].out)) {
-      fprintf(stderr, "resp %zu: Expected %s got %s\n", i,
-              resp[i].out, buffer);
+      curl_mfprintf(stderr, "resp %zu: Expected %s got %s\n", i,
+                    resp[i].out, buffer);
       abort_if(resp[i].out && strcmp((char *)buffer, resp[i].out), "content");
     }
   }
@@ -248,7 +248,7 @@ UNITTEST_START
     rc = doh_resp_decode((const unsigned char *)full49, i, DNS_TYPE_A, &d);
     if(!rc) {
       /* none of them should work */
-      fprintf(stderr, "%zu: %d\n", i, rc);
+      curl_mfprintf(stderr, "%zu: %d\n", i, rc);
       abort_if(!rc, "error rc");
     }
   }
@@ -262,7 +262,7 @@ UNITTEST_START
                          DNS_TYPE_A, &d);
     if(!rc) {
       /* none of them should work */
-      fprintf(stderr, "2 %zu: %d\n", i, rc);
+      curl_mfprintf(stderr, "2 %zu: %d\n", i, rc);
       abort_if(!rc, "error rc");
     }
   }
@@ -277,10 +277,10 @@ UNITTEST_START
     fail_if(d.numaddr != 1, "missing address");
     a = &d.addr[0];
     p = &a->ip.v4[0];
-    msnprintf((char *)buffer, sizeof(buffer),
-              "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
+    curl_msnprintf((char *)buffer, sizeof(buffer),
+                   "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
     if(rc || strcmp((char *)buffer, "127.0.0.1")) {
-      fprintf(stderr, "bad address decoded: %s, rc == %d\n", buffer, rc);
+      curl_mfprintf(stderr, "bad address decoded: %s, rc == %d\n", buffer, rc);
       abort_if(rc || strcmp((char *)buffer, "127.0.0.1"), "bad address");
     }
     fail_if(d.numcname, "bad cname counter");
index 63f3393947a7d1354e23c5aa489b0fab3108d11a..56c37e97fbd9d175a045f3d8e61f9c2bb62c2193 100644 (file)
@@ -354,7 +354,7 @@ UNITTEST_START
   int byte;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
index 6a292cc96c0feb74a3a994b6081e9e45fdc69950..c8cd06dacf1cba0f7941dceecc30c7f06ba9acd1 100644 (file)
@@ -102,7 +102,7 @@ UNITTEST_START
 #endif
 
 /* Injecting a simple short string via a format */
-msnprintf(input, sizeof(input), "Simple Test");
+curl_msnprintf(input, sizeof(input), "Simple Test");
 Curl_infof(testdata, "%s", input);
 fail_unless(verify(output, input) == 0, "Simple string test");
 
index d543fb0276398f063b79d970a5db8c812b7c3275..ae10e8bb9068659689057c7ce18c3b7735d2bb63 100644 (file)
@@ -49,11 +49,11 @@ static CURLUcode parse_port(CURLU *url,
 {
   struct dynbuf host;
   CURLUcode ret;
-  Curl_dyn_init(&host, 10000);
-  if(Curl_dyn_add(&host, h))
+  curlx_dyn_init(&host, 10000);
+  if(curlx_dyn_add(&host, h))
     return CURLUE_OUT_OF_MEMORY;
   ret = Curl_parse_port(url, &host, has_scheme);
-  Curl_dyn_free(&host);
+  curlx_dyn_free(&host);
   return ret;
 }
 
index 0762d4ea8d22f3881bbd172a5c45ebfc6698f090..73bf17a0c61ffd3dc378eca6f897220d9d55cbf1 100644 (file)
@@ -58,7 +58,7 @@ UNITTEST_START
     goto fail;
   }
   fail_unless(Curl_llist_count(&asi->list) == 4, "wrong number of entries");
-  msnprintf(outname, sizeof(outname), "%s-out", arg);
+  curl_msnprintf(outname, sizeof(outname), "%s-out", arg);
 
   result = Curl_altsvc_parse(curl, asi, "h2=\"example.com:8080\"\r\n",
                              ALPN_h1, "example.org", 8080);
index 22836224bcdb22083773866d0f9ebc84b7f85251..5b817e9d84062f7356db9c740bfb61ea0678f58a 100644 (file)
@@ -78,16 +78,17 @@ static bool do_test(struct test_spec *spec, size_t i, struct dynbuf *dbuf)
   CURLcode result;
   const char *in = spec->input;
 
-  Curl_dyn_reset(dbuf);
+  curlx_dyn_reset(dbuf);
   result = Curl_x509_GTime2str(dbuf, in, in + strlen(in));
   if(result != spec->exp_result) {
-    fprintf(stderr, "test %zu: expect result %d, got %d\n",
-            i, spec->exp_result, result);
+    curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
+                  i, spec->exp_result, result);
     return FALSE;
   }
-  else if(!result && strcmp(spec->exp_output, Curl_dyn_ptr(dbuf))) {
-    fprintf(stderr, "test %zu: input '%s', expected output '%s', got '%s'\n",
-            i, in, spec->exp_output, Curl_dyn_ptr(dbuf));
+  else if(!result && strcmp(spec->exp_output, curlx_dyn_ptr(dbuf))) {
+    curl_mfprintf(stderr,
+                  "test %zu: input '%s', expected output '%s', got '%s'\n",
+                  i, in, spec->exp_output, curlx_dyn_ptr(dbuf));
     return FALSE;
   }
 
@@ -100,10 +101,10 @@ UNITTEST_START
   struct dynbuf dbuf;
   bool all_ok = TRUE;
 
-  Curl_dyn_init(&dbuf, 32*1024);
+  curlx_dyn_init(&dbuf, 32*1024);
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -113,7 +114,7 @@ UNITTEST_START
   }
   fail_unless(all_ok, "some tests of Curl_x509_GTime2str() fails");
 
-  Curl_dyn_free(&dbuf);
+  curlx_dyn_free(&dbuf);
   curl_global_cleanup();
 }
 UNITTEST_STOP
index d5062cda77e1e5a1f368ec8cb0259e3c124b400c..6c4bebdde1c17fe296bab08341e3292def6d7a1a 100644 (file)
@@ -52,12 +52,12 @@ static CURLcode make1657_nested(struct test1657_spec *spec, struct dynbuf *buf)
   unsigned char close_undef[] = { 0x00,  0x00 };
 
   for(i = 0; i < spec->n; ++i) {
-    r = Curl_dyn_addn(buf, open_undef, sizeof(open_undef));
+    r = curlx_dyn_addn(buf, open_undef, sizeof(open_undef));
     if(r)
       return r;
   }
   for(i = 0; i < spec->n; ++i) {
-    r = Curl_dyn_addn(buf, close_undef, sizeof(close_undef));
+    r = curlx_dyn_addn(buf, close_undef, sizeof(close_undef));
     if(r)
       return r;
   }
@@ -79,17 +79,17 @@ static bool do_test1657(struct test1657_spec *spec, size_t i,
   const char *in;
 
   memset(&elem, 0, sizeof(elem));
-  Curl_dyn_reset(buf);
+  curlx_dyn_reset(buf);
   result = spec->setbuf(spec, buf);
   if(result) {
-    fprintf(stderr, "test %zu: error setting buf %d\n", i, result);
+    curl_mfprintf(stderr, "test %zu: error setting buf %d\n", i, result);
     return FALSE;
   }
-  in = Curl_dyn_ptr(buf);
-  result = Curl_x509_getASN1Element(&elem, in, in + Curl_dyn_len(buf));
+  in = curlx_dyn_ptr(buf);
+  result = Curl_x509_getASN1Element(&elem, in, in + curlx_dyn_len(buf));
   if(result != spec->exp_result) {
-    fprintf(stderr, "test %zu: expect result %d, got %d\n",
-            i, spec->exp_result, result);
+    curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
+                  i, spec->exp_result, result);
     return FALSE;
   }
   return TRUE;
@@ -101,10 +101,10 @@ UNITTEST_START
   bool all_ok = TRUE;
   struct dynbuf dbuf;
 
-  Curl_dyn_init(&dbuf, 32*1024);
+  curlx_dyn_init(&dbuf, 32*1024);
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
-    fprintf(stderr, "curl_global_init() failed\n");
+    curl_mfprintf(stderr, "curl_global_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -114,7 +114,7 @@ UNITTEST_START
   }
   fail_unless(all_ok, "some tests of Curl_x509_getASN1Element() fails");
 
-  Curl_dyn_free(&dbuf);
+  curlx_dyn_free(&dbuf);
   curl_global_cleanup();
 }
 UNITTEST_STOP
index c6f28b2c84a85757742b35c44884ec1df5d55e30..01e8c6b50c919ddba1445712304afc5b0aa1e4ea 100644 (file)
@@ -65,62 +65,62 @@ static void rrresults(struct Curl_https_rrinfo *rr, CURLcode result)
 {
   char *p = rrbuffer;
   char *pend = rrbuffer + sizeof(rrbuffer);
-  msnprintf(rrbuffer, sizeof(rrbuffer), "r:%d|", (int)result);
+  curl_msnprintf(rrbuffer, sizeof(rrbuffer), "r:%d|", (int)result);
   p += strlen(rrbuffer);
 
   if(rr) {
     unsigned int i;
-    msnprintf(p, pend - p, "p:%d|", rr->priority);
+    curl_msnprintf(p, pend - p, "p:%d|", rr->priority);
     p += strlen(p);
 
-    msnprintf(p, pend - p, "%s|", rr->target ? rr->target : "-");
+    curl_msnprintf(p, pend - p, "%s|", rr->target ? rr->target : "-");
     p += strlen(p);
 
     for(i = 0; i < MAX_HTTPSRR_ALPNS && rr->alpns[i] != ALPN_none; i++) {
-      msnprintf(p, pend - p, "alpn:%x|", rr->alpns[i]);
+      curl_msnprintf(p, pend - p, "alpn:%x|", rr->alpns[i]);
       p += strlen(p);
     }
     if(rr->no_def_alpn) {
-      msnprintf(p, pend - p, "no-def-alpn|");
+      curl_msnprintf(p, pend - p, "no-def-alpn|");
       p += strlen(p);
     }
     if(rr->port >= 0) {
-      msnprintf(p, pend - p, "port:%d|", rr->port);
+      curl_msnprintf(p, pend - p, "port:%d|", rr->port);
       p += strlen(p);
     }
     if(rr->ipv4hints) {
       for(i = 0; i < rr->ipv4hints_len; i += 4) {
-        msnprintf(p, pend - p, "ipv4:%d.%d.%d.%d|",
-                  rr->ipv4hints[i],
-                  rr->ipv4hints[i + 1],
-                  rr->ipv4hints[i + 2],
-                  rr->ipv4hints[i + 3]);
+        curl_msnprintf(p, pend - p, "ipv4:%d.%d.%d.%d|",
+                       rr->ipv4hints[i],
+                       rr->ipv4hints[i + 1],
+                       rr->ipv4hints[i + 2],
+                       rr->ipv4hints[i + 3]);
         p += strlen(p);
       }
     }
     if(rr->echconfiglist) {
-      msnprintf(p, pend - p, "ech:");
+      curl_msnprintf(p, pend - p, "ech:");
       p += strlen(p);
       for(i = 0; i < rr->echconfiglist_len; i++) {
-        msnprintf(p, pend - p, "%02x", rr->echconfiglist[i]);
+        curl_msnprintf(p, pend - p, "%02x", rr->echconfiglist[i]);
         p += strlen(p);
       }
-      msnprintf(p, pend - p, "|");
+      curl_msnprintf(p, pend - p, "|");
       p += strlen(p);
     }
     if(rr->ipv6hints) {
       for(i = 0; i < rr->ipv6hints_len; i += 16) {
         int x;
-        msnprintf(p, pend - p, "ipv6:");
+        curl_msnprintf(p, pend - p, "ipv6:");
         p += strlen(p);
         for(x = 0; x < 16; x += 2) {
-          msnprintf(p, pend - p, "%s%02x%02x",
-                    x ? ":" : "",
-                    rr->ipv6hints[i + x],
-                    rr->ipv6hints[i + x + 1]);
+          curl_msnprintf(p, pend - p, "%s%02x%02x",
+                         x ? ":" : "",
+                         rr->ipv6hints[i + x],
+                         rr->ipv6hints[i + x + 1]);
           p += strlen(p);
         }
-        msnprintf(p, pend - p, "|");
+        curl_msnprintf(p, pend - p, "|");
         p += strlen(p);
       }
     }
@@ -527,9 +527,9 @@ UNITTEST_START
 
       /* is the output the expected? */
       if(strcmp(rrbuffer, t[i].expect)) {
-        fprintf(stderr, "Test %s (%i) failed\n"
-                "Expected: %s\n"
-                "Received: %s\n", t[i].name, i, t[i].expect, rrbuffer);
+        curl_mfprintf(stderr, "Test %s (%i) failed\n"
+                      "Expected: %s\n"
+                      "Received: %s\n", t[i].name, i, t[i].expect, rrbuffer);
         unitfail++;
       }
 
index 5ae8d0e9a7f4494aea9c1bfea086b5ff836691f8..04aba1e7f5baa38d3ee9a79f87faf80d0f2a5620 100644 (file)
@@ -111,9 +111,9 @@ static void showsts(struct stsentry *e, const char *chost)
   if(!e)
     printf("'%s' is not HSTS\n", chost);
   else {
-    printf("%s [%s]: %" CURL_FORMAT_CURL_OFF_T "%s\n",
-           chost, e->host, e->expires,
-           e->includeSubDomains ? " includeSubDomains" : "");
+    curl_mprintf("%s [%s]: %" CURL_FORMAT_CURL_OFF_T "%s\n",
+                 chost, e->host, e->expires,
+                 e->includeSubDomains ? " includeSubDomains" : "");
   }
 }
 
@@ -144,8 +144,8 @@ UNITTEST_START
       result = Curl_hsts_parse(h, headers[i].host, headers[i].hdr);
 
       if(result != headers[i].result) {
-        fprintf(stderr, "Curl_hsts_parse(%s) failed: %d\n",
-                headers[i].hdr, result);
+        curl_mfprintf(stderr, "Curl_hsts_parse(%s) failed: %d\n",
+                      headers[i].hdr, result);
         unitfail++;
         continue;
       }
@@ -160,7 +160,7 @@ UNITTEST_START
     showsts(e, chost);
   }
 
-  printf("Number of entries: %zu\n", Curl_llist_count(&h->list));
+  curl_mprintf("Number of entries: %zu\n", Curl_llist_count(&h->list));
 
   /* verify that it is exists for 7 seconds */
   chost = "expire.example";
@@ -170,7 +170,7 @@ UNITTEST_START
     deltatime++; /* another second passed */
   }
 
-  msnprintf(savename, sizeof(savename), "%s.save", arg);
+  curl_msnprintf(savename, sizeof(savename), "%s.save", arg);
   (void)Curl_hsts_save(easy, h, savename);
   Curl_hsts_cleanup(&h);
   curl_easy_cleanup(easy);
index 786cf768683f3b40a72ad40efdc221d9f276fda4..528f73708f72aca6bb23c6fa714d801b00552f3a 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <curl/curl.h>
 
-#include "strparse.h"
+#include "curlx/strparse.h"
 
 #include "memdebug.h" /* LAST include file */
 
@@ -64,23 +64,23 @@ UNITTEST_START
   };
 
   int i;
-  printf("Curl_str_word\n");
+  printf("curlx_str_word\n");
   for(i = 0; wordparse[i]; i++) {
     struct Curl_str out;
     const char *line = wordparse[i];
     const char *orgline = line;
-    int rc = Curl_str_word(&line, &out, 7);
+    int rc = curlx_str_word(&line, &out, 7);
     printf("%u: (\"%s\") %d, \"%.*s\" [%d], line %d\n",
            i, orgline, rc, (int)out.len, out.str, (int)out.len,
            (int)(line - orgline));
   }
 
-  printf("Curl_str_until\n");
+  printf("curlx_str_until\n");
   for(i = 0; wordparse[i]; i++) {
     struct Curl_str out;
     const char *line = wordparse[i];
     const char *orgline = line;
-    int rc = Curl_str_until(&line, &out, 7, 'd');
+    int rc = curlx_str_until(&line, &out, 7, 'd');
     printf("%u: (\"%s\") %d, \"%.*s\" [%d], line %d\n",
            i, orgline, rc, (int)out.len, out.str, (int)out.len,
            (int)(line - orgline));
@@ -103,12 +103,12 @@ UNITTEST_START
       NULL
     };
 
-    printf("Curl_str_quotedword\n");
+    printf("curlx_str_quotedword\n");
     for(i = 0; qwords[i]; i++) {
       struct Curl_str out;
       const char *line = qwords[i];
       const char *orgline = line;
-      int rc = Curl_str_quotedword(&line, &out, 7);
+      int rc = curlx_str_quotedword(&line, &out, 7);
       printf("%u: (\"%s\") %d, \"%.*s\" [%d], line %d\n",
              i, orgline, rc, (int)out.len, out.str, (int)out.len,
              (int)(line - orgline));
@@ -126,11 +126,11 @@ UNITTEST_START
       "",
       NULL
     };
-    printf("Curl_str_single\n");
+    printf("curlx_str_single\n");
     for(i = 0; single[i]; i++) {
       const char *line = single[i];
       const char *orgline = line;
-      int rc = Curl_str_single(&line, 'a');
+      int rc = curlx_str_single(&line, 'a');
       printf("%u: (\"%s\") %d, line %d\n",
              i, orgline, rc, (int)(line - orgline));
     }
@@ -148,11 +148,11 @@ UNITTEST_START
       "",
       NULL
     };
-    printf("Curl_str_singlespace\n");
+    printf("curlx_str_singlespace\n");
     for(i = 0; single[i]; i++) {
       const char *line = single[i];
       const char *orgline = line;
-      int rc = Curl_str_singlespace(&line);
+      int rc = curlx_str_singlespace(&line);
       printf("%u: (\"%s\") %d, line %d\n",
              i, orgline, rc, (int)(line - orgline));
     }
@@ -169,11 +169,11 @@ UNITTEST_START
       "",
       NULL
     };
-    printf("Curl_str_single\n");
+    printf("curlx_str_single\n");
     for(i = 0; single[i]; i++) {
       const char *line = single[i];
       const char *orgline = line;
-      int rc = Curl_str_single(&line, 'a');
+      int rc = curlx_str_single(&line, 'a');
       printf("%u: (\"%s\") %d, line %d\n",
              i, orgline, rc, (int)(line - orgline));
     }
@@ -194,12 +194,12 @@ UNITTEST_START
       "",
       NULL
     };
-    printf("Curl_str_number\n");
+    printf("curlx_str_number\n");
     for(i = 0; nums[i]; i++) {
       curl_off_t num;
       const char *line = nums[i];
       const char *orgline = line;
-      int rc = Curl_str_number(&line, &num, 1235);
+      int rc = curlx_str_number(&line, &num, 1235);
       printf("%u: (\"%s\") %d, [%u] line %d\n",
              i, orgline, rc, (int)num, (int)(line - orgline));
     }
@@ -226,15 +226,15 @@ UNITTEST_START
       { "12", 10},
       {NULL, 0}
     };
-    printf("Curl_str_number varying max\n");
+    printf("curlx_str_number varying max\n");
     for(i = 0; nums[i].str; i++) {
       curl_off_t num;
       const char *line = nums[i].str;
       const char *orgline = line;
-      int rc = Curl_str_number(&line, &num, nums[i].max);
-      printf("%u: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T
-             " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n",
-             i, orgline, nums[i].max, rc, num);
+      int rc = curlx_str_number(&line, &num, nums[i].max);
+      curl_mprintf("%u: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T
+                   " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n",
+                   i, orgline, nums[i].max, rc, num);
     }
   }
 
@@ -266,15 +266,15 @@ UNITTEST_START
       { "12", 16},
       {NULL, 0}
     };
-    printf("Curl_str_hex varying max\n");
+    printf("curlx_str_hex varying max\n");
     for(i = 0; nums[i].str; i++) {
       curl_off_t num;
       const char *line = nums[i].str;
       const char *orgline = line;
-      int rc = Curl_str_hex(&line, &num, nums[i].max);
-      printf("%u: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T
-             " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n",
-             i, orgline, nums[i].max, rc, num);
+      int rc = curlx_str_hex(&line, &num, nums[i].max);
+      curl_mprintf("%u: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T
+                   " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n",
+                   i, orgline, nums[i].max, rc, num);
     }
   }
 
@@ -301,15 +301,15 @@ UNITTEST_START
       { "8", 10},
       {NULL, 0}
     };
-    printf("Curl_str_octal varying max\n");
+    printf("curlx_str_octal varying max\n");
     for(i = 0; nums[i].str; i++) {
       curl_off_t num;
       const char *line = nums[i].str;
       const char *orgline = line;
-      int rc = Curl_str_octal(&line, &num, nums[i].max);
-      printf("%u: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T
-             " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n",
-             i, orgline, nums[i].max, rc, num);
+      int rc = curlx_str_octal(&line, &num, nums[i].max);
+      curl_mprintf("%u: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T
+                   " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n",
+                   i, orgline, nums[i].max, rc, num);
     }
   }
 
@@ -337,14 +337,14 @@ UNITTEST_START
       "999999999999999999",
       NULL
     };
-    printf("Curl_str_number / max\n");
+    printf("curlx_str_number / max\n");
     for(i = 0; nums[i]; i++) {
       curl_off_t num;
       const char *line = nums[i];
       const char *orgline = line;
-      int rc = Curl_str_number(&line, &num, CURL_OFF_T_MAX);
-      printf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n",
-             i, orgline, rc, num, (int)(line - orgline));
+      int rc = curlx_str_number(&line, &num, CURL_OFF_T_MAX);
+      curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n",
+                   i, orgline, rc, num, (int)(line - orgline));
     }
   }
 
@@ -363,13 +363,13 @@ UNITTEST_START
       "",
       NULL
     };
-    printf("Curl_str_newline\n");
+    printf("curlx_str_newline\n");
     for(i = 0; newl[i]; i++) {
       const char *line = newl[i];
       const char *orgline = line;
-      int rc = Curl_str_newline(&line);
-      printf("%u: (%%%02x) %d, line %d\n",
-             i, *orgline, rc, (int)(line - orgline));
+      int rc = curlx_str_newline(&line);
+      curl_mprintf("%u: (%%%02x) %d, line %d\n",
+                   i, *orgline, rc, (int)(line - orgline));
     }
   }
 
@@ -389,14 +389,14 @@ UNITTEST_START
       "",
       NULL
     };
-    printf("Curl_str_hex\n");
+    printf("curlx_str_hex\n");
     for(i = 0; nums[i]; i++) {
       curl_off_t num;
       const char *line = nums[i];
       const char *orgline = line;
-      int rc = Curl_str_hex(&line, &num, 0x1235);
-      printf("%u: (\"%s\") %d, [%u] line %d\n",
-             i, orgline, rc, (int)num, (int)(line - orgline));
+      int rc = curlx_str_hex(&line, &num, 0x1235);
+      curl_mprintf("%u: (\"%s\") %d, [%u] line %d\n",
+                   i, orgline, rc, (int)num, (int)(line - orgline));
     }
   }
 
@@ -416,14 +416,14 @@ UNITTEST_START
       "",
       NULL
     };
-    printf("Curl_str_octal\n");
+    printf("curlx_str_octal\n");
     for(i = 0; nums[i]; i++) {
       curl_off_t num;
       const char *line = nums[i];
       const char *orgline = line;
-      int rc = Curl_str_octal(&line, &num, 01235);
-      printf("%u: (\"%s\") %d, [%u] line %d\n",
-             i, orgline, rc, (int)num, (int)(line - orgline));
+      int rc = curlx_str_octal(&line, &num, 01235);
+      curl_mprintf("%u: (\"%s\") %d, [%u] line %d\n",
+                   i, orgline, rc, (int)num, (int)(line - orgline));
     }
   }
 
@@ -440,14 +440,14 @@ UNITTEST_START
       "666666666666666666666",
       NULL
     };
-    printf("Curl_str_octal / max\n");
+    printf("curlx_str_octal / max\n");
     for(i = 0; nums[i]; i++) {
       curl_off_t num;
       const char *line = nums[i];
       const char *orgline = line;
-      int rc = Curl_str_octal(&line, &num, CURL_OFF_T_MAX);
-      printf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n",
-             i, orgline, rc, num, (int)(line - orgline));
+      int rc = curlx_str_octal(&line, &num, CURL_OFF_T_MAX);
+      curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n",
+                   i, orgline, rc, num, (int)(line - orgline));
     }
   }
 
@@ -476,14 +476,14 @@ UNITTEST_START
       "ABCDEF",
       NULL
     };
-    printf("Curl_str_hex / max\n");
+    printf("curlx_str_hex / max\n");
     for(i = 0; nums[i]; i++) {
       curl_off_t num;
       const char *line = nums[i];
       const char *orgline = line;
-      int rc = Curl_str_hex(&line, &num, CURL_OFF_T_MAX);
-      printf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n",
-             i, orgline, rc, num, (int)(line - orgline));
+      int rc = curlx_str_hex(&line, &num, CURL_OFF_T_MAX);
+      curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n",
+                   i, orgline, rc, num, (int)(line - orgline));
     }
   }
 
index 8d2dd042eaa4bdb5ca371a0c619762ed98876d4f..16f5c5ce6b44a6fffaf6affae44faec9ba264067 100644 (file)
@@ -121,7 +121,7 @@ static void cf_test_destroy(struct Curl_cfilter *cf, struct Curl_easy *data)
   struct cf_test_ctx *ctx = cf->ctx;
 #ifndef CURL_DISABLE_VERBOSE_STRINGS
   infof(data, "%04dms: cf[%s] destroyed",
-        (int)Curl_timediff(Curl_now(), current_tr->started), ctx->id);
+        (int)curlx_timediff(curlx_now(), current_tr->started), ctx->id);
 #else
   (void)data;
 #endif
@@ -138,7 +138,7 @@ static CURLcode cf_test_connect(struct Curl_cfilter *cf,
 
   (void)data;
   *done = FALSE;
-  duration_ms = Curl_timediff(Curl_now(), ctx->started);
+  duration_ms = curlx_timediff(curlx_now(), ctx->started);
   if(duration_ms >= ctx->fail_delay_ms) {
     infof(data, "%04dms: cf[%s] fail delay reached",
           (int)duration_ms, ctx->id);
@@ -200,7 +200,7 @@ static CURLcode cf_test_create(struct Curl_cfilter **pcf,
   }
   ctx->ai_family = ai->ai_family;
   ctx->transport = transport;
-  ctx->started = Curl_now();
+  ctx->started = curlx_now();
 #ifdef USE_IPV6
   if(ctx->ai_family == AF_INET6) {
     ctx->stats = &current_tr->cf6;
@@ -217,7 +217,7 @@ static CURLcode cf_test_create(struct Curl_cfilter **pcf,
     ctx->stats->creations++;
   }
 
-  created_at = Curl_timediff(ctx->started, current_tr->started);
+  created_at = curlx_timediff(ctx->started, current_tr->started);
   if(ctx->stats->creations == 1)
     ctx->stats->first_created = created_at;
   ctx->stats->last_created = created_at;
@@ -244,8 +244,8 @@ static void check_result(struct test_case *tc,
   char msg[256];
   timediff_t duration_ms;
 
-  duration_ms = Curl_timediff(tr->ended, tr->started);
-  fprintf(stderr, "%d: test case took %dms\n", tc->id, (int)duration_ms);
+  duration_ms = curlx_timediff(tr->ended, tr->started);
+  curl_mfprintf(stderr, "%d: test case took %dms\n", tc->id, (int)duration_ms);
 
   if(tr->result != tc->exp_result
     && CURLE_OPERATION_TIMEDOUT != tr->result) {
@@ -266,7 +266,7 @@ static void check_result(struct test_case *tc,
     fail(msg);
   }
 
-  duration_ms = Curl_timediff(tr->ended, tr->started);
+  duration_ms = curlx_timediff(tr->ended, tr->started);
   if(duration_ms < tc->min_duration_ms) {
     curl_msprintf(msg, "%d: expected min duration of %dms, but took %dms",
                   tc->id, (int)tc->min_duration_ms, (int)duration_ms);
@@ -324,9 +324,9 @@ static void test_connect(struct test_case *tc)
   tr.cf6.family = "v6";
   tr.cf4.family = "v4";
 
-  tr.started = Curl_now();
+  tr.started = curlx_now();
   tr.result = curl_easy_perform(easy);
-  tr.ended = Curl_now();
+  tr.ended = curlx_now();
 
   curl_easy_setopt(easy, CURLOPT_RESOLVE, NULL);
   curl_slist_free_all(list);
index 1744d9d315676fa780490e7e25606ec662c28c62..9fd8d56aebbdb54a5bb8340325033f5b46ba44bc 100644 (file)
@@ -64,26 +64,26 @@ static void dump_bufq(struct bufq *q, const char *msg)
   const char *terr;
   size_t n;
 
-  fprintf(stderr, "bufq[chunk_size=%zu, max_chunks=%zu] %s\n",
-          q->chunk_size, q->max_chunks, msg);
-  fprintf(stderr, "- queue[\n");
+  curl_mfprintf(stderr, "bufq[chunk_size=%zu, max_chunks=%zu] %s\n",
+                q->chunk_size, q->max_chunks, msg);
+  curl_mfprintf(stderr, "- queue[\n");
   chunk = q->head;
   while(chunk) {
-    fprintf(stderr, "    chunk[len=%zu, roff=%zu, woff=%zu]\n",
-            chunk->dlen, chunk->r_offset, chunk->w_offset);
+    curl_mfprintf(stderr, "    chunk[len=%zu, roff=%zu, woff=%zu]\n",
+                  chunk->dlen, chunk->r_offset, chunk->w_offset);
     chunk = chunk->next;
   }
-  fprintf(stderr, "  ]\n");
+  curl_mfprintf(stderr, "  ]\n");
   terr = tail_err(q);
-  fprintf(stderr, "- tail: %s\n", terr ? terr : "ok");
+  curl_mfprintf(stderr, "- tail: %s\n", terr ? terr : "ok");
   n = 0;
   chunk = q->spare;
   while(chunk) {
     ++n;
     chunk = chunk->next;
   }
-  fprintf(stderr, "- chunks: %zu\n", q->chunk_count);
-  fprintf(stderr, "- spares: %zu\n", n);
+  curl_mfprintf(stderr, "- chunks: %zu\n", q->chunk_count);
+  curl_mfprintf(stderr, "- spares: %zu\n", n);
 }
 
 static unsigned char test_data[32*1024];
@@ -133,8 +133,8 @@ static void check_bufq(size_t pool_spares,
     }
   }
   if(nwritten != max_len) {
-    fprintf(stderr, "%zu bytes written, but max_len=%zu\n",
-            nwritten, max_len);
+    curl_mfprintf(stderr, "%zu bytes written, but max_len=%zu\n",
+                  nwritten, max_len);
     dump_bufq(&q, "after writing full");
     fail_if(TRUE, "write: bufq full but nwritten wrong");
   }
@@ -152,8 +152,8 @@ static void check_bufq(size_t pool_spares,
     }
   }
   if(nread != max_len) {
-    fprintf(stderr, "%zu bytes read, but max_len=%zu\n",
-            nwritten, max_len);
+    curl_mfprintf(stderr, "%zu bytes read, but max_len=%zu\n",
+                  nwritten, max_len);
     dump_bufq(&q, "after reading empty");
     fail_if(TRUE, "read: bufq empty but nread wrong");
   }
@@ -188,8 +188,8 @@ static void check_bufq(size_t pool_spares,
     nwritten += (size_t)n;
   }
   if(nwritten < max_len) {
-    fprintf(stderr, "%zu bytes written, but max_len=%zu\n",
-            nwritten, max_len);
+    curl_mfprintf(stderr, "%zu bytes written, but max_len=%zu\n",
+                  nwritten, max_len);
     dump_bufq(&q, "after writing full");
     fail_if(TRUE, "write: bufq full but nwritten wrong");
   }
@@ -235,8 +235,8 @@ static void check_bufq(size_t pool_spares,
         fail_unless(Curl_bufq_is_empty(&q), "should be last read");
       }
       if(memcmp(buf, rbuf, n)) {
-        fprintf(stderr, "at offset %zu expected '%.*s', got '%.*s'\n",
-                roffset, (int)n, buf, (int)n, rbuf);
+        curl_mfprintf(stderr, "at offset %zu expected '%.*s', got '%.*s'\n",
+                      roffset, (int)n, buf, (int)n, rbuf);
         fail("read buf content wrong");
       }
       roffset += n;
index 41476c60f0586578a48453e0c213df7b2e3f965a..d730a987407719937342a539bc003ee6d9ae8aee 100644 (file)
@@ -109,14 +109,14 @@ UNITTEST_START
     fail_unless(Curl_dynhds_ccount_name(&hds, "bLABlaBlA") == 0, "should");
     fail_if(Curl_dynhds_cadd(&hds, "Bla-Bla", "thingies"), "add failed");
 
-    Curl_dyn_init(&dbuf, 32*1024);
+    curlx_dyn_init(&dbuf, 32*1024);
     fail_if(Curl_dynhds_h1_dprint(&hds, &dbuf), "h1 print failed");
-    if(Curl_dyn_ptr(&dbuf)) {
-      fail_if(strcmp(Curl_dyn_ptr(&dbuf),
+    if(curlx_dyn_ptr(&dbuf)) {
+      fail_if(strcmp(curlx_dyn_ptr(&dbuf),
                      "test1: 123\r\ntest1: 123\r\nBla-Bla: thingies\r\n"),
                      "h1 format differs");
     }
-    Curl_dyn_free(&dbuf);
+    curlx_dyn_free(&dbuf);
   }
 
   Curl_dynhds_free(&hds);
@@ -133,15 +133,15 @@ UNITTEST_START
   fail_if(Curl_dynhds_h1_cadd_line(&hds, "ti3: val1"), "add");
   fail_if(Curl_dynhds_h1_cadd_line(&hds, "     val2"), "add indent");
 
-  Curl_dyn_init(&dbuf, 32*1024);
+  curlx_dyn_init(&dbuf, 32*1024);
   fail_if(Curl_dynhds_h1_dprint(&hds, &dbuf), "h1 print failed");
-  if(Curl_dyn_ptr(&dbuf)) {
-    fprintf(stderr, "indent concat: %s\n", Curl_dyn_ptr(&dbuf));
-    fail_if(strcmp(Curl_dyn_ptr(&dbuf),
+  if(curlx_dyn_ptr(&dbuf)) {
+    curl_mfprintf(stderr, "indent concat: %s\n", curlx_dyn_ptr(&dbuf));
+    fail_if(strcmp(curlx_dyn_ptr(&dbuf),
                    "ti1: val1 val2\r\nti2: val1 val2\r\nti3: val1 val2\r\n"),
                    "wrong format");
   }
-  Curl_dyn_free(&dbuf);
+  curlx_dyn_free(&dbuf);
 
   Curl_dynhds_free(&hds);
 
index 2775a4565a97b86aa2fd11b3497b737ead3b2ddd..82d56a5a793430f07c5c860c8efaa6701c141904 100644 (file)
@@ -53,16 +53,17 @@ static void check_eq(const char *s, const char *exp_s, const char *name)
 {
   if(s && exp_s) {
     if(strcmp(s, exp_s)) {
-      fprintf(stderr, "expected %s: '%s' but got '%s'\n", name, exp_s, s);
+      curl_mfprintf(stderr, "expected %s: '%s' but got '%s'\n",
+                    name, exp_s, s);
       fail("unexpected req component");
     }
   }
   else if(!s && exp_s) {
-    fprintf(stderr, "expected %s: '%s' but got NULL\n", name, exp_s);
+    curl_mfprintf(stderr, "expected %s: '%s' but got NULL\n", name, exp_s);
     fail("unexpected req component");
   }
   else if(s && !exp_s) {
-    fprintf(stderr, "expected %s: NULL but got '%s'\n", name, s);
+    curl_mfprintf(stderr, "expected %s: NULL but got '%s'\n", name, s);
     fail("unexpected req component");
   }
 }
@@ -84,14 +85,14 @@ static void parse_success(struct tcase *t)
     nread = Curl_h1_req_parse_read(&p, buf, buflen, t->default_scheme,
                                    0, &err);
     if(nread < 0) {
-      fprintf(stderr, "got err %d parsing: '%s'\n", err, buf);
+      curl_mfprintf(stderr, "got err %d parsing: '%s'\n", err, buf);
       fail("error consuming");
     }
     in_consumed += (size_t)nread;
     if((size_t)nread != buflen) {
       if(!p.done) {
-        fprintf(stderr, "only %zd/%zu consumed for: '%s'\n",
-                nread, buflen, buf);
+        curl_mfprintf(stderr, "only %zd/%zu consumed for: '%s'\n",
+                      nread, buflen, buf);
         fail("not all consumed");
       }
     }
@@ -100,8 +101,8 @@ static void parse_success(struct tcase *t)
   fail_if(!p.done, "end not detected");
   fail_if(!p.req, "not request created");
   if(t->input_remain != (in_len - in_consumed)) {
-    fprintf(stderr, "expected %zu input bytes to remain, but got %zu\n",
-            t->input_remain, in_len - in_consumed);
+    curl_mfprintf(stderr, "expected %zu input bytes to remain, but got %zu\n",
+                  t->input_remain, in_len - in_consumed);
     fail("unexpected input consumption");
   }
   if(p.req) {
@@ -110,8 +111,8 @@ static void parse_success(struct tcase *t)
     check_eq(p.req->authority, t->authority, "authority");
     check_eq(p.req->path, t->path, "path");
     if(Curl_dynhds_count(&p.req->headers) != t->header_count) {
-      fprintf(stderr, "expected %zu headers but got %zu\n", t->header_count,
-             Curl_dynhds_count(&p.req->headers));
+      curl_mfprintf(stderr, "expected %zu headers but got %zu\n",
+                    t->header_count, Curl_dynhds_count(&p.req->headers));
       fail("unexpected req header count");
     }
   }
index 674e1fa3dde930ec5e265cf3d6ec5afd024e6a12..60e34ac337c875d22e67c11697155cdae7bd4927 100644 (file)
@@ -91,7 +91,7 @@ UNITTEST_START
     struct dynbuf buf;
     size_t len = 4096;
     char *line;
-    Curl_dyn_init(&buf, len);
+    curlx_dyn_init(&buf, len);
 
     fp = fopen(arg, "wb");
     abort_unless(fp != NULL, "Cannot open testfile");
@@ -101,74 +101,74 @@ UNITTEST_START
     fp = fopen(arg, "rb");
     abort_unless(fp != NULL, "Cannot open testfile");
 
-    fprintf(stderr, "Test %zd...", i);
+    curl_mfprintf(stderr, "Test %zd...", i);
     switch(i) {
       case 0:
         rc = Curl_get_line(&buf, fp);
-        line = Curl_dyn_ptr(&buf);
+        line = curlx_dyn_ptr(&buf);
         fail_unless(rc && line && !strcmp("LINE1\n", line),
                     "First line failed (1)");
         rc = Curl_get_line(&buf, fp);
-        line = Curl_dyn_ptr(&buf);
+        line = curlx_dyn_ptr(&buf);
         fail_unless(rc && line && !strcmp("LINE2 NEWLINE\n", line),
                     "Second line failed (1)");
         rc = Curl_get_line(&buf, fp);
-        abort_unless(!Curl_dyn_len(&buf), "Missed EOF (1)");
+        abort_unless(!curlx_dyn_len(&buf), "Missed EOF (1)");
         break;
       case 1:
         rc = Curl_get_line(&buf, fp);
-        line = Curl_dyn_ptr(&buf);
+        line = curlx_dyn_ptr(&buf);
         fail_unless(rc && line && !strcmp("LINE1\n", line),
                     "First line failed (2)");
         rc = Curl_get_line(&buf, fp);
-        line = Curl_dyn_ptr(&buf);
+        line = curlx_dyn_ptr(&buf);
         fail_unless(rc && line && !strcmp("LINE2 NONEWLINE\n", line),
                     "Second line failed (2)");
         rc = Curl_get_line(&buf, fp);
-        abort_unless(!Curl_dyn_len(&buf), "Missed EOF (2)");
+        abort_unless(!curlx_dyn_len(&buf), "Missed EOF (2)");
         break;
       case 2:
         rc = Curl_get_line(&buf, fp);
-        line = Curl_dyn_ptr(&buf);
+        line = curlx_dyn_ptr(&buf);
         fail_unless(rc && line && !strcmp("LINE1\n", line),
                     "First line failed (3)");
         rc = Curl_get_line(&buf, fp);
-        fail_unless(!Curl_dyn_len(&buf),
+        fail_unless(!curlx_dyn_len(&buf),
                     "Did not detect max read on EOF (3)");
         break;
       case 3:
         rc = Curl_get_line(&buf, fp);
-        line = Curl_dyn_ptr(&buf);
+        line = curlx_dyn_ptr(&buf);
         fail_unless(rc && line && !strcmp("LINE1\n", line),
                     "First line failed (4)");
         rc = Curl_get_line(&buf, fp);
-        fail_unless(!Curl_dyn_len(&buf),
+        fail_unless(!curlx_dyn_len(&buf),
                     "Did not ignore partial on EOF (4)");
         break;
       case 4:
         rc = Curl_get_line(&buf, fp);
-        line = Curl_dyn_ptr(&buf);
+        line = curlx_dyn_ptr(&buf);
         fail_unless(rc && line && !strcmp("LINE1\n", line),
                     "First line failed (5)");
         rc = Curl_get_line(&buf, fp);
-        fail_unless(!Curl_dyn_len(&buf),
+        fail_unless(!curlx_dyn_len(&buf),
                     "Did not bail out on too long line");
         break;
       case 5:
         rc = Curl_get_line(&buf, fp);
-        line = Curl_dyn_ptr(&buf);
+        line = curlx_dyn_ptr(&buf);
         fail_unless(rc && line && !strcmp("LINE1\x1aTEST\n", line),
                     "Missed/Misinterpreted ^Z (6)");
         rc = Curl_get_line(&buf, fp);
-        abort_unless(!Curl_dyn_len(&buf), "Missed EOF (6)");
+        abort_unless(!curlx_dyn_len(&buf), "Missed EOF (6)");
         break;
       default:
         abort_unless(1, "Unknown case");
         break;
     }
-    Curl_dyn_free(&buf);
+    curlx_dyn_free(&buf);
     fclose(fp);
-    fprintf(stderr, "OK\n");
+    curl_mfprintf(stderr, "OK\n");
   }
   return (CURLcode)rc;
 UNITTEST_STOP
index 1ed0f2005bb69fe604789989181dc56fdbf08816..95e169d5b47296b3049a382bcc53aa28dfe20e17 100644 (file)
@@ -698,9 +698,9 @@ UNITTEST_START
     if(test->rfc) {
       id = Curl_cipher_suite_lookup_id(test->rfc, strlen(test->rfc));
       if(id != test->id) {
-        fprintf(stderr, "Curl_cipher_suite_lookup_id FAILED for \"%s\", "
-                        "result = 0x%04x, expected = 0x%04x\n",
-                        test->rfc, id, test->id);
+        curl_mfprintf(stderr, "Curl_cipher_suite_lookup_id FAILED for \"%s\", "
+                      "result = 0x%04x, expected = 0x%04x\n",
+                      test->rfc, id, test->id);
         unitfail++;
       }
     }
@@ -709,9 +709,9 @@ UNITTEST_START
     if(test->openssl) {
       id = Curl_cipher_suite_lookup_id(test->openssl, strlen(test->openssl));
       if(id != test->id) {
-        fprintf(stderr, "Curl_cipher_suite_lookup_id FAILED for \"%s\", "
-                        "result = 0x%04x, expected = 0x%04x\n",
-                        test->openssl, id, test->id);
+        curl_mfprintf(stderr, "Curl_cipher_suite_lookup_id FAILED for \"%s\", "
+                      "result = 0x%04x, expected = 0x%04x\n",
+                      test->openssl, id, test->id);
         unitfail++;
       }
     }
@@ -723,9 +723,9 @@ UNITTEST_START
     Curl_cipher_suite_get_str(test->id, buf, sizeof(buf), true);
 
     if(expect && strcmp(buf, expect) != 0) {
-      fprintf(stderr, "Curl_cipher_suite_get_str FAILED for 0x%04x, "
-                      "result = \"%s\", expected = \"%s\"\n",
-                      test->id, buf, expect);
+      curl_mfprintf(stderr, "Curl_cipher_suite_get_str FAILED for 0x%04x, "
+                    "result = \"%s\", expected = \"%s\"\n",
+                    test->id, buf, expect);
       unitfail++;
     }
 
@@ -744,9 +744,9 @@ UNITTEST_START
     }
 
     if(expect && strcmp(buf, expect) != 0) {
-      fprintf(stderr, "Curl_cipher_suite_get_str FAILED for 0x%04x, "
-                      "result = \"%s\", expected = \"%s\"\n",
-                      test->id, buf, expect);
+      curl_mfprintf(stderr, "Curl_cipher_suite_get_str FAILED for 0x%04x, "
+                    "result = \"%s\", expected = \"%s\"\n",
+                    test->id, buf, expect);
       unitfail++;
     }
   }
@@ -766,16 +766,16 @@ UNITTEST_START
       len = end - ptr;
 
       if(id != test->id) {
-        fprintf(stderr, "Curl_cipher_suite_walk_str FAILED for \"%s\" "
-                        "unexpected cipher, "
-                        "result = 0x%04x, expected = 0x%04x\n",
-                        test->str, id, test->id);
+        curl_mfprintf(stderr, "Curl_cipher_suite_walk_str FAILED for \"%s\" "
+                      "unexpected cipher, "
+                      "result = 0x%04x, expected = 0x%04x\n",
+                      test->str, id, test->id);
         unitfail++;
       }
       if(len > 64 || strncmp(ptr, test->str, len) != 0) {
-        fprintf(stderr, "Curl_cipher_suite_walk_str ABORT for \"%s\" "
-                        "unexpected pointers\n",
-                        test->str);
+        curl_mfprintf(stderr, "Curl_cipher_suite_walk_str ABORT for \"%s\" "
+                      "unexpected pointers\n",
+                      test->str);
         unitfail++;
         goto unit_test_abort;
       }
index 8bb23e73e75fdb9a664be6a8f6133bb00d6bd827..c9c15ca6d59ccc4612dc5435bb4c81ba33ccb827 100644 (file)
@@ -54,8 +54,8 @@ static void check_set(const char *name, unsigned int capacity,
   size_t i, j;
   unsigned int n, c;
 
-  fprintf(stderr, "test %s, capacity=%u, %zu numbers\n",
-          name, capacity, slen);
+  curl_mfprintf(stderr, "test %s, capacity=%u, %zu numbers\n",
+                name, capacity, slen);
   Curl_uint_bset_init(&bset);
   fail_unless(!Curl_uint_bset_resize(&bset, capacity), "bset resize failed");
   c = Curl_uint_bset_capacity(&bset);
@@ -81,7 +81,7 @@ static void check_set(const char *name, unsigned int capacity,
   for(i = 1; i < slen; ++i) {
     fail_unless(Curl_uint_bset_next(&bset, n, &n), "next failed");
     if(n != s[i]) {
-      fprintf(stderr, "expected next to be %u, not %u\n", s[i], n);
+      curl_mfprintf(stderr, "expected next to be %u, not %u\n", s[i], n);
       fail_unless(n == s[i], "next not correct number");
     }
   }
index f82e55637f815f36190136fb787a523d02e4db3c..eb4eaa6c7397946101ba209865e6189f79c74cc8 100644 (file)
@@ -57,7 +57,7 @@ static void check_spbset(const char *name, unsigned int *s, size_t slen)
   size_t i, j;
   unsigned int n, c;
 
-  fprintf(stderr, "test %s, %zu numbers\n", name, slen);
+  curl_mfprintf(stderr, "test %s, %zu numbers\n", name, slen);
 
   Curl_uint_spbset_init(&bset);
 
@@ -83,7 +83,7 @@ static void check_spbset(const char *name, unsigned int *s, size_t slen)
   for(i = 1; i < slen; ++i) {
     fail_unless(Curl_uint_spbset_next(&bset, n, &n), "next failed");
     if(n != s[i]) {
-      fprintf(stderr, "expected next to be %u, not %u\n", s[i], n);
+      curl_mfprintf(stderr, "expected next to be %u, not %u\n", s[i], n);
       fail_unless(n == s[i], "next not correct number");
     }
   }
index db6139efc83da6f56c2f1c2a78f46b56a852911b..62d6a20263f9d4d980fee97a9487bed71b6017d4 100644 (file)
@@ -90,7 +90,7 @@ PDB_NAME_DLL_DEBUG     = $(BASE_NAME_DEBUG).pdb
 
 # CURL Command section
 PROGRAM_NAME  = curl.exe
-CURL_CFLAGS   = /I../lib /I../include /nologo /W4 /EHsc /FD /c
+CURL_CFLAGS   = /I../lib /I../lib/curlx /I../include /nologo /W4 /EHsc /FD /c
 CURL_LFLAGS   = /out:$(DIRDIST)\bin\$(PROGRAM_NAME) /subsystem:console $(LFLAGS)
 CURL_RESFLAGS = /i../include
 
@@ -641,6 +641,7 @@ $(LIB_DIROBJ):
        @if not exist "$(LIB_DIROBJ)\vtls" mkdir $(LIB_DIROBJ)\vtls
        @if not exist "$(LIB_DIROBJ)\vssh" mkdir $(LIB_DIROBJ)\vssh
        @if not exist "$(LIB_DIROBJ)\vquic" mkdir $(LIB_DIROBJ)\vquic
+       @if not exist "$(LIB_DIROBJ)\curlx" mkdir $(LIB_DIROBJ)\curlx
 
 $(CURL_DIROBJ):
        @if not exist "$(CURL_DIROBJ)" mkdir $(CURL_DIROBJ)
@@ -665,6 +666,9 @@ $(CURL_DIROBJ):
 {$(LIBCURL_SRC_DIR)\vquic\}.c{$(LIB_DIROBJ)\vquic\}.obj::
        $(CURL_CC) $(CFLAGS) /Fo"$(LIB_DIROBJ)\vquic\\"  $<
 
+{$(LIBCURL_SRC_DIR)\curlx\}.c{$(LIB_DIROBJ)\curlx\}.obj::
+       $(CURL_CC) $(CFLAGS) /Fo"$(LIB_DIROBJ)\curlx\\"  $<
+
 $(LIB_DIROBJ)\libcurl.res: $(LIBCURL_SRC_DIR)\libcurl.rc
        $(RC) $(RC_FLAGS)
 
@@ -716,24 +720,24 @@ $(CURL_DIROBJ)\tool_hugehelp.obj: $(CURL_SRC_DIR)\tool_hugehelp.c
 !ENDIF
 $(CURL_DIROBJ)\nonblock.obj: ../lib/nonblock.c
        $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/nonblock.c
-$(CURL_DIROBJ)\strparse.obj: ../lib/strparse.c
-       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/strparse.c
+$(CURL_DIROBJ)\strparse.obj: ../lib/curlx/strparse.c
+       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/curlx/strparse.c
 $(CURL_DIROBJ)\strcase.obj: ../lib/strcase.c
        $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/strcase.c
-$(CURL_DIROBJ)\timeval.obj: ../lib/timeval.c
-       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/timeval.c
-$(CURL_DIROBJ)\warnless.obj: ../lib/warnless.c
-       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/warnless.c
+$(CURL_DIROBJ)\timeval.obj: ../lib/curlx/timeval.c
+       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/curlx/timeval.c
 $(CURL_DIROBJ)\curl_get_line.obj: ../lib/curl_get_line.c
        $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/curl_get_line.c
 $(CURL_DIROBJ)\curl_multibyte.obj: ../lib/curl_multibyte.c
        $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/curl_multibyte.c
 $(CURL_DIROBJ)\version_win32.obj: ../lib/version_win32.c
        $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/version_win32.c
-$(CURL_DIROBJ)\dynbuf.obj: ../lib/dynbuf.c
-       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/dynbuf.c
-$(CURL_DIROBJ)\base64.obj: ../lib/base64.c
-       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/base64.c
+$(CURL_DIROBJ)\warnless.obj: ../lib/curlx/warnless.c
+       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/curlx/warnless.c
+$(CURL_DIROBJ)\dynbuf.obj: ../lib/curlx/dynbuf.c
+       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/curlx/dynbuf.c
+$(CURL_DIROBJ)\base64.obj: ../lib/curlx/base64.c
+       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/curlx/base64.c
 $(CURL_DIROBJ)\curl.res: $(CURL_SRC_DIR)\curl.rc
        $(RC) $(CURL_RC_FLAGS)