linux-qubasis

linux oasis port as a qubes template

git clone https://9o.is/git/linux-qubasis.git

0009-Use-static-inline-function-for-cmp_numbers.patch

(970B)


      1 From f9e192ecdbfd369fe42da4c9b8a3ab90cfa6f10f Mon Sep 17 00:00:00 2001
      2 From: Michael Forney <mforney@mforney.org>
      3 Date: Tue, 25 Jun 2019 00:13:43 -0700
      4 Subject: [PATCH] Use static inline function for cmp_numbers
      5 
      6 All callers use it with an unsigned type, so just specialize for
      7 uintmax_t.
      8 ---
      9  include/c.h | 12 +++++-------
     10  1 file changed, 5 insertions(+), 7 deletions(-)
     11 
     12 diff --git a/include/c.h b/include/c.h
     13 index fe82a8847..eb48e7f77 100644
     14 --- a/include/c.h
     15 +++ b/include/c.h
     16 @@ -153,13 +153,11 @@ umin(uintmax_t x, uintmax_t y)
     17  	return x < y ? x : y;
     18  }
     19  
     20 -#ifndef cmp_numbers
     21 -# define cmp_numbers(x, y) __extension__ ({	\
     22 -	__typeof__(x) _a = (x);			\
     23 -	__typeof__(y) _b = (y);			\
     24 -	(void) (&_a == &_b);			\
     25 -	_a == _b ? 0 : _a > _b ? 1 : -1; })
     26 -#endif
     27 +static inline uintmax_t
     28 +cmp_numbers(uintmax_t x, uintmax_t y)
     29 +{
     30 +	return x == y ? 0 : x > y ? 1 : -1;
     31 +}
     32  
     33  #ifndef offsetof
     34  #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
     35 -- 
     36 2.31.1
     37