# HG changeset patch # User jwe # Date 1051034568 0 # Node ID f8373733d8f956bae1432d0786f412bda2cef58a # Parent c77614c1c611f1fa0ecbaf5e101faf574a25841c [project @ 2003-04-22 18:02:48 by jwe] diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-04-22 John W. Eaton + + * configure.in (OCTAVE_LOCAL_BUFFER): Always allocate temporary + buffer using new. + 2003-04-18 John W. Eaton * Makefile.in octMakefile.in: Delete kpathsea targets. diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -22,7 +22,7 @@ ### 02111-1307, USA. AC_INIT -AC_REVISION($Revision: 1.424 $) +AC_REVISION($Revision: 1.425 $) AC_PREREQ(2.52) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -1389,14 +1389,16 @@ #define OCTAVE_HAVE_SIG_JUMP #endif +/* Always use new, since we sometimes allocate large chunks of memory + and that can cause trouble due to stack size limits. #if defined (HAVE_DYNAMIC_AUTO_ARRAYS) #define OCTAVE_LOCAL_BUFFER(T, buf, size) \ T buf[size] -#else +#else */ #define OCTAVE_LOCAL_BUFFER(T, buf, size) \ std::auto_ptr buf ## _auto_ptr (new T [size]); \ T *buf = buf ## _auto_ptr.get () -#endif +/* #endif */ #if defined (__DECCXX) #define __USE_STD_IOSTREAM diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,3 @@ -2003-04-22 John W. Eaton - - * load-save.cc (MAT5_DO_WRITE): Always allocate temporary buffer - using new. - 2003-04-18 John W. Eaton * toplev.cc (octave_config_info): Delete LIBKPATHSEA from struct. diff --git a/src/load-save.cc b/src/load-save.cc --- a/src/load-save.cc +++ b/src/load-save.cc @@ -4095,8 +4095,7 @@ #define MAT5_DO_WRITE(TYPE, data, count, stream) \ do \ { \ - std::auto_ptr tmp_auto_ptr (new TYPE [count]); \ - TYPE *ptr = tmp_auto_ptr.get (); \ + OCTAVE_LOCAL_BUFFER (TYPE, ptr, count); \ for (int i = 0; i < count; i++) \ ptr[i] = X_CAST (TYPE, data[i]); \ stream.write (X_CAST (char *, ptr), count * sizeof (TYPE)); \