staging: speakup: selection: replace _manual_ swap with swap macro

Make use of the swap macro instead of _manually_ swapping values
and remove unnecessary variable tmp.

This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Gustavo A. R. Silva 2017-11-10 16:13:03 -06:00 коммит произвёл Greg Kroah-Hartman
Родитель f6829ad617
Коммит d69b9c3884
1 изменённых файлов: 2 добавлений и 7 удалений

Просмотреть файл

@ -64,13 +64,8 @@ int speakup_set_selection(struct tty_struct *tty)
ps = spk_ys * vc->vc_size_row + (spk_xs << 1); ps = spk_ys * vc->vc_size_row + (spk_xs << 1);
pe = spk_ye * vc->vc_size_row + (spk_xe << 1); pe = spk_ye * vc->vc_size_row + (spk_xe << 1);
if (ps > pe) { if (ps > pe) /* make sel_start <= sel_end */
/* make sel_start <= sel_end */ swap(ps, pe);
int tmp = ps;
ps = pe;
pe = tmp;
}
if (spk_sel_cons != vc_cons[fg_console].d) { if (spk_sel_cons != vc_cons[fg_console].d) {
speakup_clear_selection(); speakup_clear_selection();