Skip to contentSkip to conversation

net: replace continue with break to reduce unnecessary loop in xxx_xmarksources

PATCH Applied [email protected] 2 participants 2 messages Apr 5, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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.

---
 net/ipv4/igmp.c  |    2 +-
 net/ipv6/mcast.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/igmp.c +1 -1
index 5dfecfd..ceaac24 100644
@@ -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
index b2869ca..7dfb89f 100644
@@ -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