From 6f85c237b2ab5ae08945e95e06945e2da5a57a05 Mon Sep 17 00:00:00 2001 From: Michael Forney 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 70db9f60..162bad41 100644 --- a/include/utils.h +++ b/include/utils.h @@ -275,13 +275,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.32.0