All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: replace continue with break to reduce unnecessary loop in xxx_xmarksources
@ 2012-04-05  9:36 roy.qing.li
  2012-04-05  9:43 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: roy.qing.li @ 2012-04-05  9:36 UTC (permalink / raw)
  To: netdev

From: RongQing.Li <roy.qing.li@gmail.com>

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 <roy.qing.li@gmail.com>
---
 net/ipv4/igmp.c  |    2 +-
 net/ipv6/mcast.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 5dfecfd..ceaac24 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -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;
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index b2869ca..7dfb89f 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -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;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: replace continue with break to reduce unnecessary loop in xxx_xmarksources
  2012-04-05  9:36 [PATCH net-next] net: replace continue with break to reduce unnecessary loop in xxx_xmarksources roy.qing.li
@ 2012-04-05  9:43 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-04-05  9:43 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev

From: roy.qing.li@gmail.com
Date: Thu,  5 Apr 2012 17:36:29 +0800

> From: RongQing.Li <roy.qing.li@gmail.com>
> 
> 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 <roy.qing.li@gmail.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-05  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-05  9:36 [PATCH net-next] net: replace continue with break to reduce unnecessary loop in xxx_xmarksources roy.qing.li
2012-04-05  9:43 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.