Eliminate unnecessary, trailing else conditional blocks.

This commit is contained in:
John Hood
2016-11-07 00:43:33 -05:00
parent 43785eb820
commit b1a6f7c144
7 changed files with 38 additions and 50 deletions
+4 -5
View File
@@ -226,12 +226,11 @@ void Dispatcher::dispatch( Function_Type type, const Parser::Action *act, Frameb
/* unknown function */
fb->ds.next_print_will_wrap = false;
return;
} else {
if ( i->second.clears_wrap_state ) {
fb->ds.next_print_will_wrap = false;
}
return i->second.function( fb, this );
}
if ( i->second.clears_wrap_state ) {
fb->ds.next_print_will_wrap = false;
}
i->second.function( fb, this );
}
void Dispatcher::OSC_put( const Parser::OSC_Put *act )
+21 -23
View File
@@ -229,14 +229,13 @@ int DrawState::get_next_tab( int count ) const
}
}
return -1;
} else {
for ( int i = cursor_col - 1; i > 0; i-- ) {
if ( tabs[ i ] && ++count == 0 ) {
return i;
}
}
return 0;
}
for ( int i = cursor_col - 1; i > 0; i-- ) {
if ( tabs[ i ] && ++count == 0 ) {
return i;
}
}
return 0;
}
void DrawState::set_scrolling_region( int top, int bottom )
@@ -597,23 +596,22 @@ std::string Cell::debug_contents( void ) const
{
if ( contents.empty() ) {
return "'_' ()";
} else {
std::string chars( 1, '\'' );
print_grapheme( chars );
chars.append( "' [" );
const char *lazycomma = "";
char buf[64];
for ( content_type::const_iterator i = contents.begin();
i < contents.end();
i++ ) {
snprintf( buf, sizeof buf, "%s0x%02x", lazycomma, static_cast<uint8_t>(*i) );
chars.append( buf );
lazycomma = ", ";
}
chars.append( "]" );
return chars;
}
std::string chars( 1, '\'' );
print_grapheme( chars );
chars.append( "' [" );
const char *lazycomma = "";
char buf[64];
for ( content_type::const_iterator i = contents.begin();
i < contents.end();
i++ ) {
snprintf( buf, sizeof buf, "%s0x%02x", lazycomma, static_cast<uint8_t>(*i) );
chars.append( buf );
lazycomma = ", ";
}
chars.append( "]" );
return chars;
}
bool Cell::compare( const Cell &other ) const
+8 -12
View File
@@ -52,17 +52,14 @@ string UserInput::input( const Parser::UserByte *act,
state = ESC;
}
return string( &act->c, 1 );
break;
case ESC:
if ( act->c == 'O' ) { /* ESC O = 7-bit SS3 */
state = SS3;
return string();
} else {
state = Ground;
return string( &act->c, 1 );
}
break;
state = Ground;
return string( &act->c, 1 );
case SS3:
state = Ground;
@@ -75,12 +72,11 @@ string UserInput::input( const Parser::UserByte *act,
char original_cursor[ 2 ] = { 'O', act->c };
return string( original_cursor, 2 );
}
break;
default:
/* This doesn't handle the 8-bit SS3 C1 control, which would be
two octets in UTF-8. Fortunately nobody seems to send this. */
assert( false );
return string();
}
/* This doesn't handle the 8-bit SS3 C1 control, which would be
two octets in UTF-8. Fortunately nobody seems to send this. */
assert( false );
return string();
}