changeset 13838:a35d381e22b0

make octave_allocator optional and disable by default * configure.ac: Provide --enable-octave-allocator option. * oct-alloc.h: Conditionally define OCTAVE_ALLOCATOR macros.
author John W. Eaton <jwe@octave.org>
date Mon, 07 Nov 2011 03:20:10 -0500
parents 2c80bbd87f5d
children 13287562863b
files configure.ac liboctave/oct-alloc.h
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Mon Nov 07 02:56:06 2011 -0500
+++ b/configure.ac	Mon Nov 07 03:20:10 2011 -0500
@@ -167,6 +167,15 @@
   AC_DEFINE(BOUNDS_CHECKING, 1, [Define to use internal bounds checking.])
 fi
 
+USE_OCTAVE_ALLOCATOR=false
+AC_ARG_ENABLE(octave-allocator,
+  [AS_HELP_STRING([--enable-octave-allocator],
+     [use the obsolete octave_allocator class for many of Octave's objects (mostly octave_value types).  You probably do NOT want to enable this feature.  (default is no)])],
+  [if test "$enableval" = yes; then USE_ALLOCATOR=true; fi], [])
+if $USE_OCTAVE_ALLOCATOR; then
+  AC_DEFINE(USE_OCTAVE_ALLOCATOR, 1, [Define to use octave_allocator class.])
+fi
+
 ### Make it possible to disable running Make in the doc directory.
 ### Useful for building on systems without TeX, for example.
 DOCDIR=doc
@@ -2188,6 +2197,7 @@
   gnuplot:                     $GNUPLOT
 
   Do internal array bounds checking:  $BOUNDS_CHECKING
+  Use octave_allocator:               $USE_OCTAVE_ALLOCATOR
   Build static libraries:             $STATIC_LIBS
   Build shared libraries:             $SHARED_LIBS
   Dynamic Linking:                    $ENABLE_DYNAMIC_LINKING $DL_API_MSG
--- a/liboctave/oct-alloc.h	Mon Nov 07 02:56:06 2011 -0500
+++ b/liboctave/oct-alloc.h	Mon Nov 07 03:20:10 2011 -0500
@@ -72,6 +72,8 @@
       { ::operator delete (p); }
 #endif
 
+#if defined (USE_OCTAVE_ALLOCATOR)
+
 #define DECLARE_OCTAVE_ALLOCATOR \
   public: \
     void *operator new (size_t size, void *p) \
@@ -88,4 +90,12 @@
 #define DEFINE_OCTAVE_ALLOCATOR2(t, s) \
   octave_allocator t::allocator (sizeof (t), s)
 
+#else
+
+#define DECLARE_OCTAVE_ALLOCATOR
+#define DEFINE_OCTAVE_ALLOCATOR(t)
+#define DEFINE_OCTAVE_ALLOCATOR2(t, s)
+
 #endif
+
+#endif