Mercurial > octave
diff libinterp/corefcn/strfns.cc @ 20704:571508c1ed06
eliminate more uses of error_state
* ov.h, ov.cc (octave_value::xall_strings): New extractor.
* bitfcns.cc, data.cc, ellipj.cc, fftn.cc, file-io.cc, filter.cc,
find.cc, graphics.cc, input.cc, load-path.cc, luinc.cc,
matrix_type.cc, oct-stream.cc, ordschur.cc, psi.cc, rand.cc,
spparms.cc, strfns.cc, symtab.cc, syscalls.cc, sysdep.cc, time.cc,
utils.cc, variables.cc, __glpk__.cc, __magick_read__.cc, amd.cc,
ov-cell.cc, ov-fcn-inline.cc, ov-struct.cc:
Eliminate more uses of error_state.
* system.tst: Update tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 14 Nov 2015 15:18:05 -0500 |
parents | 68e3a747ca02 |
children | a6eaedd8bd75 |
line wrap: on
line diff
--- a/libinterp/corefcn/strfns.cc Sat Nov 14 12:07:38 2015 -0500 +++ b/libinterp/corefcn/strfns.cc Sat Nov 14 15:18:05 2015 -0500 @@ -95,13 +95,7 @@ for (int i = 0; i < nargin; i++) { - string_vector s = args(i).all_strings (); - - if (error_state) - { - error ("char: unable to convert some args to strings"); - return retval; - } + string_vector s = args(i).xall_strings ("char: unable to convert some args to strings"); if (s.numel () > 0) n_elts += s.numel (); @@ -216,13 +210,7 @@ for (int i = 0; i < nargin; i++) { - string_vector s = args(i).all_strings (); - - if (error_state) - { - error ("strvcat: unable to convert some args to strings"); - return retval; - } + string_vector s = args(i).xall_strings ("strvcat: unable to convert some args to strings"); size_t n = s.numel (); @@ -899,26 +887,12 @@ return retval; } - string_vector s = args(0).all_strings (); - - if (error_state) - { - error ("list_in_columns: ARG must be a cellstr or char array"); - return retval; - } + string_vector s = args(0).xall_strings ("list_in_columns: ARG must be a cellstr or char array"); int width = -1; if (nargin > 1 && ! args(1).is_empty ()) - { - width = args(1).int_value (); - - if (error_state) - { - error ("list_in_columns: WIDTH must be an integer"); - return retval; - } - } + width = args(1).xint_value ("list_in_columns: WIDTH must be an integer"); std::string prefix; @@ -951,5 +925,5 @@ %!error list_in_columns () %!error list_in_columns (["abc", "def"], 20, 2) %!error list_in_columns (["abc", "def"], 20, " ", 3) -%!error <invalid conversion from string to real scalar> list_in_columns (["abc", "def"], "a") +%!error <list_in_columns: WIDTH must be an integer> list_in_columns (["abc", "def"], "a") */