From: Junio C Hamano <gitster@pobox.com>
To: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Cc: git@vger.kernel.org, Johannes.Schindelin@gmx.de, daniel@haxx.se,
peff@peff.net
Subject: Re: [PATCH] http: use xmalloc with cURL
Date: Thu, 15 Aug 2019 10:11:17 -0700 [thread overview]
Message-ID: <xmqq5zmy4ami.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20190815153504.23199-1-carenas@gmail.com> ("Carlo Marcelo Arenas Belón"'s message of "Thu, 15 Aug 2019 08:35:04 -0700")
Carlo Marcelo Arenas Belón <carenas@gmail.com> writes:
> 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>
> ---
> This doesn't conflict with anything and was originally based on maint (so it
> applies cleanly also to master and next), but is now rebased on top of
> jk/drop-release-pack-memory so the final product wouldn't have any chance to
> introduce problems (thanks Peff)
>
> it has been built and tested in Windows through Azure Pipelines (thanks Dscho)
> and shouldn't introduce any build problems even with ancient versions or cURL
> (thanks Daniel) and while not strictly needed is a nice thing to have for
> consistency (thanks Junio)
Thanks, all. I do not think I did anything that deserves a
"thanks", but anyway.
> http.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/http.h b/http.h
> index b429f1cf04..e5f075dcbf 100644
> --- a/http.h
> +++ b/http.h
> @@ -22,9 +22,15 @@
> #define DEFAULT_MAX_REQUESTS 5
> #endif
>
> +#if LIBCURL_VERSION_NUM >= 0x070c00
> +#define curl_global_init(a) curl_global_init_mem(a, xmalloc, free, \
> + xrealloc, xstrdup, xcalloc)
> +#endif
> +
> #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)
> #endif
The earlier version had definitions pertaining to curl_global_init()
at a single place, but the above version allows arbitrary amount of
unrelated stuff to be placed in between two definitions in future
updates. Is that a good idea? I sort of expected "we always call
global_init(), but if curl is old enough to lack it, define it as
empty, and if curl is new enough to have curl_global_init_mem(),
then call it instead" #if/#else/#if/#endif/#endif cascade.
>
> base-commit: 9827d4c185e4da728f51cd77c54a38c9de62495f
next prev parent reply other threads:[~2019-08-15 17:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-15 15:35 [PATCH] http: use xmalloc with cURL Carlo Marcelo Arenas Belón
2019-08-15 17:11 ` Junio C Hamano [this message]
2019-08-15 19:13 ` [PATCH v2] " Carlo Marcelo Arenas Belón
2019-08-15 19:34 ` Junio C Hamano
2019-08-15 21:44 ` [PATCH v3] " Carlo Marcelo Arenas Belón
2019-08-15 22:18 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq5zmy4ami.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=carenas@gmail.com \
--cc=daniel@haxx.se \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).