Mercurial > hg > octave-lojdl
changeset 5855:92d2be71e7cc
[project @ 2006-06-13 04:59:30 by jwe]
author | jwe |
---|---|
date | Tue, 13 Jun 2006 04:59:31 +0000 |
parents | 68f8017ef077 |
children | a4dc99e71752 |
files | src/ChangeLog src/pt-stmt.cc |
diffstat | 2 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-06-13 John W. Eaton <jwe@octave.org> + + * pt-stmt.cc (tree_statement_list::eval): + Clear retval before each statement is evaluated. + 2006-06-12 John W. Eaton <jwe@octave.org> * unwind-prot.h (unwind_protect_fptr): New macro.
--- a/src/pt-stmt.cc +++ b/src/pt-stmt.cc @@ -165,6 +165,17 @@ { OCTAVE_QUIT; + // Clear preivous values before next statement is evaluated + // so that we aren't holding an extra reference to a value + // that may be used next. For example, in code like this: + // + // X = rand (N); ## refcount should be 1 after this statement. + // X(idx) = val; ## no extra copy should be needed, but + // ## we will be faked out if retval is not + // ## cleared between statements here. + + retval = octave_value_list (); + retval = elt->eval (silent, nargout, function_body); if (error_state) @@ -179,8 +190,6 @@ } else error ("invalid statement found in statement list!"); - - } return retval;