diff options
Diffstat (limited to 'libxsde/xsde/cxx/parser/non-validating/idrefs.cxx')
-rw-r--r-- | libxsde/xsde/cxx/parser/non-validating/idrefs.cxx | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/libxsde/xsde/cxx/parser/non-validating/idrefs.cxx b/libxsde/xsde/cxx/parser/non-validating/idrefs.cxx index d9e2794..b559c81 100644 --- a/libxsde/xsde/cxx/parser/non-validating/idrefs.cxx +++ b/libxsde/xsde/cxx/parser/non-validating/idrefs.cxx @@ -7,6 +7,10 @@ #include <xsde/cxx/config.hxx> +#ifdef XSDE_CUSTOM_ALLOCATOR +# include <xsde/cxx/allocator.hxx> +#endif + #include <xsde/cxx/parser/non-validating/idrefs.hxx> namespace xsde @@ -20,8 +24,15 @@ namespace xsde idrefs_pimpl:: ~idrefs_pimpl () { - if (!base_) + if (!base_ && seq_) + { +#ifndef XSDE_CUSTOM_ALLOCATOR delete seq_; +#else + seq_->~string_sequence (); + cxx::free (seq_); +#endif + } } void idrefs_pimpl:: @@ -29,9 +40,14 @@ namespace xsde { idrefs_pskel::_reset (); - if (!base_) + if (!base_ && seq_) { +#ifndef XSDE_CUSTOM_ALLOCATOR delete seq_; +#else + seq_->~string_sequence (); + cxx::free (seq_); +#endif seq_ = 0; } @@ -55,7 +71,21 @@ namespace xsde { if (seq_ == 0) { +#ifndef XSDE_CUSTOM_ALLOCATOR seq_ = new string_sequence (); +#else + seq_ = static_cast<string_sequence*> ( + alloc (sizeof (string_sequence))); + +#ifdef XSDE_EXCEPTIONS + alloc_guard ag (seq_); + new (seq_) string_sequence (); + ag.release (); +#else + if (seq_) + new () string_sequence (); +#endif +#endif #ifndef XSDE_EXCEPTIONS if (seq_ == 0) |