diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2013-12-02 14:24:44 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-08 19:51:28 -0500 |
commit | 001ba923719bc555552ac4c9fe8df4d8c888df39 (patch) | |
tree | 2ba02d8afb44991750e73f677f8464ef8104e27b /drivers/tty/n_tty.c | |
parent | 8dc4b25d2325002f716fffe2e35c9af43639c60f (diff) |
n_tty: Refactor PARMRK doubling checks
Perform PARMRK doubling checks explicitly; remove ternary idiom
and local variable.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/n_tty.c')
-rw-r--r-- | drivers/tty/n_tty.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 582a05c012f0..649fd94d1aa6 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -1257,7 +1257,6 @@ static int | |||
1257 | n_tty_receive_char_special(struct tty_struct *tty, unsigned char c) | 1257 | n_tty_receive_char_special(struct tty_struct *tty, unsigned char c) |
1258 | { | 1258 | { |
1259 | struct n_tty_data *ldata = tty->disc_data; | 1259 | struct n_tty_data *ldata = tty->disc_data; |
1260 | int parmrk; | ||
1261 | 1260 | ||
1262 | if (I_IXON(tty)) { | 1261 | if (I_IXON(tty)) { |
1263 | if (c == START_CHAR(tty)) { | 1262 | if (c == START_CHAR(tty)) { |
@@ -1342,8 +1341,6 @@ n_tty_receive_char_special(struct tty_struct *tty, unsigned char c) | |||
1342 | } | 1341 | } |
1343 | if ((c == EOL_CHAR(tty)) || | 1342 | if ((c == EOL_CHAR(tty)) || |
1344 | (c == EOL2_CHAR(tty) && L_IEXTEN(tty))) { | 1343 | (c == EOL2_CHAR(tty) && L_IEXTEN(tty))) { |
1345 | parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) | ||
1346 | ? 1 : 0; | ||
1347 | /* | 1344 | /* |
1348 | * XXX are EOL_CHAR and EOL2_CHAR echoed?!? | 1345 | * XXX are EOL_CHAR and EOL2_CHAR echoed?!? |
1349 | */ | 1346 | */ |
@@ -1358,7 +1355,7 @@ n_tty_receive_char_special(struct tty_struct *tty, unsigned char c) | |||
1358 | * XXX does PARMRK doubling happen for | 1355 | * XXX does PARMRK doubling happen for |
1359 | * EOL_CHAR and EOL2_CHAR? | 1356 | * EOL_CHAR and EOL2_CHAR? |
1360 | */ | 1357 | */ |
1361 | if (parmrk) | 1358 | if (c == (unsigned char) '\377' && I_PARMRK(tty)) |
1362 | put_tty_queue(c, ldata); | 1359 | put_tty_queue(c, ldata); |
1363 | 1360 | ||
1364 | handle_newline: | 1361 | handle_newline: |
@@ -1372,7 +1369,6 @@ handle_newline: | |||
1372 | } | 1369 | } |
1373 | } | 1370 | } |
1374 | 1371 | ||
1375 | parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) ? 1 : 0; | ||
1376 | if (L_ECHO(tty)) { | 1372 | if (L_ECHO(tty)) { |
1377 | finish_erasing(ldata); | 1373 | finish_erasing(ldata); |
1378 | if (c == '\n') | 1374 | if (c == '\n') |
@@ -1386,7 +1382,8 @@ handle_newline: | |||
1386 | commit_echoes(tty); | 1382 | commit_echoes(tty); |
1387 | } | 1383 | } |
1388 | 1384 | ||
1389 | if (parmrk) | 1385 | /* PARMRK doubling check */ |
1386 | if (c == (unsigned char) '\377' && I_PARMRK(tty)) | ||
1390 | put_tty_queue(c, ldata); | 1387 | put_tty_queue(c, ldata); |
1391 | 1388 | ||
1392 | put_tty_queue(c, ldata); | 1389 | put_tty_queue(c, ldata); |
@@ -1397,7 +1394,6 @@ static inline void | |||
1397 | n_tty_receive_char_inline(struct tty_struct *tty, unsigned char c) | 1394 | n_tty_receive_char_inline(struct tty_struct *tty, unsigned char c) |
1398 | { | 1395 | { |
1399 | struct n_tty_data *ldata = tty->disc_data; | 1396 | struct n_tty_data *ldata = tty->disc_data; |
1400 | int parmrk; | ||
1401 | 1397 | ||
1402 | if (tty->stopped && !tty->flow_stopped && I_IXON(tty) && I_IXANY(tty)) { | 1398 | if (tty->stopped && !tty->flow_stopped && I_IXON(tty) && I_IXANY(tty)) { |
1403 | start_tty(tty); | 1399 | start_tty(tty); |
@@ -1411,8 +1407,8 @@ n_tty_receive_char_inline(struct tty_struct *tty, unsigned char c) | |||
1411 | echo_char(c, tty); | 1407 | echo_char(c, tty); |
1412 | commit_echoes(tty); | 1408 | commit_echoes(tty); |
1413 | } | 1409 | } |
1414 | parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) ? 1 : 0; | 1410 | /* PARMRK doubling check */ |
1415 | if (parmrk) | 1411 | if (c == (unsigned char) '\377' && I_PARMRK(tty)) |
1416 | put_tty_queue(c, ldata); | 1412 | put_tty_queue(c, ldata); |
1417 | put_tty_queue(c, ldata); | 1413 | put_tty_queue(c, ldata); |
1418 | } | 1414 | } |