]> Kevux Git Server - rit/commit
transport-helper: drop const to fix strchr() warnings
authorJeff King <peff@peff.net>
Thu, 2 Apr 2026 04:14:56 +0000 (00:14 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Apr 2026 05:08:50 +0000 (22:08 -0700)
commiteedc7ecc66aefa085aae9bf51b56aa11eeb23950
treeb6cb48ac3c0065d0fb3c959300992949b925353a
parent2fb6a18782ff8f2d97b44c8812f9027f3812f970
transport-helper: drop const to fix strchr() warnings

We implicitly drop the const from our "key" variable when we do:

  char *p = strchr(key, ' ');

which causes compilation with some C23 versions of libc (notably recent
glibc) to complain.

We need "p" to remain writable, since we assign NUL over the space we
found. We can solve this by also making "key" writable. This works
because it comes from a strbuf, which is itself a writable string.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
transport-helper.c