staging: speakup: main: switch multiple assignment for one assignment per line
PATCH 1/1 staging: speakup: main: switch multiple assignment for one assignment per line
One assignment per line is preferred, instead of multiple assignments. To prevent possible undefined behavior.
Issue found with checkpath.
--- drivers/staging/speakup/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/speakup/main.c +2 -1
@@ -2117,7 +2117,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, spk_keydown =0 ; goto out; } - value = spk_lastkey = pad_chars[value]; + spk_lastkey = pad_chars[value]; + value = pad_chars[value]; spk_keydown++; spk_parked &=0xfe ; goto no_map;
Signature · 1 line
2.17.1
Hello,
Lourdes Pedrajas, le dim. 15 mars 2020 05:40:51 +0100, a ecrit:
Quoted 2 lines
One assignment per line is preferred, instead of multiple assignments. To prevent possible undefined behavior.
Here the behavior is completely defined, but one assignment per line makes it more readable.
Quoted 12 lines
Issue found with checkpath.
Signed-off-by Lourdes Pedrajas <[email protected]>--- drivers/staging/speakup/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/staging/speakup/main.c +0
-0
drivers/staging/speakup/main.c speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, · line 2121
Quoted 6 lines
drivers/staging/speakup/main.c +2
-1@@ -2117,7 +2117,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, spk_keydown =0 ; goto out; } - value = spk_lastkey = pad_chars[value]; + spk_lastkey = pad_chars[value]; + value = pad_chars[value];
Please rather use
value = pad_chars[value]; spk_lastkey = value
To make it clear that it's the same value which is used, and to have the spk_something assignment next to the other spk_something assignments.
Quoted 6 lines
drivers/staging/speakup/main.c +0
-0spk_keydown++; spk_parked &=0xfe ; goto no_map;Signature · 1 line
2.17.1
Quoted 10 lines · Samuel Thibault
Hello,
Lourdes Pedrajas, le dim. 15 mars 2020 05:40:51 +0100, a ecrit:
Quoted 2 lines
One assignment per line is preferred, instead of multiple assignments. To prevent possible undefined behavior.
Here the behavior is completely defined, but one assignment per line makes it more readable.
Quoted 8 lines
Please rather use
value = pad_chars[value]; spk_lastkey = valueTo make it clear that it's the same value which is used, and to have the
spk_somethingassignment next to the otherspk_somethingassignments.
Thank you for the explanation, I makes sense to me. I will make the changes,
Lourdes.