From: Kirill Isakov Date: Tue, 17 Aug 2021 18:36:30 +0000 (+0600) Subject: Move repeating MIN/MAX macros into dropin.h. X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=3b6d366005b6fc23c705b3156e365316f6ab776c;p=tinc Move repeating MIN/MAX macros into dropin.h. --- diff --git a/src/dropin.h b/src/dropin.h index bc1951d3..d1919e1c 100644 --- a/src/dropin.h +++ b/src/dropin.h @@ -69,4 +69,12 @@ extern int nanosleep(const struct timespec *req, struct timespec *rem); #define EAI_SYSTEM 0 #endif +#ifndef MIN +#define MIN(a,b) (((a)<(b))?(a):(b)) +#endif + +#ifndef MAX +#define MAX(a,b) (((a)>(b))?(a):(b)) +#endif + #endif diff --git a/src/net_packet.c b/src/net_packet.c index 24ebdff8..63809aee 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -55,10 +55,6 @@ #include "route.h" #include "utils.h" -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif - /* The minimum size of a probe is 14 bytes, but since we normally use CBC mode encryption, we can add a few extra random bytes without increasing the resulting packet size. */ diff --git a/src/protocol_misc.c b/src/protocol_misc.c index 7994f00d..284006bb 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -29,10 +29,6 @@ #include "protocol.h" #include "utils.h" -#ifndef MIN -#define MIN(x, y) (((x)<(y))?(x):(y)) -#endif - int maxoutbufsize = 0; int mtu_info_interval = 5; int udp_info_interval = 5; diff --git a/src/route.c b/src/route.c index 69d0ba74..79832dca 100644 --- a/src/route.c +++ b/src/route.c @@ -54,10 +54,6 @@ static const size_t icmp6_size = sizeof(struct icmp6_hdr); static const size_t ns_size = sizeof(struct nd_neighbor_solicit); static const size_t opt_size = sizeof(struct nd_opt_hdr); -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif - static timeout_t age_subnets_timeout; /* RFC 1071 */ diff --git a/src/sptps_test.c b/src/sptps_test.c index 3406a97e..5e785b3a 100644 --- a/src/sptps_test.c +++ b/src/sptps_test.c @@ -34,10 +34,6 @@ #include "sptps.h" #include "utils.h" -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif - #ifndef HAVE_MINGW #define closesocket(s) close(s) #endif