Re: [PATCH 1/5] remote: trivial style cleanup

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

 



Felipe Contreras <felipe.contreras@xxxxxxxxx> writes:

> Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
> ---
>  remote.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/remote.c b/remote.c
> index 68eb99b..e71f66d 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -1474,8 +1474,7 @@ struct branch *branch_get(const char *name)
>  		ret->remote = remote_get(ret->remote_name);
>  		if (ret->merge_nr) {
>  			int i;
> -			ret->merge = xcalloc(sizeof(*ret->merge),
> -					     ret->merge_nr);
> +			ret->merge = xcalloc(ret->merge_nr, sizeof(*ret->merge));

Yeah, calloc is nmemb first and then size, so this makes sense.

>  			for (i = 0; i < ret->merge_nr; i++) {
>  				ret->merge[i] = xcalloc(1, sizeof(**ret->merge));
>  				ret->merge[i]->src = xstrdup(ret->merge_name[i]);
--
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]