]> git.ipfire.org Git - thirdparty/git.git/commitdiff
remote: return non-const pointer from error_buf()
authorJeff King <peff@peff.net>
Mon, 19 Jan 2026 05:19:45 +0000 (00:19 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 20 Jan 2026 00:24:02 +0000 (16:24 -0800)
We have an error_buf() helper that functions a bit like our error()
helper, but returns NULL instead of -1. Its return type is "const char
*", but this is overly restrictive. If we use the helper in a function
that returns non-const "char *", the compiler will complain about
the implicit cast from const to non-const.

Meanwhile, the const in the helper is doing nothing useful, as it only
ever returns NULL. Let's drop the const, which will let us use it in
both types of function.

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

index df9675cd330ed1e0a1c4256dc19d3e73828f2fb2..246c8b92e2584c2397d82fb50813f95e4fe4a973 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -1838,7 +1838,7 @@ int branch_merge_matches(struct branch *branch,
 }
 
 __attribute__((format (printf,2,3)))
-static const char *error_buf(struct strbuf *err, const char *fmt, ...)
+static char *error_buf(struct strbuf *err, const char *fmt, ...)
 {
        if (err) {
                va_list ap;