Mercurial > hg > octave-nkf
changeset 19795:76478d2da117
unconditionally disable the octave_allocator class
* configure.ac: Delete the --enable-octave-allocator option.
* oct-alloc.h: Delete octave_allocator class. Warn if file is
included. Unconditionally define macros to be empty.
* NEWS: Make note of these changes.
* oct-alloc.cc: Delete.
* liboctave/util/module.mk (UTIL_SRC): Remove it from the list.
* make_int.cc, Cell.h, oct-obj.cc, oct-obj.h, audiodevinfo.cc,
ov-base-int.h, ov-base-scalar.h, ov-bool-mat.cc, ov-bool-mat.h,
ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc, ov-bool.h,
ov-builtin.cc, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.h,
ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-complex.cc,
ov-complex.h, ov-cs-list.cc, ov-cs-list.h, ov-cx-diag.cc,
ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h, ov-cx-sparse.cc,
ov-cx-sparse.h, ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc,
ov-fcn-handle.h, ov-fcn-inline.cc, ov-fcn-inline.h, ov-fcn.cc,
ov-fcn.h, ov-float.cc, ov-float.h, ov-flt-complex.cc,
ov-flt-complex.h, ov-flt-cx-diag.cc, ov-flt-cx-diag.h,
ov-flt-cx-mat.cc, ov-flt-cx-mat.h, ov-flt-re-diag.cc,
ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-int16.cc,
ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-intx.h, ov-java.cc,
ov-java.h, ov-mex-fcn.cc, ov-mex-fcn.h, ov-perm.cc, ov-perm.h,
ov-range.cc, ov-range.h, ov-re-diag.cc, ov-re-diag.h, ov-re-mat.cc,
ov-re-mat.h, ov-re-sparse.cc, ov-re-sparse.h, ov-scalar.cc,
ov-scalar.h, ov-str-mat.cc, ov-str-mat.h, ov-struct.cc, ov-struct.h,
ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc, ov-usr-fcn.cc,
ov-usr-fcn.h, ov.cc, ov.h, pt-const.cc, pt-const.h, idx-vector.cc,
idx-vector.h: Delete uses of oct-alloc.h and OCTAVE_ALLOCATOR macros.
line wrap: on
line diff
--- a/NEWS +++ b/NEWS @@ -205,6 +205,13 @@ ** The warning ID Octave:singular-matrix-div has been replaced by Octave:nearly-singular-matrix and Octave:singular-matrix. + ** The configure option --enable-octave-allocator has been removed. + The internal class <octave_allocator> declared in oct-alloc.h has + been removed. The header remains, but is deprecated. The macros to + access the class (DECLARE_OCTAVE_ALLOCATOR, DEFINE_OCTAVE_ALLOCATOR, + and DEFINE_OCTAVE_ALLOCATOR2) are now unconditionally defined to be + empty. + Summary of important user-visible changes for version 4.0: ---------------------------------------------------------
--- a/configure.ac +++ b/configure.ac @@ -232,19 +232,6 @@ AC_DEFINE(BOUNDS_CHECKING, 1, [Define to 1 to use internal bounds checking.]) fi -### Use Octave's built-in memory allocator rather than straightforward malloc. -### Disabled by default. - -USE_OCTAVE_ALLOCATOR=no -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.])], - [if test "$enableval" = yes; then USE_OCTAVE_ALLOCATOR=yes; fi], []) -if test $USE_OCTAVE_ALLOCATOR = yes; then - AC_DEFINE(USE_OCTAVE_ALLOCATOR, 1, - [Define to 1 to use octave_allocator class.]) -fi - ### Use atomic operations for internal reference counting. This is required ### for thread-safe behavior (Qt Handles) but incurs a significant slowdown. ### Enabled by default until a higher performing solution can be found. @@ -3093,7 +3080,6 @@ JIT compiler for loops: $build_jit Build Java interface: $build_java 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 @@ -3187,15 +3173,6 @@ AC_MSG_WARN([for plotting.]) AC_MSG_WARN([]) fi -if test $USE_ATOMIC_REFCOUNT = yes; then - if test $USE_OCTAVE_ALLOCATOR = yes; then - AC_MSG_WARN([Using atomic reference counting.]) - AC_MSG_WARN([Thread-safe behavior is not guaranteed unless the]) - AC_MSG_WARN([octave_allocator class is also disabled.]) - AC_MSG_WARN([]) - fi - warn_msg_printed=true -fi if $warn_msg_printed; then AC_MSG_NOTICE([])
--- a/examples/code/make_int.cc +++ b/examples/code/make_int.cc @@ -108,7 +108,6 @@ int scalar; - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; @@ -311,6 +310,5 @@ return retval; } -DEFINE_OCTAVE_ALLOCATOR (octave_integer); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_integer, "integer", "integer");
--- a/libinterp/corefcn/Cell.h +++ b/libinterp/corefcn/Cell.h @@ -27,7 +27,6 @@ #include <string> #include "Array.h" -#include "oct-alloc.h" #include "str-vec.h" #include "ov.h"
--- a/libinterp/corefcn/oct-obj.cc +++ b/libinterp/corefcn/oct-obj.cc @@ -31,7 +31,6 @@ // 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) {
--- a/libinterp/corefcn/oct-obj.h +++ b/libinterp/corefcn/oct-obj.h @@ -27,7 +27,6 @@ #include <string> #include <vector> -#include "oct-alloc.h" #include "str-vec.h" #include "Array.h" @@ -170,7 +169,6 @@ const octave_value& elem (octave_idx_type n) const { return data(n); } - DECLARE_OCTAVE_ALLOCATOR }; // Make it easy to build argument lists for built-in functions or for
--- a/libinterp/dldfcn/audiodevinfo.cc +++ b/libinterp/dldfcn/audiodevinfo.cc @@ -545,13 +545,11 @@ PaStreamParameters output_parameters; audio_type type; - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; static const unsigned int BUFFER_SIZE = 8192; -DEFINE_OCTAVE_ALLOCATOR (audioplayer); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (audioplayer, "audioplayer", "audioplayer"); static int @@ -1361,11 +1359,9 @@ PaStreamParameters input_parameters; audio_type type; - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; -DEFINE_OCTAVE_ALLOCATOR (audiorecorder); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (audiorecorder, "audiorecorder", "audiorecorder"); static int
--- a/libinterp/octave-value/ov-base-int.h +++ b/libinterp/octave-value/ov-base-int.h @@ -29,7 +29,6 @@ #include <string> #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "error.h"
--- a/libinterp/octave-value/ov-base-scalar.h +++ b/libinterp/octave-value/ov-base-scalar.h @@ -30,7 +30,6 @@ #include "lo-mappers.h" #include "lo-utils.h" -#include "oct-alloc.h" #include "str-vec.h" #include "MatrixType.h"
--- a/libinterp/octave-value/ov-bool-mat.cc +++ b/libinterp/octave-value/ov-bool-mat.cc @@ -52,7 +52,6 @@ template class octave_base_matrix<boolNDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_bool_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_bool_matrix, "bool matrix", "logical");
--- a/libinterp/octave-value/ov-bool-mat.h +++ b/libinterp/octave-value/ov-bool-mat.h @@ -30,7 +30,6 @@ #include <string> #include "mx-base.h" -#include "oct-alloc.h" #include "error.h" #include "oct-stream.h" @@ -232,7 +231,6 @@ protected: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-bool-sparse.cc +++ b/libinterp/octave-value/ov-bool-sparse.cc @@ -49,7 +49,6 @@ template class OCTINTERP_API octave_base_sparse<SparseBoolMatrix>; -DEFINE_OCTAVE_ALLOCATOR (octave_sparse_bool_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparse_bool_matrix, "sparse bool matrix", "logical");
--- a/libinterp/octave-value/ov-bool-sparse.h +++ b/libinterp/octave-value/ov-bool-sparse.h @@ -30,7 +30,6 @@ #include <string> #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "error.h" @@ -153,7 +152,6 @@ protected: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-bool.cc +++ b/libinterp/octave-value/ov-bool.cc @@ -46,7 +46,6 @@ template class octave_base_scalar<bool>; -DEFINE_OCTAVE_ALLOCATOR (octave_bool); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_bool, "bool", "logical");
--- a/libinterp/octave-value/ov-bool.h +++ b/libinterp/octave-value/ov-bool.h @@ -30,7 +30,6 @@ #include "lo-utils.h" #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "oct-stream.h" @@ -244,7 +243,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-builtin.cc +++ b/libinterp/octave-value/ov-builtin.cc @@ -33,7 +33,6 @@ #include "toplev.h" #include "unwind-prot.h" -DEFINE_OCTAVE_ALLOCATOR (octave_builtin); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_builtin, "built-in function",
--- a/libinterp/octave-value/ov-builtin.h +++ b/libinterp/octave-value/ov-builtin.h @@ -110,7 +110,6 @@ octave_builtin& operator = (const octave_builtin& ob); - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-cell.cc +++ b/libinterp/octave-value/ov-cell.cc @@ -124,7 +124,6 @@ template class octave_base_matrix<Cell>; -DEFINE_OCTAVE_ALLOCATOR (octave_cell); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_cell, "cell", "cell");
--- a/libinterp/octave-value/ov-cell.h +++ b/libinterp/octave-value/ov-cell.h @@ -31,7 +31,6 @@ #include <memory> #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "Cell.h" @@ -183,7 +182,6 @@ mutable std::auto_ptr<Array<std::string> > cellstr_cache; - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-ch-mat.h +++ b/libinterp/octave-value/ov-ch-mat.h @@ -30,7 +30,6 @@ #include <string> #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "error.h"
--- a/libinterp/octave-value/ov-class.cc +++ b/libinterp/octave-value/ov-class.cc @@ -57,7 +57,6 @@ #include "unwind-prot.h" #include "variables.h" -DEFINE_OCTAVE_ALLOCATOR(octave_class); int octave_class::t_id (-1);
--- a/libinterp/octave-value/ov-class.h +++ b/libinterp/octave-value/ov-class.h @@ -33,7 +33,6 @@ #include "str-vec.h" #include "error.h" -#include "oct-alloc.h" #include "oct-map.h" #include "ov-base.h" #include "ov-typeinfo.h" @@ -207,7 +206,6 @@ octave_map map; - DECLARE_OCTAVE_ALLOCATOR public: int type_id (void) const { return t_id; }
--- a/libinterp/octave-value/ov-classdef.cc +++ b/libinterp/octave-value/ov-classdef.cc @@ -875,7 +875,6 @@ //---------------------------------------------------------------------------- -DEFINE_OCTAVE_ALLOCATOR (octave_classdef); int octave_classdef::t_id (-1);
--- a/libinterp/octave-value/ov-classdef.h +++ b/libinterp/octave-value/ov-classdef.h @@ -1477,7 +1477,6 @@ cdef_object object; private: - DECLARE_OCTAVE_ALLOCATOR public: int type_id (void) const { return t_id; }
--- a/libinterp/octave-value/ov-complex.cc +++ b/libinterp/octave-value/ov-complex.cc @@ -50,7 +50,6 @@ template class octave_base_scalar<Complex>; -DEFINE_OCTAVE_ALLOCATOR (octave_complex); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex, "complex scalar", "double");
--- a/libinterp/octave-value/ov-complex.h +++ b/libinterp/octave-value/ov-complex.h @@ -30,7 +30,6 @@ #include "lo-ieee.h" #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "gripes.h" @@ -198,7 +197,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-cs-list.cc +++ b/libinterp/octave-value/ov-cs-list.cc @@ -35,7 +35,6 @@ #include "ov-cs-list.h" #include "unwind-prot.h" -DEFINE_OCTAVE_ALLOCATOR (octave_cs_list); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_cs_list, "cs-list", "cs-list");
--- a/libinterp/octave-value/ov-cs-list.h +++ b/libinterp/octave-value/ov-cs-list.h @@ -33,7 +33,6 @@ #include "Cell.h" #include "error.h" -#include "oct-alloc.h" #include "oct-obj.h" #include "ov-typeinfo.h" @@ -83,7 +82,6 @@ // The list of Octave values. octave_value_list lst; - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-cx-diag.cc +++ b/libinterp/octave-value/ov-cx-diag.cc @@ -36,7 +36,6 @@ template class octave_base_diag<ComplexDiagMatrix, ComplexMatrix>; -DEFINE_OCTAVE_ALLOCATOR (octave_complex_diag_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex_diag_matrix, "complex diagonal matrix", "double");
--- a/libinterp/octave-value/ov-cx-diag.h +++ b/libinterp/octave-value/ov-cx-diag.h @@ -89,7 +89,6 @@ bool chk_valid_scalar (const octave_value&, Complex&) const; - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-cx-mat.cc +++ b/libinterp/octave-value/ov-cx-mat.cc @@ -58,7 +58,6 @@ template class octave_base_matrix<ComplexNDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_complex_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex_matrix, "complex matrix", "double");
--- a/libinterp/octave-value/ov-cx-mat.h +++ b/libinterp/octave-value/ov-cx-mat.h @@ -30,7 +30,6 @@ #include <string> #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "error.h" @@ -177,7 +176,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-cx-sparse.cc +++ b/libinterp/octave-value/ov-cx-sparse.cc @@ -49,7 +49,6 @@ template class OCTINTERP_API octave_base_sparse<SparseComplexMatrix>; -DEFINE_OCTAVE_ALLOCATOR (octave_sparse_complex_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparse_complex_matrix, "sparse complex matrix", "double");
--- a/libinterp/octave-value/ov-cx-sparse.h +++ b/libinterp/octave-value/ov-cx-sparse.h @@ -30,7 +30,6 @@ #include <string> #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "error.h" @@ -154,7 +153,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-dld-fcn.cc +++ b/libinterp/octave-value/ov-dld-fcn.cc @@ -33,7 +33,6 @@ #include "ov-dld-fcn.h" #include "ov.h" -DEFINE_OCTAVE_ALLOCATOR (octave_dld_function); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_dld_function, "dynamically-linked function",
--- a/libinterp/octave-value/ov-dld-fcn.h +++ b/libinterp/octave-value/ov-dld-fcn.h @@ -95,7 +95,6 @@ octave_dld_function& operator = (const octave_dld_function& fn); - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-fcn-handle.cc +++ b/libinterp/octave-value/ov-fcn-handle.cc @@ -64,7 +64,6 @@ #include "ls-oct-binary.h" #include "ls-utils.h" -DEFINE_OCTAVE_ALLOCATOR (octave_fcn_handle); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_fcn_handle, "function handle",
--- a/libinterp/octave-value/ov-fcn-handle.h +++ b/libinterp/octave-value/ov-fcn-handle.h @@ -28,7 +28,6 @@ #include <string> #include <memory> -#include "oct-alloc.h" #include "ov-base.h" #include "ov-base-mat.h" @@ -164,7 +163,6 @@ bool set_fcn (const std::string &octaveroot, const std::string& fpath); - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
--- a/libinterp/octave-value/ov-fcn-inline.cc +++ b/libinterp/octave-value/ov-fcn-inline.cc @@ -53,7 +53,6 @@ #include "ls-hdf5.h" #include "ls-utils.h" -DEFINE_OCTAVE_ALLOCATOR (octave_fcn_inline); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_fcn_inline, "inline function",
--- a/libinterp/octave-value/ov-fcn-inline.h +++ b/libinterp/octave-value/ov-fcn-inline.h @@ -26,7 +26,6 @@ #include <iosfwd> #include <string> -#include "oct-alloc.h" #include "ov-base.h" #include "ov-base-mat.h" @@ -92,7 +91,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
--- a/libinterp/octave-value/ov-fcn.cc +++ b/libinterp/octave-value/ov-fcn.cc @@ -28,7 +28,6 @@ #include "oct-obj.h" #include "ov-fcn.h" -DEFINE_OCTAVE_ALLOCATOR (octave_function); octave_base_value * octave_function::clone (void) const
--- a/libinterp/octave-value/ov-fcn.h +++ b/libinterp/octave-value/ov-fcn.h @@ -28,7 +28,6 @@ #include "oct-time.h" #include "str-vec.h" -#include "oct-alloc.h" #include "oct-obj.h" #include "ov-base.h" #include "ov-typeinfo.h" @@ -223,7 +222,6 @@ octave_function& operator = (const octave_function& f); - DECLARE_OCTAVE_ALLOCATOR }; #endif
--- a/libinterp/octave-value/ov-float.cc +++ b/libinterp/octave-value/ov-float.cc @@ -53,7 +53,6 @@ template class octave_base_scalar<float>; -DEFINE_OCTAVE_ALLOCATOR (octave_float_scalar); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_scalar, "float scalar", "single");
--- a/libinterp/octave-value/ov-float.h +++ b/libinterp/octave-value/ov-float.h @@ -32,7 +32,6 @@ #include "lo-mappers.h" #include "lo-utils.h" #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "gripes.h" @@ -254,7 +253,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-flt-complex.cc +++ b/libinterp/octave-value/ov-flt-complex.cc @@ -50,7 +50,6 @@ template class octave_base_scalar<FloatComplex>; -DEFINE_OCTAVE_ALLOCATOR (octave_float_complex); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_complex, "float complex scalar", "single");
--- a/libinterp/octave-value/ov-flt-complex.h +++ b/libinterp/octave-value/ov-flt-complex.h @@ -30,7 +30,6 @@ #include "lo-ieee.h" #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "gripes.h" @@ -189,7 +188,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-flt-cx-diag.cc +++ b/libinterp/octave-value/ov-flt-cx-diag.cc @@ -35,7 +35,6 @@ template class octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix>; -DEFINE_OCTAVE_ALLOCATOR (octave_float_complex_diag_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_complex_diag_matrix, "float complex diagonal matrix", "single");
--- a/libinterp/octave-value/ov-flt-cx-diag.h +++ b/libinterp/octave-value/ov-flt-cx-diag.h @@ -87,7 +87,6 @@ bool chk_valid_scalar (const octave_value&, FloatComplex&) const; - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-flt-cx-mat.cc +++ b/libinterp/octave-value/ov-flt-cx-mat.cc @@ -62,7 +62,6 @@ template class octave_base_matrix<FloatComplexNDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_float_complex_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_complex_matrix, "float complex matrix", "single");
--- a/libinterp/octave-value/ov-flt-cx-mat.h +++ b/libinterp/octave-value/ov-flt-cx-mat.h @@ -30,7 +30,6 @@ #include <string> #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "error.h" @@ -175,7 +174,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-flt-re-diag.cc +++ b/libinterp/octave-value/ov-flt-re-diag.cc @@ -34,7 +34,6 @@ template class octave_base_diag<FloatDiagMatrix, FloatMatrix>; -DEFINE_OCTAVE_ALLOCATOR (octave_float_diag_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_diag_matrix, "float diagonal matrix", "single");
--- a/libinterp/octave-value/ov-flt-re-diag.h +++ b/libinterp/octave-value/ov-flt-re-diag.h @@ -87,7 +87,6 @@ bool chk_valid_scalar (const octave_value&, float&) const; - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-flt-re-mat.cc +++ b/libinterp/octave-value/ov-flt-re-mat.cc @@ -70,7 +70,6 @@ template class octave_base_matrix<FloatNDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_float_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_matrix, "float matrix", "single");
--- a/libinterp/octave-value/ov-flt-re-mat.h +++ b/libinterp/octave-value/ov-flt-re-mat.h @@ -30,7 +30,6 @@ #include <string> #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "error.h" @@ -210,7 +209,6 @@ octave_value map (unary_mapper_t umap) const; private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-int16.cc +++ b/libinterp/octave-value/ov-int16.cc @@ -59,7 +59,6 @@ template class octave_base_int_matrix<int16NDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_int16_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int16_matrix, "int16 matrix", "int16"); @@ -68,7 +67,6 @@ template class octave_base_int_scalar<octave_int16>; -DEFINE_OCTAVE_ALLOCATOR (octave_int16_scalar); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int16_scalar, "int16 scalar", "int16");
--- a/libinterp/octave-value/ov-int32.cc +++ b/libinterp/octave-value/ov-int32.cc @@ -59,7 +59,6 @@ template class octave_base_int_matrix<int32NDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_int32_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int32_matrix, "int32 matrix", "int32"); @@ -68,7 +67,6 @@ template class octave_base_int_scalar<octave_int32>; -DEFINE_OCTAVE_ALLOCATOR (octave_int32_scalar); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int32_scalar, "int32 scalar", "int32");
--- a/libinterp/octave-value/ov-int64.cc +++ b/libinterp/octave-value/ov-int64.cc @@ -59,7 +59,6 @@ template class octave_base_int_matrix<int64NDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_int64_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int64_matrix, "int64 matrix", "int64"); @@ -68,7 +67,6 @@ template class octave_base_int_scalar<octave_int64>; -DEFINE_OCTAVE_ALLOCATOR (octave_int64_scalar); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int64_scalar, "int64 scalar", "int64");
--- a/libinterp/octave-value/ov-int8.cc +++ b/libinterp/octave-value/ov-int8.cc @@ -59,7 +59,6 @@ template class octave_base_int_matrix<int8NDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_int8_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int8_matrix, "int8 matrix", "int8"); @@ -68,7 +67,6 @@ template class octave_base_int_scalar<octave_int8>; -DEFINE_OCTAVE_ALLOCATOR (octave_int8_scalar); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int8_scalar, "int8 scalar", "int8");
--- a/libinterp/octave-value/ov-intx.h +++ b/libinterp/octave-value/ov-intx.h @@ -27,7 +27,6 @@ #include <string> #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "error.h" @@ -375,7 +374,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; @@ -680,7 +678,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-java.cc +++ b/libinterp/octave-value/ov-java.cc @@ -1569,7 +1569,6 @@ // octave_java class definition -DEFINE_OCTAVE_ALLOCATOR (octave_java); int octave_java::t_id (-1);
--- a/libinterp/octave-value/ov-java.h +++ b/libinterp/octave-value/ov-java.h @@ -294,7 +294,6 @@ std::string java_classname; - DECLARE_OCTAVE_ALLOCATOR public: int type_id (void) const { return t_id; }
--- a/libinterp/octave-value/ov-mex-fcn.cc +++ b/libinterp/octave-value/ov-mex-fcn.cc @@ -37,7 +37,6 @@ #include "toplev.h" #include "unwind-prot.h" -DEFINE_OCTAVE_ALLOCATOR (octave_mex_function); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_mex_function, "mex function", "mex function");
--- a/libinterp/octave-value/ov-mex-fcn.h +++ b/libinterp/octave-value/ov-mex-fcn.h @@ -114,7 +114,6 @@ octave_mex_function& operator = (const octave_mex_function& fn); - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-perm.cc +++ b/libinterp/octave-value/ov-perm.cc @@ -418,7 +418,6 @@ return dense_cache; } -DEFINE_OCTAVE_ALLOCATOR (octave_perm_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_perm_matrix, "permutation matrix", "double");
--- a/libinterp/octave-value/ov-perm.h +++ b/libinterp/octave-value/ov-perm.h @@ -230,7 +230,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-range.cc +++ b/libinterp/octave-value/ov-range.cc @@ -48,7 +48,6 @@ // If TRUE, allow ranges with non-integer elements as array indices. static bool Vallow_noninteger_range_as_index = true; -DEFINE_OCTAVE_ALLOCATOR (octave_range); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_range, "range", "double");
--- a/libinterp/octave-value/ov-range.h +++ b/libinterp/octave-value/ov-range.h @@ -33,7 +33,6 @@ #include "lo-mappers.h" #include "lo-utils.h" #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "error.h" @@ -314,7 +313,6 @@ octave_range& operator = (const octave_range&); - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-re-diag.cc +++ b/libinterp/octave-value/ov-re-diag.cc @@ -35,7 +35,6 @@ template class octave_base_diag<DiagMatrix, Matrix>; -DEFINE_OCTAVE_ALLOCATOR (octave_diag_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_diag_matrix, "diagonal matrix", "double");
--- a/libinterp/octave-value/ov-re-diag.h +++ b/libinterp/octave-value/ov-re-diag.h @@ -92,7 +92,6 @@ bool chk_valid_scalar (const octave_value&, double&) const; - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-re-mat.cc +++ b/libinterp/octave-value/ov-re-mat.cc @@ -70,7 +70,6 @@ template class octave_base_matrix<NDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_matrix, "matrix", "double");
--- a/libinterp/octave-value/ov-re-mat.h +++ b/libinterp/octave-value/ov-re-mat.h @@ -30,7 +30,6 @@ #include <string> #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "error.h" @@ -234,7 +233,6 @@ octave_value map (unary_mapper_t umap) const; private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-re-sparse.cc +++ b/libinterp/octave-value/ov-re-sparse.cc @@ -49,7 +49,6 @@ template class OCTINTERP_API octave_base_sparse<SparseMatrix>; -DEFINE_OCTAVE_ALLOCATOR (octave_sparse_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparse_matrix, "sparse matrix", "double");
--- a/libinterp/octave-value/ov-re-sparse.h +++ b/libinterp/octave-value/ov-re-sparse.h @@ -30,7 +30,6 @@ #include <string> #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "error.h" @@ -158,7 +157,6 @@ private: octave_value map (double (*fcn) (double)) const; - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-scalar.cc +++ b/libinterp/octave-value/ov-scalar.cc @@ -53,7 +53,6 @@ template class octave_base_scalar<double>; -DEFINE_OCTAVE_ALLOCATOR (octave_scalar); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_scalar, "scalar", "double");
--- a/libinterp/octave-value/ov-scalar.h +++ b/libinterp/octave-value/ov-scalar.h @@ -32,7 +32,6 @@ #include "lo-mappers.h" #include "lo-utils.h" #include "mx-base.h" -#include "oct-alloc.h" #include "str-vec.h" #include "gripes.h" @@ -253,7 +252,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-str-mat.cc +++ b/libinterp/octave-value/ov-str-mat.cc @@ -53,8 +53,6 @@ #include "pt-mat.h" #include "utils.h" -DEFINE_OCTAVE_ALLOCATOR (octave_char_matrix_str); -DEFINE_OCTAVE_ALLOCATOR (octave_char_matrix_sq_str); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix_str, "string", "char"); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix_sq_str, "sq_string",
--- a/libinterp/octave-value/ov-str-mat.h +++ b/libinterp/octave-value/ov-str-mat.h @@ -171,7 +171,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; @@ -255,7 +254,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-struct.cc +++ b/libinterp/octave-value/ov-struct.cc @@ -47,7 +47,6 @@ #include "ls-utils.h" #include "pr-output.h" -DEFINE_OCTAVE_ALLOCATOR(octave_struct); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_struct, "struct", "struct"); @@ -1132,7 +1131,6 @@ return retval; } -DEFINE_OCTAVE_ALLOCATOR(octave_scalar_struct); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_scalar_struct, "scalar struct", "struct");
--- a/libinterp/octave-value/ov-struct.h +++ b/libinterp/octave-value/ov-struct.h @@ -32,7 +32,6 @@ #include "str-vec.h" #include "error.h" -#include "oct-alloc.h" #include "oct-map.h" #include "ov-base.h" #include "ov-typeinfo.h" @@ -162,7 +161,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; @@ -283,7 +281,6 @@ octave_value to_array (void); - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov-uint16.cc +++ b/libinterp/octave-value/ov-uint16.cc @@ -59,7 +59,6 @@ template class octave_base_int_matrix<uint16NDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_uint16_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint16_matrix, "uint16 matrix", "uint16"); @@ -68,7 +67,6 @@ template class octave_base_int_scalar<octave_uint16>; -DEFINE_OCTAVE_ALLOCATOR (octave_uint16_scalar); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint16_scalar, "uint16 scalar", "uint16");
--- a/libinterp/octave-value/ov-uint32.cc +++ b/libinterp/octave-value/ov-uint32.cc @@ -59,7 +59,6 @@ template class octave_base_int_matrix<uint32NDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_uint32_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint32_matrix, "uint32 matrix", "uint32"); @@ -68,7 +67,6 @@ template class octave_base_int_scalar<octave_uint32>; -DEFINE_OCTAVE_ALLOCATOR (octave_uint32_scalar); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint32_scalar, "uint32 scalar", "uint32");
--- a/libinterp/octave-value/ov-uint64.cc +++ b/libinterp/octave-value/ov-uint64.cc @@ -59,7 +59,6 @@ template class octave_base_int_matrix<uint64NDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_uint64_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint64_matrix, "uint64 matrix", "uint64"); @@ -68,7 +67,6 @@ template class octave_base_int_scalar<octave_uint64>; -DEFINE_OCTAVE_ALLOCATOR (octave_uint64_scalar); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint64_scalar, "uint64 scalar", "uint64");
--- a/libinterp/octave-value/ov-uint8.cc +++ b/libinterp/octave-value/ov-uint8.cc @@ -59,7 +59,6 @@ template class octave_base_int_matrix<uint8NDArray>; -DEFINE_OCTAVE_ALLOCATOR (octave_uint8_matrix); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint8_matrix, "uint8 matrix", "uint8"); @@ -68,7 +67,6 @@ template class octave_base_int_scalar<octave_uint8>; -DEFINE_OCTAVE_ALLOCATOR (octave_uint8_scalar); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint8_scalar, "uint8 scalar", "uint8");
--- a/libinterp/octave-value/ov-usr-fcn.cc +++ b/libinterp/octave-value/ov-usr-fcn.cc @@ -69,7 +69,6 @@ // User defined scripts. -DEFINE_OCTAVE_ALLOCATOR (octave_user_script); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_user_script, "user-defined script", @@ -180,7 +179,6 @@ // User defined functions. -DEFINE_OCTAVE_ALLOCATOR (octave_user_function); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_user_function, "user-defined function",
--- a/libinterp/octave-value/ov-usr-fcn.h +++ b/libinterp/octave-value/ov-usr-fcn.h @@ -165,7 +165,6 @@ octave_user_script& operator = (const octave_user_script& f); - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; @@ -521,7 +520,6 @@ octave_user_function& operator = (const octave_user_function& fn); - DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA };
--- a/libinterp/octave-value/ov.cc +++ b/libinterp/octave-value/ov.cc @@ -93,7 +93,6 @@ // We are likely to have a lot of octave_value objects to allocate, so // make the grow_size large. -DEFINE_OCTAVE_ALLOCATOR2(octave_value, 1024); // If TRUE, don't create special diagonal matrix objects.
--- a/libinterp/octave-value/ov.h +++ b/libinterp/octave-value/ov.h @@ -35,7 +35,6 @@ #include "idx-vector.h" #include "mach-info.h" #include "mx-base.h" -#include "oct-alloc.h" #include "oct-time.h" #include "str-vec.h" @@ -1241,7 +1240,6 @@ // const octave_base_value* which actually silently calls octave_value (bool). octave_value (const octave_base_value *); - DECLARE_OCTAVE_ALLOCATOR }; // Publish externally used friend functions.
--- a/libinterp/parse-tree/pt-const.cc +++ b/libinterp/parse-tree/pt-const.cc @@ -34,7 +34,6 @@ // We are likely to have a lot of tree_constant objects to allocate, // so make the grow_size large. -DEFINE_OCTAVE_ALLOCATOR2 (tree_constant, 1024); void tree_constant::print (std::ostream& os, bool pr_as_read_syntax,
--- a/libinterp/parse-tree/pt-const.h +++ b/libinterp/parse-tree/pt-const.h @@ -26,7 +26,6 @@ #include <iosfwd> #include <string> -#include "oct-alloc.h" class octave_value_list; class tree_walker; @@ -99,7 +98,6 @@ tree_constant& operator = (const tree_constant&); - DECLARE_OCTAVE_ALLOCATOR }; #endif
--- a/liboctave/array/idx-vector.cc +++ b/liboctave/array/idx-vector.cc @@ -63,7 +63,6 @@ return Array<octave_idx_type> (); } -DEFINE_OCTAVE_ALLOCATOR(idx_vector::idx_colon_rep); idx_vector::idx_colon_rep::idx_colon_rep (char c) { @@ -103,7 +102,6 @@ return os << ":"; } -DEFINE_OCTAVE_ALLOCATOR(idx_vector::idx_range_rep); idx_vector::idx_range_rep::idx_range_rep (octave_idx_type _start, octave_idx_type _limit, @@ -258,7 +256,6 @@ return convert_index (i, conv_error, ext); } -DEFINE_OCTAVE_ALLOCATOR(idx_vector::idx_scalar_rep); template <class T> idx_vector::idx_scalar_rep::idx_scalar_rep (T x) @@ -317,7 +314,6 @@ return Array<octave_idx_type> (dim_vector (1, 1), data); } -DEFINE_OCTAVE_ALLOCATOR(idx_vector::idx_vector_rep); template <class T> idx_vector::idx_vector_rep::idx_vector_rep (const Array<T>& nda) @@ -645,7 +641,6 @@ } } -DEFINE_OCTAVE_ALLOCATOR(idx_vector::idx_mask_rep); idx_vector::idx_mask_rep::idx_mask_rep (bool b) : data (0), len (b ? 1 : 0), ext (0), lsti (-1), lste (-1),
--- a/liboctave/array/idx-vector.h +++ b/liboctave/array/idx-vector.h @@ -34,7 +34,6 @@ #include "dim-vector.h" #include "oct-inttypes.h" -#include "oct-alloc.h" #include "oct-refcount.h" template<class T> class Array; @@ -146,7 +145,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR // No copying! idx_colon_rep (const idx_colon_rep& idx); @@ -208,7 +206,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR // No copying! idx_range_rep (const idx_range_rep& idx); @@ -265,7 +262,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR // No copying! idx_scalar_rep (const idx_scalar_rep& idx); @@ -332,7 +328,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR // No copying! idx_vector_rep (const idx_vector_rep& idx); @@ -406,7 +401,6 @@ private: - DECLARE_OCTAVE_ALLOCATOR // No copying! idx_mask_rep (const idx_mask_rep& idx);
--- a/liboctave/util/module.mk +++ b/liboctave/util/module.mk @@ -58,7 +58,6 @@ util/lo-array-gripes.cc \ util/lo-ieee.cc \ util/lo-utils.cc \ - util/oct-alloc.cc \ util/oct-base64.cc \ util/oct-glob.cc \ util/oct-inttypes.cc \
deleted file mode 100644 --- a/liboctave/util/oct-alloc.cc +++ /dev/null @@ -1,104 +0,0 @@ -/* - -Copyright (C) 1996-2013 John W. Eaton - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <new> - -#include "oct-alloc.h" - -void * -octave_allocator::alloc (size_t size) -{ - if (size != item_size) - return ::new char [size]; - - if (! head) - { - if (! grow ()) - return 0; - } - - link *tmp = head; - head = head->next; - return tmp; -} - -// FIXME: if we free the last item on the list, shouldn't we -// also free the underlying character array used for storage? - -void -octave_allocator::free (void *p, size_t size) -{ - if (size != item_size) - ::delete [] (static_cast<char *> (p)); - else - { - link *tmp = static_cast<link *> (p); - tmp->next = head; - head = tmp; - } -} - -// Return TRUE for successful allocation, FALSE otherwise. - -bool -octave_allocator::grow (void) -{ - bool retval = true; - - char *start = new char [grow_size * item_size]; - - if (start) - { - char *last = &start[(grow_size - 1) * item_size]; - - char *p = start; - while (p < last) - { - char *next = p + item_size; - (reinterpret_cast<link *> (p)) -> next - = reinterpret_cast<link *> (next); - p = next; - } - - (reinterpret_cast<link *> (last)) -> next = 0; - - head = reinterpret_cast<link *> (start); - } - else - { - typedef void (*error_handler_function) (void); - - error_handler_function f = std::set_new_handler (0); - std::set_new_handler (f); - - if (f) - f (); - - retval = false; - } - - return retval; -}
--- a/liboctave/util/oct-alloc.h +++ b/liboctave/util/oct-alloc.h @@ -23,79 +23,10 @@ #if !defined (octave_oct_alloc_h) #define octave_oct_alloc_h 1 -#include <cstddef> - -class -OCTAVE_API -octave_allocator -{ -public: - - octave_allocator (size_t item_sz, int grow_sz = 256) - : head (0), grow_size (grow_sz), - item_size (item_sz > sizeof (link *) ? item_sz : sizeof (link *)) - { } - - // Get an object from the free list, possibly increasing the size of - // the free list. - void *alloc (size_t size); - - // Put objects back on the free list. - void free (void *p, size_t size); - -private: - - // Structure for internal free list management. - struct link { link *next; }; - - // Front of the free list. - link *head; - - // How many objects to get each time we call the global operator new. - int grow_size; - - // The size of each item on the list (or, if that is smaller than - // the size of list*, the size of list*. - size_t item_size; - - // How to grow the free list. - bool grow (void); -}; - -#if defined (HAVE_PLACEMENT_DELETE) -#define DECLARE_OCTAVE_ALLOCATOR_PLACEMENT_DELETE \ - void operator delete (void *p, void *) \ - { ::operator delete (p, static_cast<void*> (0)); } -#else -#define DECLARE_OCTAVE_ALLOCATOR_PLACEMENT_DELETE \ - void operator delete (void *p, void *) \ - { ::operator delete (p); } -#endif - -#if defined (USE_OCTAVE_ALLOCATOR) - -#define DECLARE_OCTAVE_ALLOCATOR \ - public: \ - void *operator new (size_t size, void *p) \ - { return ::operator new (size, p); } \ - DECLARE_OCTAVE_ALLOCATOR_PLACEMENT_DELETE \ - void *operator new (size_t size) { return allocator.alloc (size); } \ - void operator delete (void *p, size_t size) { allocator.free (p, size); } \ - private: \ - static octave_allocator allocator; - -#define DEFINE_OCTAVE_ALLOCATOR(t) \ - octave_allocator t::allocator (sizeof (t)) - -#define DEFINE_OCTAVE_ALLOCATOR2(t, s) \ - octave_allocator t::allocator (sizeof (t), s) - -#else +#warning "the octave_allocator class has been deprecated and will be removed in a future release of Octave" #define DECLARE_OCTAVE_ALLOCATOR #define DEFINE_OCTAVE_ALLOCATOR(t) #define DEFINE_OCTAVE_ALLOCATOR2(t, s) #endif - -#endif