net: replace continue with break to reduce unnecessary loop in xxx_xmarksources
Subsystems (3)
PATCH 1/1 net: replace continue with break to reduce unnecessary loop in xxx_xmarksources
From: RongQing.Li <[email protected]>
The conditional which decides to skip inactive filters does not change with the change of loop index, so it is unnecessary to check them many times.
Signed-off-by RongQing.Li <[email protected]>
--- net/ipv4/igmp.c | 2 +- net/ipv6/mcast.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/igmp.c +1 -1
@@ -774,7 +774,7 @@ static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs)if (psf->sf_count[MCAST_INCLUDE ] || pmc->sfcount[MCAST_EXCLUDE ] != psf->sf_count[MCAST_EXCLUDE ]) -continue ; +break ;if (srcs[i] == psf->sf_inaddr) { scount++;break ;
net/ipv6/mcast.c +1 -1
@@ -1061,7 +1061,7 @@ static int mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs,if (psf->sf_count[MCAST_INCLUDE ] || pmc->mca_sfcount[MCAST_EXCLUDE ] != psf->sf_count[MCAST_EXCLUDE ]) -continue ; +break ;if (ipv6_addr_equal (&srcs[i], &psf->sf_addr)) { scount++;break ;
Signature · 1 line
1.7.1
From: [email protected]
Date: Thu, 5 Apr 2012 17:36:29 +0800
Quoted 7 lines
From: RongQing.Li <[email protected]>
The conditional which decides to skip inactive filters does not change with the change of loop index, so it is unnecessary to check them many times.
Signed-off-by RongQing.Li <[email protected]>
Applied, thanks.