Mercurial > hg > octave-nkf
changeset 15996:1aff8c38c53c
use octave_local_buffer for temporary arrays in quadcc
* quadcc.cc (Fquadcc): Use OCTAVE_LOCAL_BUFFER for local arrays.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 04 Feb 2013 17:07:15 -0500 |
parents | 906ae1705522 |
children | d53fa7e43aa9 |
files | libinterp/corefcn/quadcc.cc |
diffstat | 1 files changed, 5 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/quadcc.cc +++ b/libinterp/corefcn/quadcc.cc @@ -1552,14 +1552,10 @@ static const double w = M_SQRT2 / 2; static const int ndiv_max = 20; - /* The interval heap. */ - cquad_ival *ivals; - int *heap; - /* Arguments left and right */ int nargin = args.length (); octave_function *fcn; - double a, b, tol, *iivals, *sing; + double a, b, tol, *sing; /* Variables needed for transforming the integrand. */ bool wrap = false; @@ -1639,9 +1635,10 @@ int cquad_heapsize = (nivals >= min_cquad_heapsize ? nivals + 1 : min_cquad_heapsize); - heap = new int [cquad_heapsize]; - ivals = new cquad_ival [cquad_heapsize]; - iivals = new double [cquad_heapsize]; + /* The interval heap. */ + OCTAVE_LOCAL_BUFFER (cquad_ival, ivals, cquad_heapsize); + OCTAVE_LOCAL_BUFFER (double, iivals, cquad_heapsize); + OCTAVE_LOCAL_BUFFER (int, heap, cquad_heapsize); if (nivals == 1) { @@ -2243,11 +2240,6 @@ } #endif - /* Clean up heap memory */ - delete [] heap; - delete [] ivals; - delete [] iivals; - /* Clean up and present the results. */ if (nargout > 2) retval(2) = neval;