changeset 13969:3b5afcec526b

* pt-const.h, pt-const.cc: Use macros to declare and define octave_allocator.
author John W. Eaton <jwe@octave.org>
date Thu, 01 Dec 2011 04:04:50 -0500
parents 241f68fb48c3
children c93b953f7d54
files src/pt-const.cc src/pt-const.h
diffstat 2 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/pt-const.cc	Thu Dec 01 03:15:43 2011 -0500
+++ b/src/pt-const.cc	Thu Dec 01 04:04:50 2011 -0500
@@ -34,8 +34,7 @@
 
 // We are likely to have a lot of tree_constant objects to allocate,
 // so make the grow_size large.
-octave_allocator
-tree_constant::allocator (sizeof (tree_constant), 1024);
+DEFINE_OCTAVE_ALLOCATOR2 (tree_constant, 1024);
 
 void
 tree_constant::print (std::ostream& os, bool pr_as_read_syntax, bool pr_orig_text)
--- a/src/pt-const.h	Thu Dec 01 03:15:43 2011 -0500
+++ b/src/pt-const.h	Thu Dec 01 04:04:50 2011 -0500
@@ -55,10 +55,6 @@
 
   bool has_magic_end (void) const { return false; }
 
-  void *operator new (size_t size) { return allocator.alloc (size); }
-
-  void operator delete (void *p, size_t size) { allocator.free (p, size); }
-
   // Type.  It would be nice to eliminate the need for this.
 
   bool is_constant (void) const { return true; }
@@ -91,9 +87,6 @@
 
 private:
 
-  // For custom memory management.
-  static octave_allocator allocator;
-
   // The actual value that this constant refers to.
   octave_value val;
 
@@ -105,6 +98,8 @@
   tree_constant (const tree_constant&);
 
   tree_constant& operator = (const tree_constant&);
+
+  DECLARE_OCTAVE_ALLOCATOR
 };
 
 #endif