Since neither echo_commit nor echo_tail can change for the duration
of __process_echoes loop, substitute index comparison for the
snapshot counter.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
old_space = space = tty_write_room(tty);
tail = ldata->echo_tail;
- nr = ldata->echo_commit - ldata->echo_tail;
- while (nr > 0) {
+ while (ldata->echo_commit != tail) {
c = echo_buf(ldata, tail);
if (c == ECHO_OP_START) {
unsigned char op;
ldata->column--;
}
tail += 3;
- nr -= 3;
break;
case ECHO_OP_SET_CANON_COL:
ldata->canon_column = ldata->column;
tail += 2;
- nr -= 2;
break;
case ECHO_OP_MOVE_BACK_COL:
if (ldata->column > 0)
ldata->column--;
tail += 2;
- nr -= 2;
break;
case ECHO_OP_START:
ldata->column++;
space--;
tail += 2;
- nr -= 2;
break;
default:
ldata->column += 2;
space -= 2;
tail += 2;
- nr -= 2;
}
if (no_space_left)
space -= 1;
}
tail += 1;
- nr -= 1;
}
}