Mercurial > jwe > octave
comparison liboctave/array/CColVector.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 | f7121e111991 |
comparison
equal
deleted
inserted
replaced
21135:95da3bc8a281 | 21136:7cac4e7458f2 |
---|---|
78 ComplexColumnVector::insert (const ColumnVector& a, octave_idx_type r) | 78 ComplexColumnVector::insert (const ColumnVector& a, octave_idx_type r) |
79 { | 79 { |
80 octave_idx_type a_len = a.numel (); | 80 octave_idx_type a_len = a.numel (); |
81 | 81 |
82 if (r < 0 || r + a_len > numel ()) | 82 if (r < 0 || r + a_len > numel ()) |
83 { | 83 (*current_liboctave_error_handler) ("range error for insert"); |
84 (*current_liboctave_error_handler) ("range error for insert"); | |
85 return *this; | |
86 } | |
87 | 84 |
88 if (a_len > 0) | 85 if (a_len > 0) |
89 { | 86 { |
90 make_unique (); | 87 make_unique (); |
91 | 88 |
100 ComplexColumnVector::insert (const ComplexColumnVector& a, octave_idx_type r) | 97 ComplexColumnVector::insert (const ComplexColumnVector& a, octave_idx_type r) |
101 { | 98 { |
102 octave_idx_type a_len = a.numel (); | 99 octave_idx_type a_len = a.numel (); |
103 | 100 |
104 if (r < 0 || r + a_len > numel ()) | 101 if (r < 0 || r + a_len > numel ()) |
105 { | 102 (*current_liboctave_error_handler) ("range error for insert"); |
106 (*current_liboctave_error_handler) ("range error for insert"); | |
107 return *this; | |
108 } | |
109 | 103 |
110 if (a_len > 0) | 104 if (a_len > 0) |
111 { | 105 { |
112 make_unique (); | 106 make_unique (); |
113 | 107 |
155 ComplexColumnVector::fill (double val, octave_idx_type r1, octave_idx_type r2) | 149 ComplexColumnVector::fill (double val, octave_idx_type r1, octave_idx_type r2) |
156 { | 150 { |
157 octave_idx_type len = numel (); | 151 octave_idx_type len = numel (); |
158 | 152 |
159 if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) | 153 if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) |
160 { | 154 (*current_liboctave_error_handler) ("range error for fill"); |
161 (*current_liboctave_error_handler) ("range error for fill"); | |
162 return *this; | |
163 } | |
164 | 155 |
165 if (r1 > r2) { std::swap (r1, r2); } | 156 if (r1 > r2) { std::swap (r1, r2); } |
166 | 157 |
167 if (r2 >= r1) | 158 if (r2 >= r1) |
168 { | 159 { |
180 octave_idx_type r1, octave_idx_type r2) | 171 octave_idx_type r1, octave_idx_type r2) |
181 { | 172 { |
182 octave_idx_type len = numel (); | 173 octave_idx_type len = numel (); |
183 | 174 |
184 if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) | 175 if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) |
185 { | 176 (*current_liboctave_error_handler) ("range error for fill"); |
186 (*current_liboctave_error_handler) ("range error for fill"); | |
187 return *this; | |
188 } | |
189 | 177 |
190 if (r1 > r2) { std::swap (r1, r2); } | 178 if (r1 > r2) { std::swap (r1, r2); } |
191 | 179 |
192 if (r2 >= r1) | 180 if (r2 >= r1) |
193 { | 181 { |