Mercurial > jwe > octave
comparison liboctave/array/idx-vector.cc @ 21136:7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Remove statements after call to handler that are no longer reachable.
Place input validation first and immediately call handler if necessary.
Change if/error_handler/else to if/error_handler and re-indent code.
* Array-util.cc, Array.cc, CColVector.cc, CDiagMatrix.cc, CMatrix.cc,
CNDArray.cc, CRowVector.cc, CSparse.cc, DiagArray2.cc, MArray.cc,
PermMatrix.cc, Sparse.cc, Sparse.h, chMatrix.cc, chNDArray.cc, dColVector.cc,
dDiagMatrix.cc, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc,
fCColVector.cc, fCDiagMatrix.cc, fCMatrix.cc, fCNDArray.cc, fCRowVector.cc,
fColVector.cc, fDiagMatrix.cc, fMatrix.cc, fNDArray.cc, fRowVector.cc,
idx-vector.cc, CmplxAEPBAL.cc, CmplxCHOL.cc, CmplxGEPBAL.cc, CmplxHESS.cc,
CmplxLU.cc, CmplxQR.cc, CmplxSCHUR.cc, CmplxSVD.cc, DASPK.cc, EIG.cc, LSODE.cc,
Quad.cc, SparseCmplxCHOL.cc, SparseCmplxLU.cc, SparseCmplxQR.cc, SparseQR.cc,
SparsedbleCHOL.cc, SparsedbleLU.cc, base-lu.cc, bsxfun-defs.cc, dbleAEPBAL.cc,
dbleCHOL.cc, dbleGEPBAL.cc, dbleHESS.cc, dbleLU.cc, dbleQR.cc, dbleSCHUR.cc,
dbleSVD.cc, eigs-base.cc, fCmplxAEPBAL.cc, fCmplxCHOL.cc, fCmplxLU.cc,
fCmplxQR.cc, fCmplxSCHUR.cc, fEIG.cc, floatAEPBAL.cc, floatCHOL.cc,
floatGEPBAL.cc, floatHESS.cc, floatLU.cc, floatQR.cc, floatSCHUR.cc,
floatSVD.cc, lo-specfun.cc, oct-fftw.cc, oct-rand.cc, oct-spparms.cc,
sparse-base-chol.cc, sparse-dmsolve.cc, file-ops.cc, lo-sysdep.cc,
mach-info.cc, oct-env.cc, oct-syscalls.cc, cmd-edit.cc, cmd-hist.cc,
data-conv.cc, lo-ieee.cc, lo-regexp.cc, oct-base64.cc, oct-shlib.cc,
pathsearch.cc, singleton-cleanup.cc, sparse-util.cc, unwind-prot.cc:
Remove statements after call to handler that are no longer reachable.
Place input validation first and immediately call handler if necessary.
Change if/error_handler/else to if/error_handler and re-indent code.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 23 Jan 2016 13:52:03 -0800 |
parents | 228b65504557 |
children | 538b57866b90 |
comparison
equal
deleted
inserted
replaced
21135:95da3bc8a281 | 21136:7cac4e7458f2 |
---|---|
57 Array<octave_idx_type> | 57 Array<octave_idx_type> |
58 idx_vector::idx_base_rep::as_array (void) | 58 idx_vector::idx_base_rep::as_array (void) |
59 { | 59 { |
60 (*current_liboctave_error_handler) | 60 (*current_liboctave_error_handler) |
61 ("internal error: as_array not allowed for this index class"); | 61 ("internal error: as_array not allowed for this index class"); |
62 | |
63 return Array<octave_idx_type> (); | |
64 } | 62 } |
65 | 63 |
66 | 64 |
67 idx_vector::idx_colon_rep::idx_colon_rep (char c) | 65 idx_vector::idx_colon_rep::idx_colon_rep (char c) |
68 { | 66 { |
69 if (c != ':') | 67 if (c != ':') |
70 { | 68 { |
71 (*current_liboctave_error_handler) | 69 (*current_liboctave_error_handler) |
72 ("internal error: invalid character converted to idx_vector; must be ':'"); | 70 ("internal error: invalid character converted to idx_vector; must be ':'"); |
71 // FIXME: this is unreachable now. | |
73 err = true; | 72 err = true; |
74 } | 73 } |
75 } | 74 } |
76 | 75 |
77 octave_idx_type | 76 octave_idx_type |
86 idx_vector::idx_base_rep * | 85 idx_vector::idx_base_rep * |
87 idx_vector::idx_colon_rep::sort_idx (Array<octave_idx_type>&) | 86 idx_vector::idx_colon_rep::sort_idx (Array<octave_idx_type>&) |
88 { | 87 { |
89 (*current_liboctave_error_handler) | 88 (*current_liboctave_error_handler) |
90 ("internal error: idx_colon_rep::sort_idx"); | 89 ("internal error: idx_colon_rep::sort_idx"); |
91 | |
92 count++; | |
93 return this; | |
94 } | 90 } |
95 | 91 |
96 std::ostream& | 92 std::ostream& |
97 idx_vector::idx_colon_rep::print (std::ostream& os) const | 93 idx_vector::idx_colon_rep::print (std::ostream& os) const |
98 { | 94 { |
1264 { | 1260 { |
1265 if (! resize_ok && extent (z_len) > z_len) | 1261 if (! resize_ok && extent (z_len) > z_len) |
1266 { | 1262 { |
1267 (*current_liboctave_error_handler) | 1263 (*current_liboctave_error_handler) |
1268 ("invalid matrix index = %d", extent (z_len)); | 1264 ("invalid matrix index = %d", extent (z_len)); |
1265 // FIXME: Should we call this before calling error_handler? | |
1269 rep->err = true; | 1266 rep->err = true; |
1270 chkerr (); | 1267 chkerr (); |
1271 } | 1268 } |
1272 | 1269 |
1273 return length (z_len); | 1270 return length (z_len); |