[PATCH] ui-refs.c: Simplify and inline cmp_age()
Jason A. Donenfeld
Jason at zx2c4.com
Tue Feb 4 20:27:26 CET 2014
zx2c4 at thinkpad ~ $ cat a.c
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;
}
static int cmp_age2(int age1, int age2)
{
return age2 - age1;
}
void main()
{
printf("%d %d\n", cmp_age(-1, 0), cmp_age2(-1, 0));
}
zx2c4 at thinkpad ~ $ gcc a.c
zx2c4 at thinkpad ~ $ ./a.out
-1 1
More information about the CGit
mailing list