git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/4] remote: return non-const pointer from error_buf()

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 20, 2026, 00:28 UTC
Message-ID
<xmqqikcx3z5x.fsf@gitster.g>
In-Reply-To
<aW3QVkpPPHjKVNLC@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 7 quoted lines
> This function signature is indeed quite misleading, and I'd argue that
> it continues to be so even after the change. I guess the intent is to
> make it a bit easier to print an error in functions that return a
> string.
>
> I'm not really a huge fan of this, but it's not a fault of this patch
> series, so let's read on.

I concur. "If they do not return any useful value, they should be void" was my first reaction, but presumably just like "return error("message");" is a handy way to give message while signalling an error to the caller, these are used to return NULL that signals an error? I do not offhand think of a good longer-term direction to improve this one.

Previous: Patrick SteinhardtNext: Jeff King
Message 4 of 15 in “memory leaks in remote.c”
  1. 0/4 memory leaks in remote.cJeff King, Jan 19, 2026
  2. 1/4 remote: return non-const pointer from error_buf()Jeff King, Jan 19, 2026
  3. Patrick SteinhardtJan 19, 2026
  4. Junio C HamanoJan 20, 2026
  5. Jeff KingJan 20, 2026
  6. Junio C HamanoJan 20, 2026
  7. 2/4 remote: drop const return of tracking_for_push_dest()Jeff King, Jan 19, 2026
  8. Patrick SteinhardtJan 19, 2026
  9. 3/4 remote: fix leak in branch_get_push_1() with invalid "simple" configJeff King, Jan 19, 2026
  10. Patrick SteinhardtJan 19, 2026
  11. 4/4 remote: always allocate branch.push_tracking_refJeff King, Jan 19, 2026
  12. Patrick SteinhardtJan 19, 2026
  13. Triangular workflowHarald Nordgren, Jan 19, 2026
  14. Jeff KingJan 20, 2026
  15. Junio C HamanoJan 20, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.