Mercurial > octave
comparison liboctave/array/dRowVector.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 | 499b851fbfae |
children | f7121e111991 |
comparison
equal
deleted
inserted
replaced
21135:95da3bc8a281 | 21136:7cac4e7458f2 |
---|---|
74 RowVector::insert (const RowVector& a, octave_idx_type c) | 74 RowVector::insert (const RowVector& a, octave_idx_type c) |
75 { | 75 { |
76 octave_idx_type a_len = a.numel (); | 76 octave_idx_type a_len = a.numel (); |
77 | 77 |
78 if (c < 0 || c + a_len > numel ()) | 78 if (c < 0 || c + a_len > numel ()) |
79 { | 79 (*current_liboctave_error_handler) ("range error for insert"); |
80 (*current_liboctave_error_handler) ("range error for insert"); | |
81 return *this; | |
82 } | |
83 | 80 |
84 if (a_len > 0) | 81 if (a_len > 0) |
85 { | 82 { |
86 make_unique (); | 83 make_unique (); |
87 | 84 |
112 RowVector::fill (double val, octave_idx_type c1, octave_idx_type c2) | 109 RowVector::fill (double val, octave_idx_type c1, octave_idx_type c2) |
113 { | 110 { |
114 octave_idx_type len = numel (); | 111 octave_idx_type len = numel (); |
115 | 112 |
116 if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) | 113 if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) |
117 { | 114 (*current_liboctave_error_handler) ("range error for fill"); |
118 (*current_liboctave_error_handler) ("range error for fill"); | |
119 return *this; | |
120 } | |
121 | 115 |
122 if (c1 > c2) { std::swap (c1, c2); } | 116 if (c1 > c2) { std::swap (c1, c2); } |
123 | 117 |
124 if (c2 >= c1) | 118 if (c2 >= c1) |
125 { | 119 { |