shared: add NM_MAX_WITH_CMP() macro

(cherry picked from commit e0191d4201)
This commit is contained in:
Thomas Haller 2018-12-03 11:09:32 +01:00
parent 35eedebfcf
commit 7c07c59aa3

View file

@ -1324,6 +1324,16 @@ nm_strcmp_p (gconstpointer a, gconstpointer b)
: NM_UNIQ_T(X,xq)); \
})
#define NM_MAX_WITH_CMP(cmp, a, b) \
({ \
typeof (a) _a = (a); \
typeof (b) _b = (b); \
\
( ((cmp (_a, _b)) >= 0) \
? _a \
: _b); \
})
/*****************************************************************************/
static inline guint