Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: rsync: remove some unneeded else statements
To:
tech@openbsd.org
Date:
Wed, 20 Mar 2024 03:19:50 +1000

Download raw body.

Thread
On Tue, Mar 19, 2024 at 04:54:02PM +0100, Claudio Jeker wrote:
> Kill some more if () { return; } else if () { } constructs.
> It makes the code easier to read.

Yes. ok

> 
> -- 
> :wq Claudio
> 
> Index: sender.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/rsync/sender.c,v
> diff -u -p -r1.32 sender.c
> --- sender.c	27 Feb 2024 11:28:30 -0000	1.32
> +++ sender.c	28 Feb 2024 09:50:49 -0000
> @@ -588,7 +588,8 @@ rsync_sender(struct sess *sess, int fdin
>  			    &up, &wbuf, &wbufsz, &wbufmax, fl)) {
>  				ERRX1("send_up_fsm");
>  				goto out;
> -			} else if (phase > 1)
> +			}
> +			if (phase > 1)
>  				break;
>  		}
>  
> @@ -664,7 +665,8 @@ rsync_sender(struct sess *sess, int fdin
>  	if (!io_read_int(sess, fdin, &idx)) {
>  		ERRX1("io_read_int");
>  		goto out;
> -	} else if (idx != -1) {
> +	}
> +	if (idx != -1) {
>  		ERRX("read incorrect update complete ack");
>  		goto out;
>  	}
>