Mercurial > jwe > octave
comparison liboctave/array/CRowVector.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 |
---|---|
77 ComplexRowVector::insert (const RowVector& a, octave_idx_type c) | 77 ComplexRowVector::insert (const RowVector& a, octave_idx_type c) |
78 { | 78 { |
79 octave_idx_type a_len = a.numel (); | 79 octave_idx_type a_len = a.numel (); |
80 | 80 |
81 if (c < 0 || c + a_len > numel ()) | 81 if (c < 0 || c + a_len > numel ()) |
82 { | 82 (*current_liboctave_error_handler) ("range error for insert"); |
83 (*current_liboctave_error_handler) ("range error for insert"); | |
84 return *this; | |
85 } | |
86 | 83 |
87 if (a_len > 0) | 84 if (a_len > 0) |
88 { | 85 { |
89 make_unique (); | 86 make_unique (); |
90 | 87 |
99 ComplexRowVector::insert (const ComplexRowVector& a, octave_idx_type c) | 96 ComplexRowVector::insert (const ComplexRowVector& a, octave_idx_type c) |
100 { | 97 { |
101 octave_idx_type a_len = a.numel (); | 98 octave_idx_type a_len = a.numel (); |
102 | 99 |
103 if (c < 0 || c + a_len > numel ()) | 100 if (c < 0 || c + a_len > numel ()) |
104 { | 101 (*current_liboctave_error_handler) ("range error for insert"); |
105 (*current_liboctave_error_handler) ("range error for insert"); | |
106 return *this; | |
107 } | |
108 | 102 |
109 if (a_len > 0) | 103 if (a_len > 0) |
110 { | 104 { |
111 make_unique (); | 105 make_unique (); |
112 | 106 |
153 ComplexRowVector::fill (double val, octave_idx_type c1, octave_idx_type c2) | 147 ComplexRowVector::fill (double val, octave_idx_type c1, octave_idx_type c2) |
154 { | 148 { |
155 octave_idx_type len = numel (); | 149 octave_idx_type len = numel (); |
156 | 150 |
157 if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) | 151 if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) |
158 { | 152 (*current_liboctave_error_handler) ("range error for fill"); |
159 (*current_liboctave_error_handler) ("range error for fill"); | |
160 return *this; | |
161 } | |
162 | 153 |
163 if (c1 > c2) { std::swap (c1, c2); } | 154 if (c1 > c2) { std::swap (c1, c2); } |
164 | 155 |
165 if (c2 >= c1) | 156 if (c2 >= c1) |
166 { | 157 { |
178 octave_idx_type c1, octave_idx_type c2) | 169 octave_idx_type c1, octave_idx_type c2) |
179 { | 170 { |
180 octave_idx_type len = numel (); | 171 octave_idx_type len = numel (); |
181 | 172 |
182 if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) | 173 if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) |
183 { | 174 (*current_liboctave_error_handler) ("range error for fill"); |
184 (*current_liboctave_error_handler) ("range error for fill"); | |
185 return *this; | |
186 } | |
187 | 175 |
188 if (c1 > c2) { std::swap (c1, c2); } | 176 if (c1 > c2) { std::swap (c1, c2); } |
189 | 177 |
190 if (c2 >= c1) | 178 if (c2 >= c1) |
191 { | 179 { |