summaryrefslogtreecommitdiffstats
path: root/contrib/persistent-https
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2026-04-02 00:15:10 -0400
committerJunio C Hamano <gitster@pobox.com>2026-04-01 22:08:52 -0700
commitd3cd819e8bb21189b7bf3b2718898b610b85b119 (patch)
treeed09cb433dc1ae0f4ba61c8432acc330f9a70124 /contrib/persistent-https
parentcefb8b7b47415aff6ad3ecdc6f3c546fa7abfd16 (diff)
downloadgit-d3cd819e8bb21189b7bf3b2718898b610b85b119.tar.gz
git-d3cd819e8bb21189b7bf3b2718898b610b85b119.zip
pkt-line: make packet_reader.line non-const
The "line" member of a packet_reader struct is marked as const. This kind of makes sense, because it's not its own allocated buffer that should be freed, and we often use const to indicate that. But it is always writable, because it points into the non-const "buffer" member. And we rely on this writability in places like send-pack and receive-pack, where we parse incoming packet contents by writing NULs over delimiters. This has traditionally worked because we implicitly cast away the constness with strchr() like: const char *head; char *p; head = reader->line; p = strchr(head, ' '); Since C23 libc provides a generic strchr() to detect this implicit const removal, this now generate a compiler warning on some platforms (like recent glibc). We can fix it by marking "line" as non-const, as well as a few intermediate variables (like "head" in the above example). Note that by itself, switching to a non-const variable would cause problems with this line in send-pack.c: if (!skip_prefix(reader->line, "unpack ", &reader->line)) But due to our skip_prefix() magic introduced in the previous commit, this compiles fine (both the in and out-parameters are non-const, so we know it is safe). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions