]> git.ipfire.org Git - thirdparty/git.git/commit
curl: fix integer constant typechecks with curl_easy_setopt()
authorJeff King <peff@peff.net>
Wed, 4 Jun 2025 20:55:13 +0000 (16:55 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 4 Jun 2025 21:17:53 +0000 (14:17 -0700)
commit6f11c42e8edc5cf7d65156c9dd68e720f1b92229
treef49b8cb39a3990626fca5fe532b3e5bd13d0fbce
parent0bd2d791cc9f745ebaedafc0e1cbebdebe41343e
curl: fix integer constant typechecks with curl_easy_setopt()

The curl documentation specifies that curl_easy_setopt() takes either:

  ...a long, a function pointer, an object pointer or a curl_off_t,
  depending on what the specific option expects.

But when we pass an integer constant like "0", it will by default be a
regular non-long int. This has always been wrong, but seemed to work in
practice (I didn't dig into curl's implementation to see whether this
might actually be triggering undefined behavior, but it seems likely and
regardless we should do what the docs say).

This is especially important since curl has a type-checking macro that
causes building against curl 8.14 to produce many warnings. The specific
commit is due to their 79b4e56b3 (typecheck-gcc.h: fix the typechecks,
2025-04-22). Curiously, it does only seem to trigger when compiled with
-O2 for me.

We can fix it by just marking the constants with a long "L".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-push.c
http.c
remote-curl.c