Mercurial > hg > octave-nkf
changeset 20653:610c74748518
maint: Clean up code based on static analysis suggestions.
* __dispatch__.cc (F__dispatch__): Eliminate unnecessary double check on
(nargin > 0).
* cellfun.cc (Fnum2cell): Eliminate duplicate else-if branch for
array.is_object().
* load-save.cc: Eliminate unreachable else branch. Simplify else-if to simple
else since condition is always true at this point.
* matrix_type.cc (Fmatrix_type): Eliminate unnecessary check on 'str_type ==
upper' and just mark matrix as permuted when permutation matrix was given as
input.
* kpse.cc (set_end): remove unused variable and its usage in conditional.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 14 Aug 2015 13:28:30 -0700 |
parents | b22528fd3deb |
children | ab2c5e84954a |
files | libinterp/corefcn/__dispatch__.cc libinterp/corefcn/cellfun.cc libinterp/corefcn/load-save.cc libinterp/corefcn/matrix_type.cc liboctave/util/kpse.cc |
diffstat | 5 files changed, 9 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/__dispatch__.cc +++ b/libinterp/corefcn/__dispatch__.cc @@ -50,15 +50,12 @@ if (nargin > 0 && nargin < 4) { - if (nargin > 0) - { - f = args(0).string_value (); + f = args(0).string_value (); - if (error_state) - { - error ("__dispatch__: first argument must be a function name"); - return retval; - } + if (error_state) + { + error ("__dispatch__: first argument must be a function name"); + return retval; } if (nargin > 1)
--- a/libinterp/corefcn/cellfun.cc +++ b/libinterp/corefcn/cellfun.cc @@ -1959,8 +1959,6 @@ retval = do_num2cell (array.map_value (), dimv); else if (array.is_cell ()) retval = do_num2cell (array.cell_value (), dimv); - else if (array.is_object ()) - retval = do_num2cell (array.cell_value (), dimv); else gripe_wrong_type_arg ("num2cell", array); }
--- a/libinterp/corefcn/load-save.cc +++ b/libinterp/corefcn/load-save.cc @@ -400,7 +400,7 @@ if (error_state || stream.eof () || name.empty ()) break; - else if (! error_state && ! name.empty ()) + else { if (tc.is_defined ()) { @@ -455,14 +455,6 @@ else error ("load: unable to load variable '%s'", name.c_str ()); } - else - { - if (count == 0) - error ("load: are you sure '%s' is an Octave data file?", - orig_fname.c_str ()); - - break; - } } if (list_only && count)
--- a/libinterp/corefcn/matrix_type.cc +++ b/libinterp/corefcn/matrix_type.cc @@ -306,10 +306,7 @@ (perm (i)) - 1; - if (str_typ == "upper") - mattyp.mark_as_permuted (len, p); - else - mattyp.mark_as_permuted (len, p); + mattyp.mark_as_permuted (len, p); } } } @@ -479,10 +476,7 @@ (perm (i)) - 1; - if (str_typ == "upper") - mattyp.mark_as_permuted (len, p); - else - mattyp.mark_as_permuted (len, p); + mattyp.mark_as_permuted (len, p); } } }
--- a/liboctave/util/kpse.cc +++ b/liboctave/util/kpse.cc @@ -485,9 +485,7 @@ { /* Find the next colon not enclosed by braces (or the end of the path). */ - - int brace_level = 0; - while (e < len && ! (brace_level == 0 && kpse_is_env_sep (path[e]))) + while (e < len && ! kpse_is_env_sep (path[e])) e++; } }