Mercurial > hg > octave-lojdl
changeset 8028:f0fbf47c914c
avoid null pointer call in Array<T>::hermitian
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 23:33:03 +0200 |
parents | fd13f9f7dbac |
children | 090001c04619 |
files | liboctave/Array.cc liboctave/ChangeLog |
diffstat | 2 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -1262,11 +1262,21 @@ } template <class T> +static T +no_op_fcn (const T& x) +{ + return x; +} + +template <class T> Array<T> Array<T>::hermitian (T (*fcn) (const T&)) const { assert (ndims () == 2); + if (! fcn) + fcn = no_op_fcn<T>; + octave_idx_type nr = dim1 (); octave_idx_type nc = dim2 ();
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2008-08-11 Jaroslav Hajek <highegg@gmail.com> + + * Array.cc (no_op_fcn): New static function. + (Array<T>::hermitian): If fcn is null, set to no_op_fcn. + 2008-08-07 John W. Eaton <jwe@octave.org> * sprse-base-chol.h, oct-sparse.h: Don't include config.h.