summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorDenys Fedoryshchenko <denys.f@collabora.com>2026-08-30 02:46:44 +0300
committerDenys Fedoryshchenko <denys.f@collabora.com>2026-09-09 18:42:09 +0300
commit78d75b1dcf0d42e6ad5ce8b7203a19e17b9c87dc (patch)
treebd824f8f5b15e0a084f6cdbce39b69a40ab34978 /accel-pppd
parentc414f0a725a16cbd4c7063ff221dabb420b96df5 (diff)
downloadaccel-ppp-78d75b1dcf0d42e6ad5ce8b7203a19e17b9c87dc.tar.gz
accel-ppp-78d75b1dcf0d42e6ad5ce8b7203a19e17b9c87dc.zip
utils: centralize max macro
Closes #354
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/ctrl/ipoe/dhcpv4.c5
-rw-r--r--accel-pppd/ctrl/pptp/pptp_prot.h1
-rw-r--r--accel-pppd/ctrl/sstp/sstp.c4
-rw-r--r--accel-pppd/radius/acct.c5
-rw-r--r--accel-pppd/utils.h4
5 files changed, 6 insertions, 13 deletions
diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.c b/accel-pppd/ctrl/ipoe/dhcpv4.c
index f1427e17..2bd59437 100644
--- a/accel-pppd/ctrl/ipoe/dhcpv4.c
+++ b/accel-pppd/ctrl/ipoe/dhcpv4.c
@@ -24,15 +24,12 @@
#include "ipdb.h"
#include "radius.h"
#include "dhcp_attr_defs.h"
+#include "utils.h"
#include "dhcpv4.h"
#define BUF_SIZE 4096
-#ifndef max
-#define max(x,y) ((x) > (y) ? (x) : (y))
-#endif
-
struct dhcpv4_relay_ctx {
struct list_head entry;
struct triton_context_t *ctx;
diff --git a/accel-pppd/ctrl/pptp/pptp_prot.h b/accel-pppd/ctrl/pptp/pptp_prot.h
index ee8cb341..3726334a 100644
--- a/accel-pppd/ctrl/pptp/pptp_prot.h
+++ b/accel-pppd/ctrl/pptp/pptp_prot.h
@@ -281,7 +281,6 @@ struct pptp_set_link_info /* for control message type 15 */
(type==PPTP_WAN_ERR_NTFY )?sizeof(struct pptp_wan_err_ntfy): \
(type==PPTP_SET_LINK_INFO )?sizeof(struct pptp_set_link_info): \
0)
-#define max(a,b) (((a)>(b))?(a):(b))
#define PPTP_CTRL_SIZE_MAX ( \
max(sizeof(struct pptp_start_ctrl_conn), \
max(sizeof(struct pptp_echo_rqst), \
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c
index c3cd111d..0920f5af 100644
--- a/accel-pppd/ctrl/sstp/sstp.c
+++ b/accel-pppd/ctrl/sstp/sstp.c
@@ -50,10 +50,6 @@
#include "sstp_prot.h"
#include "if_ppposeq.h"
-#ifndef max
-#define max(x,y) ((x) > (y) ? (x) : (y))
-#endif
-
#define PPP_BUF_SIZE 8192
#define PPP_BUF_IOVEC 256
#define PPP_F_ESCAPE 1
diff --git a/accel-pppd/radius/acct.c b/accel-pppd/radius/acct.c
index d30aae7a..0448fc95 100644
--- a/accel-pppd/radius/acct.c
+++ b/accel-pppd/radius/acct.c
@@ -14,15 +14,12 @@
#include "backup.h"
#include "ap_session_backup.h"
#include "iputils.h"
+#include "utils.h"
#include "radius_p.h"
#include "memdebug.h"
-#ifndef max
-#define max(x,y) ((x) > (y) ? (x) : (y))
-#endif
-
#define INTERIM_SAFE_TIME 10
static int req_set_RA(struct rad_req_t *req)
diff --git a/accel-pppd/utils.h b/accel-pppd/utils.h
index 7c62422c..6c03299f 100644
--- a/accel-pppd/utils.h
+++ b/accel-pppd/utils.h
@@ -10,6 +10,10 @@
#define min(x, y) ((x) < (y) ? (x) : (y))
#endif
+#ifndef max
+#define max(x, y) ((x) > (y) ? (x) : (y))
+#endif
+
/*
* Fixed-size memcpy() lets the compiler emit efficient unaligned accesses on
* architectures that support them without imposing alignment or aliasing