Coverity fixes: do { ...; continue; ... } while (false)
This is more stylistic than substantial, but it's bad enough style to be worth fixing.
This commit is contained in:
@@ -475,28 +475,27 @@ void FrameState::append_silent_move( int y, int x )
|
|||||||
|
|
||||||
void FrameState::append_move( int y, int x )
|
void FrameState::append_move( int y, int x )
|
||||||
{
|
{
|
||||||
do {
|
// Only optimize if cursor pos is known
|
||||||
// If cursor pos is unknown, of course we can't optimize
|
if ( cursor_x != -1 && cursor_y != -1 ) {
|
||||||
if ( cursor_x != -1 && cursor_y != -1 ) {
|
// Can we use CR and/or LF? They're cheap and easier to trace.
|
||||||
// Can we use CR and/or LF? They're cheap and easier to trace.
|
if ( x == 0 && y - cursor_y >= 0 && y - cursor_y < 5 ) {
|
||||||
if ( x == 0 && y - cursor_y >= 0 && y - cursor_y < 5 ) {
|
if ( cursor_x != 0 ) {
|
||||||
if ( cursor_x != 0 ) {
|
append( '\r' );
|
||||||
append( '\r' );
|
|
||||||
}
|
|
||||||
append( y - cursor_y, '\n' );
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
// Backspaces are good too.
|
append( y - cursor_y, '\n' );
|
||||||
if ( y == cursor_y && x - cursor_x < 0 && x - cursor_x > -5 ) {
|
goto positioned;
|
||||||
append( cursor_x - x, '\b' );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// More optimizations are possible.
|
|
||||||
}
|
}
|
||||||
char tmp[ 64 ];
|
// Backspaces are good too.
|
||||||
snprintf( tmp, 64, "\033[%d;%dH", y + 1, x + 1 );
|
if ( y == cursor_y && x - cursor_x < 0 && x - cursor_x > -5 ) {
|
||||||
append( tmp );
|
append( cursor_x - x, '\b' );
|
||||||
} while( 0 );
|
goto positioned;
|
||||||
|
}
|
||||||
|
// More optimizations are possible.
|
||||||
|
}
|
||||||
|
char tmp[ 64 ];
|
||||||
|
snprintf( tmp, 64, "\033[%d;%dH", y + 1, x + 1 );
|
||||||
|
append( tmp );
|
||||||
|
positioned:
|
||||||
cursor_x = x;
|
cursor_x = x;
|
||||||
cursor_y = y;
|
cursor_y = y;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user