Skip to content

Commit eedc7ec

Browse files
peffgitster
authored andcommitted
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>
1 parent 2fb6a18 commit eedc7ec

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

transport-helper.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,8 @@ static int push_update_ref_status(struct strbuf *buf,
781781

782782
if (starts_with(buf->buf, "option ")) {
783783
struct object_id old_oid, new_oid;
784-
const char *key, *val;
784+
char *key;
785+
const char *val;
785786
char *p;
786787

787788
if (!state->hint || !(state->report || state->new_report))

0 commit comments

Comments
 (0)