Re: [PATCH v3 14/20] sha1-array: convert internal storage for struct sha1_array to object_id

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

 



"brian m. carlson" <sandals@xxxxxxxxxxxxxxxxxxxx> writes:

>  	for (i = 0; i < array->nr; i++) {
> -		strbuf_addstr(&joined_hexs, sha1_to_hex(array->sha1[i]));
> +		strbuf_addstr(&joined_hexs, oid_to_hex(array->oid + i));

As I said in the previous round (in my comment on the one that
corresponds to the next patch, which has been updated in this
round), this converts E1[E2] to E1 + E2.

> @@ -621,7 +621,7 @@ static void bisect_rev_setup(struct rev_info *revs, const char *prefix,
>  	argv_array_pushf(&rev_argv, bad_format, oid_to_hex(current_bad_oid));
>  	for (i = 0; i < good_revs.nr; i++)
>  		argv_array_pushf(&rev_argv, good_format,
> -				 sha1_to_hex(good_revs.sha1[i]));
> +				 oid_to_hex(good_revs.oid + i));

Likewise.

> @@ -715,9 +715,9 @@ static struct commit **get_bad_and_good_commits(int *rev_nr)
>  	int i, n = 0;
>  
>  	ALLOC_ARRAY(rev, 1 + good_revs.nr);
> -	rev[n++] = get_commit_reference(current_bad_oid->hash);
> +	rev[n++] = get_commit_reference(current_bad_oid);
>  	for (i = 0; i < good_revs.nr; i++)
> -		rev[n++] = get_commit_reference(good_revs.sha1[i]);
> +		rev[n++] = get_commit_reference(good_revs.oid + i);
>  	*rev_nr = n;

Likewise.

> @@ -53,9 +53,9 @@ int sha1_array_for_each_unique(struct sha1_array *array,
>  
>  	for (i = 0; i < array->nr; i++) {
>  		int ret;
> -		if (i > 0 && !hashcmp(array->sha1[i], array->sha1[i-1]))
> +		if (i > 0 && !oidcmp(array->oid + i, array->oid + i - 1))
>  			continue;

Likewise.

> diff --git a/shallow.c b/shallow.c
> index 11f7dde9d9..dc7b67a294 100644
> --- a/shallow.c
> +++ b/shallow.c
> @@ -273,7 +273,7 @@ static int write_shallow_commits_1(struct strbuf *out, int use_pack_protocol,
>  	if (!extra)
>  		return data.count;
>  	for (i = 0; i < extra->nr; i++) {
> -		strbuf_addstr(out, sha1_to_hex(extra->sha1[i]));
> +		strbuf_addstr(out, oid_to_hex(extra->oid + i));
>  		strbuf_addch(out, '\n');
>  		data.count++;
>  	}

Likewise.

> @@ -417,13 +417,13 @@ void clear_shallow_info(struct shallow_info *info)
>  
>  void remove_nonexistent_theirs_shallow(struct shallow_info *info)
>  {
> -	unsigned char (*sha1)[20] = info->shallow->sha1;
> +	struct object_id *oid = info->shallow->oid;
>  	int i, dst;
>  	trace_printf_key(&trace_shallow, "shallow: remove_nonexistent_theirs_shallow\n");
>  	for (i = dst = 0; i < info->nr_theirs; i++) {
>  		if (i != dst)
>  			info->theirs[dst] = info->theirs[i];
> -		if (has_sha1_file(sha1[info->theirs[i]]))
> +		if (has_object_file(oid + info->theirs[i]))
>  			dst++;
>  	}
>  	info->nr_theirs = dst;

Likewise.

It is so minor that there is no point rerolling the whole thing only
for these, though.

Thanks.




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