changeset 4726:14dc2267c343

[project @ 2004-01-23 20:04:35 by jwe]
author jwe
date Fri, 23 Jan 2004 20:04:36 +0000
parents fa612b2cbfe9
children bcd75f15bc9c
files ChangeLog configure.in liboctave/ChangeLog liboctave/file-ops.cc src/ChangeLog src/file-io.cc src/load-save.cc src/ls-hdf5.cc src/ls-mat-ascii.cc src/ls-mat4.cc src/ls-mat5.cc src/ls-oct-ascii.cc src/ls-oct-binary.cc src/ov-bool-mat.cc src/ov-cx-mat.cc src/ov-re-mat.cc src/ov-str-mat.cc
diffstat 17 files changed, 36 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jan 23 16:42:51 2004 +0000
+++ b/ChangeLog	Fri Jan 23 20:04:36 2004 +0000
@@ -1,3 +1,9 @@
+2004-01-23  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* configure.in (AH_BOTTOM):
+	Define OCTAVE_LOCAL_BUFFER using vector<T> instead of auto_ptr.
+	Suggested by Paul Thomas <Paul.Thomas@jet.efda.org>
+
 2004-01-22  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* octMakefile.in (maintainer-clean, distclean):
--- a/configure.in	Fri Jan 23 16:42:51 2004 +0000
+++ b/configure.in	Fri Jan 23 20:04:36 2004 +0000
@@ -29,7 +29,7 @@
 EXTERN_CXXFLAGS="$CXXFLAGS"
 
 AC_INIT
-AC_REVISION($Revision: 1.442 $)
+AC_REVISION($Revision: 1.443 $)
 AC_PREREQ(2.57)
 AC_CONFIG_SRCDIR([src/octave.cc])
 AC_CONFIG_HEADER(config.h)
@@ -1430,15 +1430,20 @@
 #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.
+/* Always use vector<T>, since we sometimes allocate large chunks
+   of memory and that can cause trouble due to stack size limits.
+
+   Note that using auto_ptr is not appropriate because it uses delete,
+   not delete[] and we need the latter to properly handle arrays
+   allocated with new[size].
+
 #if defined (HAVE_DYNAMIC_AUTO_ARRAYS)
 #define OCTAVE_LOCAL_BUFFER(T, buf, size) \
   T buf[size]
 #else */
 #define OCTAVE_LOCAL_BUFFER(T, buf, size) \
-  std::auto_ptr<T> buf ## _auto_ptr (new T [size]); \
-  T *buf = buf ## _auto_ptr.get ()
+  std::vector<T> buf ## _vector (size); \
+  T *buf = &(buf ## _vector[0])
 /* #endif */
 
 #if defined (__DECCXX)
--- a/liboctave/ChangeLog	Fri Jan 23 16:42:51 2004 +0000
+++ b/liboctave/ChangeLog	Fri Jan 23 20:04:36 2004 +0000
@@ -1,5 +1,8 @@
 2004-01-23  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* file-ops.cc: Include <vector> instead of <memory> for new
+	definition of OCTAVE_LOCAL_BUFFER.
+
 	* EIG.cc, EIG.h (EIG::init, EIG::symmetric_init, EIG::hermitian_init):
 	New arg, calc_eigenvectors.
 	* EIG.h (EIG:EIG): New optional arg, calc_eigenvectors.
--- a/liboctave/file-ops.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/liboctave/file-ops.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -30,7 +30,7 @@
 #include <cstring>
 
 #include <iostream>
-#include <memory>
+#include <vector>
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
--- a/src/ChangeLog	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/ChangeLog	Fri Jan 23 20:04:36 2004 +0000
@@ -1,5 +1,12 @@
 2004-01-23  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* ov-bool.cc, ov-cx-mat.cc, ov-re-mat.cc, ov-str-mat.cc:
+	Include <vector>.
+	* file-io.cc, ls-hdf5.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-binary.cc:
+	Include <vector>, not <memory> for new defn of OCTAVE_LOCAL_BUFFER.
+	* load-save.cc, ls-mat-ascii.cc, ls-oct-ascii.cc
+	No need to include <memory> now.
+
 	* DLD-FUNCTIONS/eig.cc (Feig): Use new optional arg for EIG to
 	avoid computing eigenvectors if not requested.
 	Based on a patch from David Bateman  <dbateman@free.fr>.
--- a/src/file-io.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/file-io.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -42,7 +42,7 @@
 #include <cerrno>
 
 #include <iostream>
-#include <memory>
+#include <vector>
 
 #ifdef HAVE_UNISTD_H
 #ifdef HAVE_SYS_TYPES_H
--- a/src/load-save.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/load-save.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -35,7 +35,6 @@
 #include <fstream>
 #include <iomanip>
 #include <iostream>
-#include <memory>
 #include <string>
 
 #ifdef HAVE_HDF5
--- a/src/ls-hdf5.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/ls-hdf5.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -35,8 +35,8 @@
 #include <fstream>
 #include <iomanip>
 #include <iostream>
-#include <memory>
 #include <string>
+#include <vector>
 
 #include <hdf5.h>
 
--- a/src/ls-mat-ascii.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/ls-mat-ascii.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -31,7 +31,6 @@
 #include <fstream>
 #include <iomanip>
 #include <iostream>
-#include <memory>
 #include <string>
 
 #include "byte-swap.h"
--- a/src/ls-mat4.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/ls-mat4.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -31,8 +31,8 @@
 #include <fstream>
 #include <iomanip>
 #include <iostream>
-#include <memory>
 #include <string>
+#include <vector>
 
 #include "byte-swap.h"
 #include "data-conv.h"
--- a/src/ls-mat5.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/ls-mat5.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -33,8 +33,8 @@
 #include <fstream>
 #include <iomanip>
 #include <iostream>
-#include <memory>
 #include <string>
+#include <vector>
 
 #include "byte-swap.h"
 #include "data-conv.h"
--- a/src/ls-oct-ascii.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/ls-oct-ascii.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -32,7 +32,6 @@
 #include <fstream>
 #include <iomanip>
 #include <iostream>
-#include <memory>
 #include <string>
 
 #include "byte-swap.h"
--- a/src/ls-oct-binary.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/ls-oct-binary.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -31,8 +31,8 @@
 #include <fstream>
 #include <iomanip>
 #include <iostream>
-#include <memory>
 #include <string>
+#include <vector>
 
 #include "byte-swap.h"
 #include "data-conv.h"
--- a/src/ov-bool-mat.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/ov-bool-mat.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -29,6 +29,7 @@
 #endif
 
 #include <iostream>
+#include <vector>
 
 #include "lo-ieee.h"
 #include "mx-base.h"
--- a/src/ov-cx-mat.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/ov-cx-mat.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -29,6 +29,7 @@
 #endif
 
 #include <iostream>
+#include <vector>
 
 #include "lo-ieee.h"
 #include "mx-base.h"
--- a/src/ov-re-mat.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/ov-re-mat.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -31,6 +31,7 @@
 #include <climits>
 
 #include <iostream>
+#include <vector>
 
 #include "lo-ieee.h"
 #include "lo-utils.h"
--- a/src/ov-str-mat.cc	Fri Jan 23 16:42:51 2004 +0000
+++ b/src/ov-str-mat.cc	Fri Jan 23 20:04:36 2004 +0000
@@ -29,6 +29,7 @@
 #endif
 
 #include <iostream>
+#include <vector>
 
 #include "lo-ieee.h"
 #include "mx-base.h"