diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-02-07 21:04:51 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-02-07 21:04:51 -0800 |
commit | 399c78fbf74f0495c6b3ffd3871356c7dfdfbb13 (patch) | |
tree | 6981be3e3f10177723cbb2c00dd4938ac48ccf06 /builtin.cpp | |
parent | a0a43046b3b21853fdec115dd35f1def9c312670 (diff) |
Fix event_block_t list from ad-hoc linked list to std::dequeue
Diffstat (limited to 'builtin.cpp')
-rw-r--r-- | builtin.cpp | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/builtin.cpp b/builtin.cpp index dbc30165..b9b05a79 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -797,26 +797,20 @@ static int builtin_block( parser_t &parser, wchar_t **argv ) sb_printf( sb_err, _( L"%ls: Can not specify scope when removing block\n" ), argv[0] ); return STATUS_BUILTIN_ERROR; } - - event_block_t *eb = parser.global_event_block; - if( ! eb ) + + if (parser.global_event_blocks.empty()) { sb_printf( sb_err, _( L"%ls: No blocks defined\n" ), argv[0] ); return STATUS_BUILTIN_ERROR; } - parser.global_event_block = eb->next; - free( eb ); + parser.global_event_blocks.pop_front(); } else { block_t *block=parser.current_block; - event_block_t *eb = (event_block_t *)malloc( sizeof( event_block_t ) ); - - if( !eb ) - DIE_MEM(); - - eb->type = type; + event_block_t eb = {}; + eb.typemask = type; switch( scope ) { @@ -840,14 +834,11 @@ static int builtin_block( parser_t &parser, wchar_t **argv ) } if( block ) { - eb->next = block->first_event_block; - block->first_event_block = eb; - halloc_register( block, eb ); + block->event_blocks.push_front(eb); } else { - eb->next = parser.global_event_block; - parser.global_event_block=eb; + parser.global_event_blocks.push_front(eb); } } |