aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/serializer/validating/hex-binary.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-05-11 12:20:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-05-11 12:20:11 +0200
commit2e501c68a8641a2b3c430b55f13491a9c1c5d0f5 (patch)
tree49c2748443fe3c1f01108756b647440e0647a11b /libxsde/xsde/cxx/serializer/validating/hex-binary.cxx
parent161beba6cdb0d91b15ad19fa8b3e51d986203915 (diff)
Add support for custom allocators
New example: examples/cxx/hybrid/allocator.
Diffstat (limited to 'libxsde/xsde/cxx/serializer/validating/hex-binary.cxx')
-rw-r--r--libxsde/xsde/cxx/serializer/validating/hex-binary.cxx24
1 files changed, 21 insertions, 3 deletions
diff --git a/libxsde/xsde/cxx/serializer/validating/hex-binary.cxx b/libxsde/xsde/cxx/serializer/validating/hex-binary.cxx
index 5c3a8d5..712bbcb 100644
--- a/libxsde/xsde/cxx/serializer/validating/hex-binary.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/hex-binary.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/validating/hex-binary.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,16 @@ namespace xsde
hex_binary_simpl::
~hex_binary_simpl ()
{
- if (free_)
- delete const_cast<buffer*> (value_);
+ if (free_ && value_)
+ {
+ buffer* v = const_cast<buffer*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~buffer ();
+ cxx::free (v);
+#endif
+ }
}
void hex_binary_simpl::
@@ -60,7 +72,13 @@ namespace xsde
if (free_)
{
- delete const_cast<buffer*> (value_);
+ buffer* v = const_cast<buffer*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~buffer ();
+ cxx::free (v);
+#endif
value_ = 0;
}
}