Mercurial > hg > octave-terminal
changeset 13917:826f008c829b
* oct-obj.h, oct-obj.cc: Use macros to declare and define octave_allocator.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 22 Nov 2011 22:42:15 -0500 |
parents | 0ec8413d4bbc |
children | 043aead8ed89 |
files | src/oct-obj.cc src/oct-obj.h |
diffstat | 2 files changed, 6 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/src/oct-obj.cc +++ b/src/oct-obj.cc @@ -29,6 +29,10 @@ #include "oct-obj.h" #include "Cell.h" +// We are likely to have a lot of octave_value_list objects to allocate, +// so make the grow_size large. +DEFINE_OCTAVE_ALLOCATOR2(octave_value_list, 1024); + octave_value_list::octave_value_list (const std::list<octave_value_list>& lst) { octave_idx_type n = 0, nel = 0; @@ -59,9 +63,6 @@ } -octave_allocator -octave_value_list::allocator (sizeof (octave_value_list)); - octave_value_list& octave_value_list::prepend (const octave_value& val) {
--- a/src/oct-obj.h +++ b/src/oct-obj.h @@ -66,26 +66,6 @@ ~octave_value_list (void) { } - void *operator new (size_t size) - { return allocator.alloc (size); } - - void operator delete (void *p, size_t size) - { allocator.free (p, size); } - - // FIXME -- without this, I have errors with the stack of - // octave_value_list objects in ov-usr-fcn.h. Why? - void *operator new (size_t size, void *p) - { return ::operator new (size, p); } - - void operator delete (void *p, void *) - { -#if defined (HAVE_PLACEMENT_DELETE) - ::operator delete (p, static_cast<void *> (0)); -#else - ::operator delete (p); -#endif - } - octave_value_list& operator = (const octave_value_list& obj) { if (this != &obj) @@ -167,8 +147,6 @@ private: - static octave_allocator allocator; - Array<octave_value> data; // This list of strings can be used to tag each element of data with @@ -185,6 +163,8 @@ const octave_value& elem (octave_idx_type n) const { return data(n); } + + DECLARE_OCTAVE_ALLOCATOR }; #endif