master hovercats/oakiss / pkg / iproute2 / patch / 0011-Use-static-inline-function-for-min.patch
 1From eb780d31a912363846e54266db7395a82f14ebb2 Mon Sep 17 00:00:00 2001
 2From: Michael Forney <mforney@mforney.org>
 3Date: Mon, 24 Jun 2019 17:38:56 -0700
 4Subject: [PATCH] Use static inline function for min()
 5
 6It is only called to calculate a minimum `int`, so specialize for
 7`int`.
 8---
 9 include/utils.h | 11 ++++-------
10 1 file changed, 4 insertions(+), 7 deletions(-)
11
12diff --git a/include/utils.h b/include/utils.h
13index 9ba129b8..a8a56fca 100644
14--- a/include/utils.h
15+++ b/include/utils.h
16@@ -279,13 +279,10 @@ unsigned int print_name_and_link(const char *fmt,
17 # define offsetof(type, member) ((size_t) &((type *)0)->member)
18 #endif
19 
20-#ifndef min
21-# define min(x, y) ({			\
22-	typeof(x) _min1 = (x);		\
23-	typeof(y) _min2 = (y);		\
24-	(void) (&_min1 == &_min2);	\
25-	_min1 < _min2 ? _min1 : _min2; })
26-#endif
27+static inline int min(int a, int b)
28+{
29+	return a < b ? a : b;
30+}
31 
32 #ifndef max
33 # define max(x, y) ({			\
34-- 
352.44.0
36