LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Richard Knutsson <ricknu-0@student.ltu.se>
To: Josh Triplett <josh@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] rcutorture: Remove redundant assignment to cur_ops in for loop
Date: Thu, 08 Feb 2007 00:56:01 +0100	[thread overview]
Message-ID: <45CA6711.40502@student.ltu.se> (raw)
In-Reply-To: <45CA212A.7000504@kernel.org>

Josh Triplett wrote:
> The for loop in rcutorture_init uses the condition
> cur_ops = torture_ops[i], cur_ops
> but then makes the same assignment to cur_ops inside the loop.  Remove the
> redundant assignment inside the loop, and remove now-unnecessary braces.
>
> Signed-off-by: Josh Triplett <josh@kernel.org>
> ---
>  kernel/rcutorture.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
> index 0c7bf0c..7258bcb 100644
> --- a/kernel/rcutorture.c
> +++ b/kernel/rcutorture.c
> @@ -875,12 +875,9 @@ rcu_torture_init(void)
>  
>  	/* Process args and tell the world that the torturer is on the job. */
>  
> -	for (i = 0; cur_ops = torture_ops[i], cur_ops; i++) {
> -		cur_ops = torture_ops[i];
> -		if (strcmp(torture_type, cur_ops->name) == 0) {
> +	for (i = 0; cur_ops = torture_ops[i], cur_ops; i++)
>   
May be tired right now, but wouldn't it be more logical with:

for (i = 0; cur_ops = torture_ops[i], i++)

Right now it seems to have two conditions for cur_ops.


Just my 2cent
Richard Knutsson



  reply	other threads:[~2007-02-07 23:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-07 18:54 [PATCH 1/3] rcutorture: Use ARRAY_SIZE macro when appropriate Josh Triplett
2007-02-07 18:56 ` [PATCH 2/3] rcutorture: style cleanup: avoid != NULL in boolean tests Josh Triplett
2007-02-07 18:57 ` [PATCH 3/3] rcutorture: Remove redundant assignment to cur_ops in for loop Josh Triplett
2007-02-07 23:56   ` Richard Knutsson [this message]
2007-02-08  0:22     ` Andrew Morton
2007-02-08  0:24       ` Andrew Morton
2007-02-08  1:42         ` Josh Triplett

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=45CA6711.40502@student.ltu.se \
    --to=ricknu-0@student.ltu.se \
    --cc=akpm@linux-foundation.org \
    --cc=josh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 3/3] rcutorture: Remove redundant assignment to cur_ops in for loop' \
    /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

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).