logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 991c95f4d95555a815f5434fbe350303519f5c3e
parent 264e137e0225b8c9e8b411c26da02447f5d71dd3
Author: Michael Forney <mforney@mforney.org>
Date:   Mon, 24 Jun 2019 17:12:44 -0700

iproute2: Fix a few more portability issues

Diffstat:

Apkg/iproute2/patch/0013-Use-alloca-instead-of-VLA-when-VLA-is-not-available.patch44++++++++++++++++++++++++++++++++++++++++++++
Apkg/iproute2/patch/0014-Use-static-inline-function-for-min.patch36++++++++++++++++++++++++++++++++++++
Mpkg/iproute2/ver2+-
3 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/pkg/iproute2/patch/0013-Use-alloca-instead-of-VLA-when-VLA-is-not-available.patch b/pkg/iproute2/patch/0013-Use-alloca-instead-of-VLA-when-VLA-is-not-available.patch @@ -0,0 +1,44 @@ +From cbdee3bebdd860293f5c6803e4afebfea307e205 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Mon, 24 Jun 2019 16:48:56 -0700 +Subject: [PATCH] Use alloca instead of VLA when VLA is not available + +--- + ip/ipaddress.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/ip/ipaddress.c b/ip/ipaddress.c +index e440fac4..2fb82076 100644 +--- a/ip/ipaddress.c ++++ b/ip/ipaddress.c +@@ -247,7 +247,12 @@ static void print_linktype(FILE *fp, struct rtattr *tb) + + lu = get_link_kind(kind); + if (lu && lu->print_opt) { +- struct rtattr *attr[lu->maxattr+1], **data = NULL; ++#ifndef __STDC_NO_VLA ++ struct rtattr **attr = alloca((lu->maxattr+1)*sizeof(attr[0])); ++#else ++ struct rtattr *attr[lu->maxattr+1]; ++#endif ++ struct rtattr **data = NULL; + + if (linkinfo[IFLA_INFO_DATA]) { + parse_rtattr_nested(attr, lu->maxattr, +@@ -281,7 +286,12 @@ static void print_linktype(FILE *fp, struct rtattr *tb) + + slave_lu = get_link_kind(slave); + if (slave_lu && slave_lu->print_opt) { +- struct rtattr *attr[slave_lu->maxattr+1], **data = NULL; ++#ifndef __STDC_NO_VLA ++ struct rtattr **attr = alloca((slave_lu->maxattr+1)*sizeof(attr[0])); ++#else ++ struct rtattr *attr[slave_lu->maxattr+1]; ++#endif ++ struct rtattr **data = NULL; + + if (linkinfo[IFLA_INFO_SLAVE_DATA]) { + parse_rtattr_nested(attr, slave_lu->maxattr, +-- +2.22.0 + diff --git a/pkg/iproute2/patch/0014-Use-static-inline-function-for-min.patch b/pkg/iproute2/patch/0014-Use-static-inline-function-for-min.patch @@ -0,0 +1,36 @@ +From 93601123c369ccc18d71e02724a80f118ab1ee0c 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 8a9c3020..e9d35409 100644 +--- a/include/utils.h ++++ b/include/utils.h +@@ -271,13 +271,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 __check_format_string + # define __check_format_string(pos_str, pos_args) \ +-- +2.22.0 + diff --git a/pkg/iproute2/ver b/pkg/iproute2/ver @@ -1 +1 @@ -5.1.0 r2 +5.1.0 r3