[blivet:master 03/20] Do not compare the same two values twice.

Vratislav Podzimek vpodzime at redhat.com
Mon Jan 5 07:44:49 UTC 2015


On Tue, 2014-12-23 at 18:42 -0500, mulhern wrote:
> If x and y are Sizes, not (x < y) implies x >= y.
> 
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
>  blivet/devicelibs/swap.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/blivet/devicelibs/swap.py b/blivet/devicelibs/swap.py
> index bcc0308..4e31cdb 100644
> --- a/blivet/devicelibs/swap.py
> +++ b/blivet/devicelibs/swap.py
> @@ -146,10 +146,10 @@ def swapSuggestion(quiet=False, hibernation=False, disk_space=None):
>      if mem < two_GiB:
>          swap = 2 * mem
>  
> -    elif two_GiB <= mem < eight_GiB:
> +    elif mem < eight_GiB:
>          swap = mem
>  
> -    elif eight_GiB <= mem < sixtyfour_GiB:
> +    elif mem < sixtyfour_GiB:
>          swap = mem / 2
The condition was intentionally written like this to be as clear and
nice readable as possible because it is quite often target of people
outside of our team. I don't think we need to optimize this code.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list