From: Jeff King Date: Mon, 19 Jan 2026 05:19:45 +0000 (-0500) Subject: remote: return non-const pointer from error_buf() X-Git-Tag: v2.54.0-rc0~223^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9500b2131d29960d3fbd35559c063f7a74568875;p=thirdparty%2Fgit.git remote: return non-const pointer from error_buf() 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 Signed-off-by: Junio C Hamano --- diff --git a/remote.c b/remote.c index df9675cd33..246c8b92e2 100644 --- 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;