From 20fde0be6ca106027d8cc1ff0fa8d6a69c23c48d Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 19 Oct 2016 09:54:39 +0800 Subject: [PATCH] ip4_frag: Use LWIP_MIN instead of open-coded Signed-off-by: Axel Lin --- src/core/ipv4/ip4_frag.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c index c1201cda..b6f90945 100644 --- a/src/core/ipv4/ip4_frag.c +++ b/src/core/ipv4/ip4_frag.c @@ -714,7 +714,7 @@ ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest) while (left) { /* Fill this fragment */ - fragsize = (left < nfb * 8) ? left : nfb * 8; + fragsize = LWIP_MIN(left, nfb * 8); #if LWIP_NETIF_TX_SINGLE_PBUF rambuf = pbuf_alloc(PBUF_IP, fragsize, PBUF_RAM); @@ -751,7 +751,7 @@ ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest) while (left_to_copy) { struct pbuf_custom_ref *pcr; u16_t plen = p->len - poff; - newpbuflen = (left_to_copy < plen) ? left_to_copy : plen; + newpbuflen = LWIP_MIN(left_to_copy, plen); /* Is this pbuf already empty? */ if (!newpbuflen) { poff = 0;