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

Re: [PATCH] git-compat-util.h: introduce CALLOC(x)

From
Jeff King <peff@peff.net>
Date
Dec 7, 2022, 06:02 UTC
Message-ID
<Y5AsWvLSwy7EgiHT@coredump.intra.peff.net>
In-Reply-To
<221206.86v8mpcmnt.gmgdl@evledraar.gmail.com>
On Tue, Dec 06, 2022 at 02:58:53AM +0100, Ævar Arnfjörð Bjarmason wrote:
Show 15 quoted lines
> This is probably too ugly to exist, but if we are going to have more
> variants maybe one that would allow use within declarations would be
> better, e.g.:
> 
> 	
> 	diff --git a/attr.c b/attr.c
> 	index 42ad6de8c7c..43ade426e57 100644
> 	--- a/attr.c
> 	+++ b/attr.c
> 	@@ -666,11 +666,10 @@ static void handle_attr_line(struct attr_stack *res,
> 	 
> 	 static struct attr_stack *read_attr_from_array(const char **list)
> 	 {
> 	-	struct attr_stack *res;
> 	+	struct attr_stack *INIT_CALLOC_ARRAY(res, 1);
Yeah. While clever, I would agree that is probably too ugly to exist.
-Peff
Previous: Ævar Arnfjörð BjarmasonNext: Taylor Blau
Message 7 of 21 in “git-compat-util.h: introduce CALLOC(x)”
  1. git-compat-util.h: introduce CALLOC(x)Taylor Blau, Dec 5, 2022
  2. René ScharfeDec 5, 2022
  3. Taylor BlauDec 5, 2022
  4. Ævar Arnfjörð BjarmasonDec 5, 2022
  5. Jeff KingDec 6, 2022
  6. Ævar Arnfjörð BjarmasonDec 6, 2022
  7. Jeff KingDec 7, 2022
  8. Taylor BlauDec 7, 2022
  9. Taylor BlauDec 7, 2022
  10. Ævar Arnfjörð BjarmasonDec 7, 2022
  11. Jeff KingDec 6, 2022
  12. Taylor BlauDec 7, 2022
  13. Ævar Arnfjörð BjarmasonDec 7, 2022
  14. Junio C HamanoDec 5, 2022
  15. Taylor BlauDec 6, 2022
  16. Jeff KingDec 6, 2022
  17. Junio C HamanoDec 6, 2022
  18. Taylor BlauDec 7, 2022
  19. Jeff KingDec 7, 2022
  20. Ævar Arnfjörð BjarmasonDec 6, 2022
  21. Jeff KingDec 7, 2022

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.