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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Will Palmer wrote:

> As the first step towards creating aliases, we make it easier to add new
> formats to the list of builtin formats.
[...]
> +	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@xxxxxxxxx>

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));
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]