[PATCH] ui-refs.c: Simplify and inline cmp_age()

Lukas Fleischer cgit at cryptocrack.de
Tue Feb 4 20:27:56 CET 2014


On Tue, 04 Feb 2014 at 20:26:32, Jason A. Donenfeld wrote:
> On Tue, Feb 4, 2014 at 8:22 PM, Lukas Fleischer <cgit at cryptocrack.de> wrote:
> >
> >     return age2 - age1;
> > -static int cmp_age(int age1, int age2)
> > -{
> > -       if (age1 != 0 && age2 != 0)
> > -               return age2 - age1;
> > -
> > -       if (age1 == 0 && age2 == 0)
> > -               return 0;
> > -
> > -       if (age1 == 0)
> > -               return +1;
> > -
> > -       return -1;
> > -}
> 
> 
> cmp_age(-1, 0) returns -1
> 
> 0 - -1 returns 1

Can the age ever be negative?


More information about the CGit mailing list