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

Re: [PATCH v4 1/3] pretty: make it easier to add new formats

From
Jonathan Nieder <jrnieder@gmail.com>
Date
May 2, 2010, 11:22 UTC
Message-ID
<20100502112231.GA2806@progeny.tock>
In-Reply-To
<1272798044-10487-2-git-send-email-wmpalmer@gmail.com>
Will Palmer wrote:
> As the first step towards creating aliases, we make it easier to add new
> formats to the list of builtin formats.
[...]
Show 6 quoted lines
> +	commit_formats_len = ARRAY_SIZE(builtin_formats);
> +	commit_formats = xcalloc(commit_formats_len,
> +				 sizeof(*builtin_formats));
> +	memcpy(commit_formats, builtin_formats,
> +	       sizeof(*builtin_formats)*ARRAY_SIZE(builtin_formats));
> +}
nitpick: it should be safe to s/xcalloc/xmalloc/
With or without such a change, the patch looks good to me.
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Thanks for the clean patch.
diff --git a/pretty.c b/pretty.c
index ecac8f5..41c0145 100644
--- a/pretty.c
+++ b/pretty.c
@@ -40,7 +40,7 @@ static void setup_commit_formats(void)
 		{ "oneline",	CMIT_FMT_ONELINE,	1 }
 	};
 	commit_formats_len = ARRAY_SIZE(builtin_formats);
-	commit_formats = xcalloc(commit_formats_len,
+	commit_formats = xmalloc(commit_formats_len *
 				 sizeof(*builtin_formats));
 	memcpy(commit_formats, builtin_formats,
 	       sizeof(*builtin_formats)*ARRAY_SIZE(builtin_formats));
Previous: Will PalmerNext: Will Palmer
Message 3 of 11 in “pretty: format aliases”
  1. 0/3 pretty: format aliasesWill Palmer, May 2, 2010
  2. 1/3 pretty: make it easier to add new formatsWill Palmer, May 2, 2010
  3. Jonathan NiederMay 2, 2010
  4. 2/3 pretty: add infrastructure to allow format aliasesWill Palmer, May 2, 2010
  5. Jonathan NiederMay 2, 2010
  6. 3/3 pretty: add aliases for pretty formatsWill Palmer, May 2, 2010
  7. Jonathan NiederMay 2, 2010
  8. Will PalmerMay 2, 2010
  9. pretty: initialize new cmt_fmt_map to 0Jonathan Nieder, May 8, 2010
  10. Will PalmerMay 8, 2010
  11. Junio C HamanoMay 2, 2010

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.