From: Simon Horman Date: Fri, 19 Apr 2013 01:33:59 +0000 (+0900) Subject: ipvs: Use min3() in ip_vs_dbg_callid() X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=9c37510b8ff2821ae4574858a6d4e83949c98a20;p=linux-edison.git ipvs: Use min3() in ip_vs_dbg_callid() There are two motivations for this: 1. It improves readability to my eyes 2. Using nested min() calls results in a shadowed _min1 variable, which is a bit untidy. Sparse complained about this. I have also replaced (size_t)64 with a variable of type size_t and value 64. This also improves readability to my eyes. Acked-by: Julian Anastasov Signed-off-by: Simon Horman --- diff --git a/net/netfilter/ipvs/ip_vs_pe_sip.c b/net/netfilter/ipvs/ip_vs_pe_sip.c index 00cc0241ed8..9a8f4213e8a 100644 --- a/net/netfilter/ipvs/ip_vs_pe_sip.c +++ b/net/netfilter/ipvs/ip_vs_pe_sip.c @@ -13,7 +13,8 @@ static const char *ip_vs_dbg_callid(char *buf, size_t buf_len, const char *callid, size_t callid_len, int *idx) { - size_t len = min(min(callid_len, (size_t)64), buf_len - *idx - 1); + size_t max_len = 64; + size_t len = min3(max_len, callid_len, buf_len - *idx - 1); memcpy(buf + *idx, callid, len); buf[*idx+len] = '\0'; *idx += len + 1;