Re: [PATCH] remote.c: convert if-else tower to switch

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

 



On Wed, Aug 06, 2025 at 09:30:20PM -0700, Denton Liu wrote:
> For better readability, convert the if-else tower into a switch
> statement.
> 
> Signed-off-by: Denton Liu <liu.denton@xxxxxxxxx>
> ---
> Thanks for the suggestion, both. Please queue this patch wherever it
> makes the most sense to do so (either with the existing series or on its
> own separate branch).
> 
>  remote.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/remote.c b/remote.c
> index 465e0ea0eb..c7ae18fcfa 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -1197,29 +1197,35 @@ static void show_push_unqualified_ref_name_error(const char *dst_value,
>  		    "match_explicit_lhs() should catch this!",
>  		    matched_src_name);
>  	type = odb_read_object_info(the_repository->objects, &oid, NULL);

Nit: we can also drop the `type` variable, we don't need it for anything
but the value of the switch as far as I can see.

Thanks!

Patrick




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

  Powered by Linux