curl/docs
Viktor Szakats 193cb00ce9
build: stop overriding standard memory allocation functions
Before this patch curl used the C preprocessor to override standard
memory allocation symbols: malloc, calloc, strdup, realloc, free.
The goal of these is to replace them with curl's debug wrappers in
`CURLDEBUG` builds, another was to replace them with the wrappers
calling user-defined allocators in libcurl. This solution needed a bunch
of workarounds to avoid breaking external headers: it relied on include
order to do the overriding last. For "unity" builds it needed to reset
overrides before external includes. Also in test apps, which are always
built as single source files. It also needed the `(symbol)` trick
to avoid overrides in some places. This would still not fix cases where
the standard symbols were macros. It was also fragile and difficult
to figure out which was the actual function behind an alloc or free call
in a specific piece of code. This in turn caused bugs where the wrong
allocator was accidentally called.

To avoid these problems, this patch replaces this solution with
`curlx_`-prefixed allocator macros, and mapping them _once_ to either
the libcurl wrappers, the debug wrappers or the standard ones, matching
the rest of the code in libtests.

This concludes the long journey to avoid redefining standard functions
in the curl codebase.

Note: I did not update `packages/OS400/*.c` sources. They did not
`#include` `curl_setup.h`, `curl_memory.h` or `memdebug.h`, meaning
the overrides were never applied to them. This may or may not have been
correct. For now I suppressed the direct use of standard allocators
via a local `.checksrc`. Probably they (except for `curlcl.c`) should be
updated to include `curl_setup.h` and use the `curlx_` macros.

This patch changes mappings in two places:
- `lib/curl_threads.c` in libtests: Before this patch it mapped to
  libcurl allocators. After, it maps to standard allocators, like
  the rest of libtests code.
- `units`: before this patch it mapped to standard allocators. After, it
  maps to libcurl allocators.

Also:
- drop all position-dependent `curl_memory.h` and `memdebug.h` includes,
  and delete the now unnecessary headers.
- rename `Curl_tcsdup` macro to `curlx_tcsdup` and define like the other
  allocators.
- map `curlx_strdup()` to `_strdup()` on Windows (was: `strdup()`).
  To fix warnings silenced via `_CRT_NONSTDC_NO_DEPRECATE`.
- multibyte: map `curlx_convert_*()` to `_strdup()` on Windows
  (was: `strdup()`).
- src: do not reuse the `strdup` name for the local replacement.
- lib509: call `_strdup()` on Windows (was: `strdup()`).
- test1132: delete test obsoleted by this patch.
- CHECKSRC.md: update text for `SNPRINTF`.
- checksrc: ban standard allocator symbols.

Follow-up to b12da22db1 #18866
Follow-up to db98daab05 #18844
Follow-up to 4deea9396b #18814
Follow-up to 9678ff5b1b #18776
Follow-up to 10bac43b87 #18774
Follow-up to 20142f5d06 #18634
Follow-up to bf7375ecc5 #18503
Follow-up to 9863599d69 #18502
Follow-up to 3bb5e58c10 #17827

Closes #19626
2025-11-28 10:44:26 +01:00
..
cmdline-opts docs: spell it Rustls with a capital R 2025-11-26 09:41:09 +01:00
examples build: stop overriding standard memory allocation functions 2025-11-28 10:44:26 +01:00
internals build: stop overriding standard memory allocation functions 2025-11-28 10:44:26 +01:00
libcurl ip_quadruple/proxy: make port uint16_t 2025-11-27 14:32:01 +01:00
tests tests/data: mark non-XML-compliant files as such, xmllint the rest in CI 2025-11-19 00:02:45 +01:00
.gitignore docs: add RELEASE-TOOLS.md.dist to .gitignore 2024-07-01 22:49:55 +02:00
ALTSVC.md docs: bring back ALTSVC.md and HSTS.md 2024-12-09 09:32:19 +01:00
BINDINGS.md tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
BUG-BOUNTY.md tidy-up: URLs 2025-09-23 00:34:46 +02:00
BUGS.md docs: fix two typos 2025-07-01 22:53:04 +02:00
CIPHERS-TLS12.md docs: update CIPHERS.md 2024-08-12 23:35:56 +02:00
CIPHERS.md tidy-up: update MS links, allow long URLs via checksrc 2025-09-20 11:49:23 +02:00
CMakeLists.txt tests: move test docs into /docs 2025-05-28 15:00:03 +02:00
CODE_OF_CONDUCT.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
CODE_REVIEW.md docs: fix broken link in CODE_REVIEW.md 2025-06-21 10:32:06 +02:00
CONTRIBUTE.md badwords: re-sync with curl-www, fix issues found 2025-11-12 00:53:44 +01:00
curl-config.md docs: minor edits to please the new spellchecker regime 2025-02-27 13:15:21 +01:00
CURL-DISABLE.md build: add build-level CURL_DISABLE_TYPECHECK options 2025-11-21 13:48:35 +01:00
CURLDOWN.md misc: fix typos 2025-07-12 08:59:44 +02:00
DEPRECATE.md DEPRECATE.md: move OpenSSL to past removals (fixup) 2025-11-15 22:33:13 +01:00
DISTROS.md DISTROS.md: add OpenBSD 2025-11-19 00:02:45 +01:00
EARLY-RELEASE.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
ECH.md ECH.md: make OpenSSL branch clone instructions work 2025-10-26 01:19:12 +02:00
EXPERIMENTAL.md docs/EXPERIMENTAL.md: add a mention of HTTPSRR as experimental 2025-01-16 19:41:42 +01:00
FAQ badwords: re-sync with curl-www, fix issues found 2025-11-12 00:53:44 +01:00
FEATURES.md FEATURES.md: fix typo 2024-08-23 08:46:09 +02:00
GOVERNANCE.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
HELP-US.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
HISTORY.md HISTORY: extend 2025-11-04 16:25:28 +01:00
HSTS.md docs: bring back ALTSVC.md and HSTS.md 2024-12-09 09:32:19 +01:00
HTTP-COOKIES.md tidy-up: URLs 2025-09-23 00:34:46 +02:00
HTTP3.md tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
HTTPSRR.md tidy-up: URLs 2025-09-23 00:34:46 +02:00
INFRASTRUCTURE.md docs: fix two typos 2025-07-01 22:53:04 +02:00
INSTALL INSTALL: converted to markdown => INSTALL.md 2016-10-21 15:57:29 +02:00
INSTALL-CMAKE.md cmake: add support for libbacktrace, fix two build issues 2025-11-24 14:29:29 +01:00
INSTALL.md docs: spell it Rustls with a capital R 2025-11-26 09:41:09 +01:00
INTERNALS.md INTERNALS.md: add more dependency versions and dates 2025-11-25 11:11:06 +01:00
IPFS.md badwords: re-sync with curl-www, fix issues found 2025-11-12 00:53:44 +01:00
KNOWN_BUGS KNOWN_BUGS: SOCKS-SSPI discards the security context 2025-10-17 17:45:06 +02:00
KNOWN_RISKS.md KNOWN_RISKS: known risks when running and using curl and libcurl 2025-11-22 13:09:46 +01:00
MAIL-ETIQUETTE.md GHA: silence proselint warnings and an error 2024-10-15 16:44:17 +02:00
Makefile.am ratelimit: redesign 2025-11-24 23:34:05 +01:00
MANUAL.md docs: use valid example domain names 2025-02-09 00:17:05 +01:00
mk-ca-bundle.md curldown: make 'added-in:' a mandatory header field 2024-07-18 18:04:09 +02:00
options-in-versions tool_getparam: add --knownhosts 2025-10-06 13:41:22 +02:00
README.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
RELEASE-PROCEDURE.md RELEASE-PROCEDURE.md: drop the _newslog edit mention 2025-09-08 11:12:47 +02:00
ROADMAP.md CI: add whitespace checker 2024-06-27 13:33:30 +02:00
runtests.md runtests: add -m=seconds to override test curl command timeout 2025-11-19 22:04:52 +01:00
RUSTLS.md tidy-up: URLs 2025-09-23 00:34:46 +02:00
SECURITY-ADVISORY.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
SPONSORS.md SPONSORS.md: clarify that we don't promise goods or services 2025-02-05 23:40:24 +01:00
SSL-PROBLEMS.md spelling: 'a' vs 'an' 2025-05-30 11:38:35 +02:00
SSLCERTS.md ssl: support Apple SecTrust configurations 2025-10-03 12:02:23 +02:00
testcurl.md scripts: fix to quote the copyright email address 2025-07-12 08:59:44 +02:00
THANKS tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
THANKS-filter RELEASE-NOTES: synced 2025-11-05 14:12:23 +01:00
TheArtOfHttpScripting.md docs: use lowercase curl and libcurl 2025-01-02 17:15:54 +01:00
TODO TODO: improve code for large MQTT payloads 2025-11-09 11:53:39 +01:00
URL-SYNTAX.md URL-SYNTAX.md: drop link to codepoints.net to pass linkcheck 2025-08-12 10:26:21 +02:00
VERSIONS.md VERSIONS: 8.18.0 is now pending 2025-11-05 08:00:05 +01:00
VULN-DISCLOSURE-POLICY.md VULN-DISCLOSURE-POLICY: make it pass test 1275 2025-09-07 12:39:44 +02:00
wcurl.md badwords: make some words match case-insensitively 2025-11-27 15:10:34 +01:00

curl logo

Documentation

You find a mix of various documentation in this directory and subdirectories, using several different formats. Some of them are not ideal for reading directly in your browser.

If you would rather see the rendered version of the documentation, check out the curl website's documentation section for general curl stuff or the libcurl section for libcurl related documentation.