[PATCH 1/9] consolidation of MIN and MAX macros in common.h
From: Jens Osterkamp <hidden>
Date: 2010-11-08 16:11:52
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Jens Osterkamp <hidden>
Date: 2010-11-08 16:11:52
Subsystem:
the rest · Maintainer:
Linus Torvalds
This patch consolidates a modified version of the already existing MIN macro in lldpad to include/common.h and add a MAX macro. Signed-off-by: Jens Osterkamp <redacted> --- include/common.h | 14 ++++++++++++++ include/dcb_protocol.h | 4 ---- 2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/include/common.h b/include/common.h
index 01746ea..ab07dc2 100644
--- a/include/common.h
+++ b/include/common.h@@ -387,4 +387,18 @@ typedef int socklen_t; const char * wpa_ssid_txt(u8 *ssid, size_t ssid_len); +#define MIN(x,y) \ + ({ \ + typeof (x) __x = (x); \ + typeof (y) __y = (y); \ + __x < __y ? __x : __y; \ + }) + +#define MAX(x,y) \ + ({ \ + typeof (x) __x = (x); \ + typeof (y) __y = (y); \ + __x > __y ? __x : __y; \ + }) + #endif /* COMMON_H */
diff --git a/include/dcb_protocol.h b/include/dcb_protocol.h
index 63e2d3c..d7127f5 100644
--- a/include/dcb_protocol.h
+++ b/include/dcb_protocol.h@@ -58,10 +58,6 @@ typedef enum { #define DUP_DCBX_TLV_LLINK 0x0020 #define TOO_MANY_NGHBRS 0x0040 -//#ifndef min /*todo: change to min() - #define MIN(x, y) ((x) < (y) ? x : y) -//#endif - #define INIT_DCB_OUI {0x00,0x1b,0x21} int add_adapter(char *device_name);
--
1.7.1