Re: [PATCH] git-compat-util.h: introduce CALLOC(x)
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