From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Sam Muhammed <jane.pnx9@gmail.com>
Cc: William Hubbs <w.d.hubbs@gmail.com>,
Chris Brannon <chris@the-brannons.com>,
Kirk Reiser <kirk@reisers.ca>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
outreachy-kernel@googlegroups.com
Subject: Re: [PATCH 1/3] Staging: speakup: Avoid multiple assignments.
Date: Mon, 23 Mar 2020 23:13:42 +0100 [thread overview]
Message-ID: <20200323221342.pdwwo55nu73kgcpl@function> (raw)
In-Reply-To: <b92dd931a07afcd2bcac397387130ffdc3c46223.1584997290.git.jane.pnx9@gmail.com>
Hello,
Sam Muhammed, le lun. 23 mars 2020 17:38:43 -0400, a ecrit:
> Modify the code to avoid multiple assignments by just
> doing the assignment in two steps.
The original version of the code is considered easier to read.
Yes, the tools say multiple assignments should be avoided, but that's
not a strict rule :)
> Signed-off-by: Sam Muhammed <jane.pnx9@gmail.com>
> ---
> drivers/staging/speakup/main.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index 02471d932d71..6efa0b245bef 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -263,9 +263,12 @@ static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
>
> static void speakup_date(struct vc_data *vc)
> {
> - spk_x = spk_cx = vc->vc_x;
> - spk_y = spk_cy = vc->vc_y;
> - spk_pos = spk_cp = vc->vc_pos;
> + spk_cx = vc->vc_x;
> + spk_x = spk_cx;
> + spk_cy = vc->vc_y;
> + spk_y = spk_cy;
> + spk_cp = vc->vc_pos;
> + spk_pos = spk_cp;
> spk_old_attr = spk_attr;
> spk_attr = get_attributes(vc, (u_short *)spk_pos);
> }
> @@ -1672,9 +1675,12 @@ static int speak_highlight(struct vc_data *vc)
> spk_do_flush();
> spkup_write(speakup_console[vc_num]->ht.highbuf[hc],
> speakup_console[vc_num]->ht.highsize[hc]);
> - spk_pos = spk_cp = speakup_console[vc_num]->ht.rpos[hc];
> - spk_x = spk_cx = speakup_console[vc_num]->ht.rx[hc];
> - spk_y = spk_cy = speakup_console[vc_num]->ht.ry[hc];
> + spk_cp = speakup_console[vc_num]->ht.rpos[hc];
> + spk_pos = spk_cp;
> + spk_cx = speakup_console[vc_num]->ht.rx[hc];
> + spk_x = spk_cx;
> + spk_cy = speakup_console[vc_num]->ht.ry[hc];
> + spk_y = spk_cy;
> return 1;
> }
> return 0;
> ---
> 2.20.1
>
next prev parent reply other threads:[~2020-03-23 22:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 21:38 [PATCH 0/3] Staging: speakup: Misc cleanups and code reformatting Sam Muhammed
2020-03-23 21:38 ` [PATCH 1/3] Staging: speakup: Avoid multiple assignments Sam Muhammed
2020-03-23 22:13 ` Samuel Thibault [this message]
2020-03-23 23:13 ` [Outreachy kernel] " Sam Muhammed
2020-03-23 23:20 ` Samuel Thibault
2020-03-23 23:27 ` Sam Muhammed
2020-03-23 21:38 ` [PATCH 2/3] Staging: speakup: Use sizeof(*var) in kmalloc() Sam Muhammed
2020-03-23 22:14 ` Samuel Thibault
2020-03-23 21:38 ` [PATCH 3/3] Staging: speakup: Add identifier name to function declaration arguments Sam Muhammed
2020-03-23 22:14 ` Samuel Thibault
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=20200323221342.pdwwo55nu73kgcpl@function \
--to=samuel.thibault@ens-lyon.org \
--cc=chris@the-brannons.com \
--cc=gregkh@linuxfoundation.org \
--cc=jane.pnx9@gmail.com \
--cc=kirk@reisers.ca \
--cc=outreachy-kernel@googlegroups.com \
--cc=w.d.hubbs@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 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.