From 6719f10034304c0db233b958f6ab60a688e04c07 Mon Sep 17 00:00:00 2001 From: jani Date: Tue, 27 May 2003 13:44:08 +0000 Subject: [PATCH] put LWIP_MAX and LWIP_MIN macros in def.h and use these instead of locally declaring them in .c files --- src/core/tcp.c | 2 -- src/core/tcp_in.c | 2 +- src/core/tcp_out.c | 3 --- src/include/lwip/def.h | 3 ++- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/core/tcp.c b/src/core/tcp.c index ffc593af..82cdc530 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -70,8 +70,6 @@ struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-WAIT. */ struct tcp_pcb *tcp_tmp_pcb; -#define LWIP_MIN(x,y) (x) < (y)? (x): (y) - static u8_t tcp_timer; static u16_t tcp_new_port(void); diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 0f61f08d..8ffeb2b5 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -654,7 +654,7 @@ tcp_receive(struct tcp_pcb *pcb) ntohl(pcb->unacked->tcphdr->seqno))); tcp_rexmit(pcb); /* Set ssthresh to max (FlightSize / 2, 2*SMSS) */ - pcb->ssthresh = UMAX((pcb->snd_max - + pcb->ssthresh = LWIP_MAX((pcb->snd_max - pcb->lastack) / 2, 2 * pcb->mss); diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index 37d973b6..d38eef52 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -59,9 +59,6 @@ #include "lwip/stats.h" #if LWIP_TCP -#define LWIP_MIN(x,y) (x) < (y)? (x): (y) - - /* Forward declarations.*/ static void tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb); diff --git a/src/include/lwip/def.h b/src/include/lwip/def.h index 8464f105..1b5b7456 100644 --- a/src/include/lwip/def.h +++ b/src/include/lwip/def.h @@ -35,7 +35,8 @@ /* this might define NULL already */ #include "arch/cc.h" -#define UMAX(a, b) ((a) > (b) ? (a) : (b)) +#define LWIP_MAX(x , y) (x) > (y) ? (x) : (y) +#define LWIP_MIN(x , y) (x) < (y) ? (x) : (y) #ifndef NULL #define NULL ((void *)0)