Mercurial > octave
diff libinterp/octave-value/ov-struct.cc @ 20893:384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
* data.cc, graphics.cc, graphics.in.h, ls-mat4.cc, ls-mat5.cc, oct-fstrm.cc,
oct-stream.cc, oct-strstrm.cc, __delaunayn__.cc, ov-base-int.cc, ov-classdef.h,
ov-complex.cc, ov-cx-sparse.cc, ov-fcn-inline.cc, ov-float.cc,
ov-flt-complex.cc, ov-java.cc, ov-range.cc, ov-re-sparse.cc, ov-scalar.cc,
ov-struct.cc, ov-usr-fcn.cc, ov.cc, op-cm-cm.cc, op-cm-m.cc, op-cm-scm.cc,
op-cm-sm.cc, op-fcm-fcm.cc, op-fcm-fm.cc, op-fm-fcm.cc, op-fm-fm.cc,
op-m-cm.cc, op-m-m.cc, op-m-scm.cc, op-m-sm.cc, op-scm-cm.cc, op-scm-m.cc,
op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-m.cc, op-sm-scm.cc,
op-sm-sm.cc, pt-exp.cc:
Eliminate useless return statements after error ().
author | Rik <rik@octave.org> |
---|---|
date | Mon, 14 Dec 2015 12:59:29 -0800 |
parents | 1142cf6abc0d |
children | b17fda023ca6 |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-struct.cc Mon Dec 14 11:28:48 2015 -0800 +++ b/libinterp/octave-value/ov-struct.cc Mon Dec 14 12:59:29 2015 -0800 @@ -280,10 +280,7 @@ octave_value t_rhs = rhs; if (idx.front ().empty ()) - { - error ("missing index in indexed assignment"); - return retval; - } + error ("missing index in indexed assignment"); if (n > 1 && ! (type.length () == 2 && type[0] == '(' && type[1] == '.')) { @@ -1168,10 +1165,7 @@ octave_value retval; if (idx.front ().empty ()) - { - error ("missing index in indexed assignment"); - return retval; - } + error ("missing index in indexed assignment"); if (type[0] == '.') { @@ -1755,10 +1749,7 @@ for (int i = 0; i < nargin; i += 2) { if (! args(i).is_string () || i + 1 >= nargin) - { - error ("struct: additional arguments must occur as \"field\", VALUE pairs"); - return retval; - } + error ("struct: additional arguments must occur as \"field\", VALUE pairs"); } // Check that the dimensions of the values correspond. @@ -2009,16 +2000,10 @@ print_usage (); if (! args(0).is_cell ()) - { - error ("cell2struct: argument CELL must be of type cell"); - return retval; - } + error ("cell2struct: argument CELL must be of type cell"); if (! (args(1).is_cellstr () || args(1).is_char_matrix ())) - { - error ("cell2struct: FIELDS must be a cell array of strings or a character matrix"); - return retval; - } + error ("cell2struct: FIELDS must be a cell array of strings or a character matrix"); const Cell vals = args(0).cell_value (); const Array<std::string> fields = args(1).cellstr_value (); @@ -2029,28 +2014,19 @@ if (nargin == 3) { - if (args(2).is_real_scalar ()) - dim = nargin == 2 ? 0 : args(2).int_value () - 1; - else - { - error ("cell2struct: DIM must be a real scalar"); - return retval; - } + if (! args(2).is_real_scalar ()) + error ("cell2struct: DIM must be a real scalar"); + + dim = nargin == 2 ? 0 : args(2).int_value () - 1; } if (dim < 0) - { - error ("cell2struct: DIM must be a valid dimension"); - return retval; - } + error ("cell2struct: DIM must be a valid dimension"); ext = vals.ndims () > dim ? vals.dims ()(dim) : 1; if (ext != fields.numel ()) - { - error ("cell2struct: number of FIELDS does not match dimension"); - return retval; - } + error ("cell2struct: number of FIELDS does not match dimension"); int nd = std::max (dim+1, vals.ndims ()); // result dimensions.