Mercurial > hg > octave-terminal
changeset 11974:28d4a6acbf0a release-3-2-x
properly clear global variables
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 09 Jun 2009 06:33:10 +0200 |
parents | 5b967e2c319a |
children | 5183cee7a423 |
files | src/ChangeLog src/symtab.h |
diffstat | 2 files changed, 24 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-06-08 Jaroslav Hajek <highegg@gmail.com> + + * symtab.h (symbol_table::do_clear_global, + symbol_table::do_clear_global_pattern): Properly erase from both local + and global table. + 2009-06-08 Jaroslav Hajek <highegg@gmail.com> * variables.cc (Fclear): Clear also globals when called without
--- a/src/symtab.h +++ b/src/symtab.h @@ -2143,15 +2143,14 @@ symbol_record& sr = p->second; if (sr.is_global ()) - { - global_table_iterator q = global_table.find (name); - - if (q != global_table.end ()) - global_table.erase (q); - - sr.unmark_global (); - } + sr.unmark_global (); } + + global_table_iterator q = global_table.find (name); + + if (q != global_table.end ()) + global_table.erase (q); + } void do_clear_variable (const std::string& name) @@ -2170,19 +2169,18 @@ { symbol_record& sr = p->second; - if (sr.is_global ()) - { - if (pattern.match (sr.name ())) - { - global_table_iterator q = global_table.find (sr.name ()); - - if (q != global_table.end ()) - global_table.erase (q); - - sr.unmark_global (); - } - } + if (sr.is_global () && pattern.match (sr.name ())) + sr.unmark_global (); } + + for (global_table_iterator q = global_table.begin (); + q != global_table.end (); q++) + { + if (pattern.match (q->first)) + global_table.erase (q); + } + + } void do_clear_variable_pattern (const std::string& pat)