summaryrefslogtreecommitdiff
path: root/pkg/util-linux/patch/0009-Use-static-inline-function-for-cmp_numbers.patch
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2020-01-21 15:40:06 -0800
committerMichael Forney <mforney@mforney.org>2020-01-21 15:40:06 -0800
commitea88d8b06ba2ae5df56e34badc103f0c5e274826 (patch)
tree5b59fe9c9c34cb236b24d70f212c6fd56b48aa06 /pkg/util-linux/patch/0009-Use-static-inline-function-for-cmp_numbers.patch
parentd1c3f5f5cc94c6f1d2926e9f6a3742a534f280db (diff)
util-linux: Update to 2.35
Diffstat (limited to 'pkg/util-linux/patch/0009-Use-static-inline-function-for-cmp_numbers.patch')
-rw-r--r--pkg/util-linux/patch/0009-Use-static-inline-function-for-cmp_numbers.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/pkg/util-linux/patch/0009-Use-static-inline-function-for-cmp_numbers.patch b/pkg/util-linux/patch/0009-Use-static-inline-function-for-cmp_numbers.patch
new file mode 100644
index 00000000..ac10211b
--- /dev/null
+++ b/pkg/util-linux/patch/0009-Use-static-inline-function-for-cmp_numbers.patch
@@ -0,0 +1,37 @@
+From 57af96ed8831118d42647b5dafcdf4f296877074 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Tue, 25 Jun 2019 00:13:43 -0700
+Subject: [PATCH] Use static inline function for cmp_numbers
+
+All callers use it with an unsigned type, so just specialize for
+uintmax_t.
+---
+ include/c.h | 12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/include/c.h b/include/c.h
+index 7201b18af..549f1fa24 100644
+--- a/include/c.h
++++ b/include/c.h
+@@ -138,13 +138,11 @@ umin(uintmax_t x, uintmax_t y)
+ return x < y ? x : y;
+ }
+
+-#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
++static inline uintmax_t
++cmp_numbers(uintmax_t x, uintmax_t y)
++{
++ return x == y ? 0 : x > y ? 1 : -1;
++}
+
+ #ifndef offsetof
+ #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+--
+2.25.0
+