linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sunil Shahu <shshahu@gmail.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH] Prevent unnecessary iteration in __handle_cmd
Date: Fri,  1 Apr 2016 14:01:01 +0530	[thread overview]
Message-ID: <1459499461-4422-1-git-send-email-shshahu@gmail.com> (raw)

Break the loop after matching sectcmd is found. Remove redundant
variable copying.

Signed-off-by: Sunil Shahu <shshahu@gmail.com>
---
 iw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/iw.c b/iw.c
index 0f511d9..73ae347 100644
--- a/iw.c
+++ b/iw.c
@@ -376,11 +376,9 @@ static int __handle_cmd(struct nl80211_state *state, enum id_input idby,
 		if (match && sectcmd->idby != command_idby)
 			continue;
 		if (strcmp(sectcmd->name, section) == 0)
-			match = sectcmd;
+			break;
 	}
 
-	sectcmd = match;
-	match = NULL;
 	if (!sectcmd)
 		return 1;
 
-- 
1.9.1


             reply	other threads:[~2016-04-01  8:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01  8:31 Sunil Shahu [this message]
2016-04-01 11:48 ` [PATCH] Prevent unnecessary iteration in __handle_cmd Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459499461-4422-1-git-send-email-shshahu@gmail.com \
    --to=shshahu@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).