From 19ff8ff7c448e4e88e602dde0af4230bff5b4daa Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 4 Dec 2014 10:27:39 +0100 Subject: libfdisk: fix cfdisk freespace analyze The problem is how fdisk_partition_cmp_start() compare numbers, the function returns result from "a->start - b->start", unfortunately the numbers are uint64, but function returns "int". Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1170191 Signed-off-by: Karel Zak --- include/c.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/c.h') diff --git a/include/c.h b/include/c.h index 0f6e5b29b..142583956 100644 --- a/include/c.h +++ b/include/c.h @@ -107,6 +107,14 @@ _max1 > _max2 ? _max1 : _max2; }) #endif +#ifndef cmp_numbers +# define cmp_numbers(x, y) __extension__ ({ \ + __typeof__(x) _a = (x); \ + __typeof__(y) _b = (y); \ + (void) (&_a == &_b); \ + a == b ? 0 : a > b ? 1 : -1; }) +#endif + #ifndef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif -- cgit v1.2.3-55-g7522