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

Re: [PATCH] clean: use warning_errno() when appropriate

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 13, 2017, 20:38 UTC
Message-ID
<xmqqk28tddwo.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170213191433.muwhz7zem64p3rxr@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> I wonder if xmalloc() should be the one doing the saved_errno trick.
> After all, it has only two outcomes: we successfully allocated the
> memory, or we called die().

I would be lying if I said I did not considered it when I wrote the message you are responding to, but I rejected it because that would be optimizing for a wrong case, in that most callers of xmalloc() and friends do not do so in the error codepath, and we would be penalizing them by doing the saved_errno dance unconditionally.

Previous: Jeff KingNext: Jeff King
Message 4 of 13 in “clean: use warning_errno() when appropriate”
  1. clean: use warning_errno() when appropriateNguyễn Thái Ngọc Duy, Feb 13, 2017
  2. Junio C HamanoFeb 13, 2017
  3. Jeff KingFeb 13, 2017
  4. Junio C HamanoFeb 13, 2017
  5. Jeff KingFeb 13, 2017
  6. Junio C HamanoFeb 13, 2017
  7. Jeff KingFeb 13, 2017
  8. Junio C HamanoFeb 13, 2017
  9. clean: use warning_errno() when appropriateNguyễn Thái Ngọc Duy, Feb 14, 2017
  10. Junio C HamanoFeb 14, 2017
  11. Duy NguyenFeb 15, 2017
  12. Junio C HamanoFeb 15, 2017
  13. Jeff KingFeb 15, 2017

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.