Re: [PATCH v8 10/11] convert: make apply_filter() adhere to standard Git error handling

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

 



W dniu 20.09.2016 o 21:02, larsxschneider@xxxxxxxxx pisze:
> From: Lars Schneider <larsxschneider@xxxxxxxxx>
> 
> apply_filter() returns a boolean that tells the caller if it
> "did convert or did not convert". The variable `ret` was used throughout
> the function to track errors whereas `1` denoted success and `0`
> failure. This is unusual for the Git source where `0` denotes success.
> 
> Rename the variable and flip its value to make the function easier
> readable for Git developers.

This also allow to use the 'err = error("<error message>");' idiom,
isn't it...

> 
> Signed-off-by: Lars Schneider <larsxschneider@xxxxxxxxx>
> ---
>  convert.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)

...which allows to delete some lines of code.  Very nice.

> -	int ret = 1;
> +	int err = 0;

> -		error("read from external filter '%s' failed", cmd);
> -		ret = 0;
> +		err = error("read from external filter '%s' failed", cmd);

> -	if (ret) {
> +	if (!err) {

> -	return ret;
> +	return !err;

Looks good.




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