Web lists-archives.com

Re: [PATCH v6 09/12] fixup: sha1_file: convert gotos to break/continue




Jeff Hostetler <git@xxxxxxxxxxxxxxxxx> writes:

> From: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx>
>
> Signed-off-by: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx>
> ---
>  sha1_file.c | 40 ++++++++++++++++++++--------------------
>  1 file changed, 20 insertions(+), 20 deletions(-)

The second (i.e. this) part and the third part are not yet in
'next', so it will perfectly be fine to squash these into the
commits that introduces the issues that are corrected in this
"fixup".  The same comment applies to all the other "fixup" patches.



>
> diff --git a/sha1_file.c b/sha1_file.c
> index fc7718a..ce67f27 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -1180,30 +1180,30 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
>  		}
>  	}
>  
> -retry:
> -	if (find_pack_entry(real, &e))
> -		goto found_packed;
> +	while (1) {
> +		if (find_pack_entry(real, &e))
> +			break;
>  
> -	/* Most likely it's a loose object. */
> -	if (!sha1_loose_object_info(real, oi, flags))
> -		return 0;
> +		/* Most likely it's a loose object. */
> +		if (!sha1_loose_object_info(real, oi, flags))
> +			return 0;
>  
> -	/* Not a loose object; someone else may have just packed it. */
> -	reprepare_packed_git();
> -	if (find_pack_entry(real, &e))
> -		goto found_packed;
> -
> -	/* Check if it is a missing object */
> -	if (fetch_if_missing && repository_format_partial_clone &&
> -	    !already_retried) {
> -		fetch_object(repository_format_partial_clone, real);
> -		already_retried = 1;
> -		goto retry;
> -	}
> +		/* Not a loose object; someone else may have just packed it. */
> +		reprepare_packed_git();
> +		if (find_pack_entry(real, &e))
> +			break;
>  
> -	return -1;
> +		/* Check if it is a missing object */
> +		if (fetch_if_missing && repository_format_partial_clone &&
> +		    !already_retried) {
> +			fetch_object(repository_format_partial_clone, real);
> +			already_retried = 1;
> +			continue;
> +		}
> +
> +		return -1;
> +	}
>  
> -found_packed:
>  	if (oi == &blank_oi)
>  		/*
>  		 * We know that the caller doesn't actually need the