From: Johannes Berg <johannes@sipsolutions.net>
To: Sunil Shahu <shshahu@gmail.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] Prevent unnecessary iteration in __handle_cmd
Date: Fri, 01 Apr 2016 13:48:28 +0200 [thread overview]
Message-ID: <1459511308.3342.0.camel@sipsolutions.net> (raw)
In-Reply-To: <1459499461-4422-1-git-send-email-shshahu@gmail.com> (sfid-20160401_103119_737984_577FA87E)
On Fri, 2016-04-01 at 14:01 +0530, Sunil Shahu wrote:
> 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;
>
I don't think this works - what if you reach the end of the loop?
johannes
prev parent reply other threads:[~2016-04-01 11:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-01 8:31 [PATCH] Prevent unnecessary iteration in __handle_cmd Sunil Shahu
2016-04-01 11:48 ` Johannes Berg [this message]
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=1459511308.3342.0.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=shshahu@gmail.com \
/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).