Use shared_ptr and references for Actions.

This slows terminal emulation slightly.
This commit is contained in:
John Hood
2017-05-11 01:22:12 -04:00
parent c6c7f09954
commit 42d2b5d029
13 changed files with 104 additions and 113 deletions
+1 -4
View File
@@ -40,15 +40,13 @@
const Parser::StateFamily Parser::family;
static void append_or_delete( Parser::Action *act,
static void append_or_delete( Parser::ActionPointer act,
Parser::Actions &vec )
{
assert( act );
if ( !act->ignore() ) {
vec.push_back( act );
} else {
delete act;
}
}
@@ -61,7 +59,6 @@ void Parser::Parser::input( wchar_t ch, Actions &ret )
}
append_or_delete( tx.action, ret );
tx.action = NULL;
if ( tx.next_state != NULL ) {
append_or_delete( tx.next_state->enter(), ret );