Re: [PATCH 09/17] builtin/merge: convert to struct object_id

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

 



On 01/01/2017 08:18 PM, brian m. carlson wrote:
> Additionally convert several uses of the constant 40 into
> GIT_SHA1_HEXSZ.
> 
> Signed-off-by: brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx>
> ---
>  builtin/merge.c | 136 ++++++++++++++++++++++++++++----------------------------
>  1 file changed, 68 insertions(+), 68 deletions(-)
> 
> [...]
> @@ -437,25 +437,25 @@ static void merge_name(const char *remote, struct strbuf *msg)
>  	strbuf_branchname(&bname, remote);
>  	remote = bname.buf;
>  
> -	memset(branch_head, 0, sizeof(branch_head));
> +	memset(&branch_head, 0, sizeof(branch_head));

I think this could be

        oidclr(&branch_head);

>  	remote_head = get_merge_parent(remote);
>  	if (!remote_head)
>  		die(_("'%s' does not point to a commit"), remote);
> [...]
> @@ -1113,9 +1113,9 @@ static struct commit_list *collect_parents(struct commit *head_commit,
>  
>  int cmd_merge(int argc, const char **argv, const char *prefix)
>  {
> -	unsigned char result_tree[20];
> -	unsigned char stash[20];
> -	unsigned char head_sha1[20];
> +	struct object_id result_tree;
> +	struct object_id stash;
> +	struct object_id head_oid;

These could comfortably be declared on a single line now.

>  	struct commit *head_commit;
>  	struct strbuf buf = STRBUF_INIT;
>  	const char *head_arg;
> [...]

Michael




[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]