Mercurial > hg > octave-terminal
changeset 10654:984b8b6bee02
simplify octave_value::length
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 25 May 2010 08:55:23 +0200 |
parents | ec5fa46e0e45 |
children | 9e4407c19e8d |
files | src/ChangeLog src/ov.cc |
diffstat | 2 files changed, 7 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-05-25 Jaroslav Hajek <highegg@gmail.com> + + * ov.cc (octave_value::length): Simplify. + 2010-05-25 Jaroslav Hajek <highegg@gmail.com> * ov-base-mat.h (octave_base_matrix::ndims): New override.
--- a/src/ov.cc +++ b/src/ov.cc @@ -1372,18 +1372,12 @@ octave_idx_type octave_value::length (void) const { - int retval = 0; - - dim_vector dv = dims (); + octave_idx_type retval = 0; + + const dim_vector dv = dims (); for (int i = 0; i < dv.length (); i++) { - if (dv(i) < 0) - { - retval = -1; - break; - } - if (dv(i) == 0) { retval = 0;