From 21c979eb1793e89ef19d96d746f6971a0c05be03 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 30 Oct 2023 08:34:08 +0100 Subject: [PATCH] glib: undef MIN()/MAX() to make it unusable (use NM variants) NM variants: - evaluate arguments only once - have a static assertion that the signedness of the argument agrees. Like MIN()/MAX(), NM_MIN()/NM_MAX() now also evaluate to a constant expression, if the arguments are already constant. That means, the only reason why MIN()/MAX() was preferable over NM_MIN()/NM_MAX() is no longer relevant. Except there are a few places where NM_MIN()/NM_MAX() cannot be used. In those places use NM_MIN_CONST()/NM_MAX_CONST(). --- src/libnm-glib-aux/nm-glib.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libnm-glib-aux/nm-glib.h b/src/libnm-glib-aux/nm-glib.h index 9c90d4299d..8d1208cf08 100644 --- a/src/libnm-glib-aux/nm-glib.h +++ b/src/libnm-glib-aux/nm-glib.h @@ -766,4 +766,10 @@ _nm_deprecated("Don't use this API") void _nm_forbidden_glib_api_n(gconstpointer /*****************************************************************************/ +/* Use either NM_MIN()/NM_MAX() or (if that doesn't work) use NM_MIN_CONST()/NM_MAX_CONST(). */ +#undef MIN +#undef MAX + +/*****************************************************************************/ + #endif /* __NM_GLIB_H__ */