git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] http: use xmalloc with cURL

From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
Date
Aug 15, 2019, 19:13 UTC
Message-ID
<20190815191314.27440-1-carenas@gmail.com>
In-Reply-To
<20190815153504.23199-1-carenas@gmail.com>

f0ed8226c9 (Add custom memory allocator to MinGW and MacOS builds, 2009-05-31) never told cURL about it.

Correct that by using the cURL initializer available since version 7.12 to point to xmalloc and friends for consistency which then will pass the allocation requests along when USE_NED_ALLOCATOR=YesPlease is used (most likely in Windows)

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
Notes:
    v2: keep all global_init ifdefs together (as suggested by Junio)
 http.h | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/http.h b/http.h
index b429f1cf04..20a2030c94 100644
--- a/http.h
+++ b/http.h
@@ -25,8 +25,12 @@
 #if LIBCURL_VERSION_NUM < 0x070704
 #define curl_global_cleanup() do { /* nothing */ } while (0)
 #endif
+
 #if LIBCURL_VERSION_NUM < 0x070800
 #define curl_global_init(a) do { /* nothing */ } while (0)
+#elseif LIBCURL_VERSION_NUM >= 0x070c00
+#define curl_global_init(a) curl_global_init_mem(a, xmalloc, free, \
+						xrealloc, xstrdup, xcalloc)
 #endif
 
 #if (LIBCURL_VERSION_NUM < 0x070c04) || (LIBCURL_VERSION_NUM == 0x071000)

base-commit: 9827d4c185e4da728f51cd77c54a38c9de62495f
-- 
2.23.0.rc2
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 6 in “http: use xmalloc with cURL”
  1. http: use xmalloc with cURLCarlo Marcelo Arenas Belón, Aug 15, 2019
  2. Junio C HamanoAug 15, 2019
  3. http: use xmalloc with cURLCarlo Marcelo Arenas Belón, Aug 15, 2019
  4. Junio C HamanoAug 15, 2019
  5. http: use xmalloc with cURLCarlo Marcelo Arenas Belón, Aug 15, 2019
  6. Junio C HamanoAug 15, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.