diff options
| author | Michael Forney <mforney@mforney.org> | 2024-03-21 23:29:18 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2024-03-21 23:29:18 -0700 |
| commit | 594971b59caa1d75f0179de8d612375f410a7566 (patch) | |
| tree | dd14cb80cc3c90a9019b0d9442a2dd8d6a02d9df /pkg/iproute2/patch/0011-Use-static-inline-function-for-min.patch | |
| parent | 01eb93d6f752c2bb3815bb794572231651f105fa (diff) | |
Remove obsolete portability patches with C23 and new cproc
Diffstat (limited to 'pkg/iproute2/patch/0011-Use-static-inline-function-for-min.patch')
| -rw-r--r-- | pkg/iproute2/patch/0011-Use-static-inline-function-for-min.patch | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/pkg/iproute2/patch/0011-Use-static-inline-function-for-min.patch b/pkg/iproute2/patch/0011-Use-static-inline-function-for-min.patch new file mode 100644 index 00000000..f5b6088a --- /dev/null +++ b/pkg/iproute2/patch/0011-Use-static-inline-function-for-min.patch @@ -0,0 +1,36 @@ +From eb780d31a912363846e54266db7395a82f14ebb2 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Mon, 24 Jun 2019 17:38:56 -0700 +Subject: [PATCH] Use static inline function for min() + +It is only called to calculate a minimum `int`, so specialize for +`int`. +--- + include/utils.h | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/include/utils.h b/include/utils.h +index 9ba129b8..a8a56fca 100644 +--- a/include/utils.h ++++ b/include/utils.h +@@ -279,13 +279,10 @@ unsigned int print_name_and_link(const char *fmt, + # define offsetof(type, member) ((size_t) &((type *)0)->member) + #endif + +-#ifndef min +-# define min(x, y) ({ \ +- typeof(x) _min1 = (x); \ +- typeof(y) _min2 = (y); \ +- (void) (&_min1 == &_min2); \ +- _min1 < _min2 ? _min1 : _min2; }) +-#endif ++static inline int min(int a, int b) ++{ ++ return a < b ? a : b; ++} + + #ifndef max + # define max(x, y) ({ \ +-- +2.44.0 + |
