diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-08-11 21:37:18 +0300 |
|---|---|---|
| committer | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-08-11 21:42:07 +0300 |
| commit | 1c69485e1ebd17bf3cc6e8fc4728f9bdb431de94 (patch) | |
| tree | fa86681a712ff3c0605c96883c000d864cb60b53 /accel-pppd/ctrl | |
| parent | 86e71f2aa48d62e1c63253f0986d5f643410a263 (diff) | |
| download | accel-ppp-1c69485e1ebd17bf3cc6e8fc4728f9bdb431de94.tar.gz accel-ppp-1c69485e1ebd17bf3cc6e8fc4728f9bdb431de94.zip | |
utils: centralize min macro
Several userspace translation units carry identical local min() definitions. Move the guarded definition to utils.h and include it from each user so there is one implementation to maintain.
The Linux min() macro lives in kernel-internal headers and is not part of the userspace UAPI. Clang/LLVM does not provide a compatible min macro either: C++ code uses std::min and Clang's similarly named operations use explicit builtin names. The userspace <sys/param.h> interface, where available, exposes uppercase MIN instead.
Keep the #ifndef guard to preserve the behavior of the existing local definitions and avoid redefining a lowercase min macro supplied by an unrelated third-party header.
Diffstat (limited to 'accel-pppd/ctrl')
| -rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.c | 5 | ||||
| -rw-r--r-- | accel-pppd/ctrl/sstp/sstp.c | 3 |
2 files changed, 1 insertions, 7 deletions
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index 72faab4e..0e65168d 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.c +++ b/accel-pppd/ctrl/pppoe/pppoe.c @@ -24,6 +24,7 @@ #endif #include "iputils.h" +#include "utils.h" #include "connlimit.h" #include "vlan_mon.h" @@ -33,10 +34,6 @@ #define SID_MAX 65536 -#ifndef min -#define min(x,y) ((x)<(y)?(x):(y)) -#endif - struct pppoe_conn_t { struct list_head entry; struct triton_context_t ctx; diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c index 2fd8cb35..72004cf8 100644 --- a/accel-pppd/ctrl/sstp/sstp.c +++ b/accel-pppd/ctrl/sstp/sstp.c @@ -47,9 +47,6 @@ #include "sstp_prot.h" #include "if_ppposeq.h" -#ifndef min -#define min(x,y) ((x) < (y) ? (x) : (y)) -#endif #ifndef max #define max(x,y) ((x) > (y) ? (x) : (y)) #endif |
