aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/serializer
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
parent161beba6cdb0d91b15ad19fa8b3e51d986203915 (diff)
Add support for custom allocators
New example: examples/cxx/hybrid/allocator.
Diffstat (limited to 'libxsde/xsde/cxx/serializer')
-rw-r--r--libxsde/xsde/cxx/serializer/context.cxx16
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/base64-binary.cxx24
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/hex-binary.cxx24
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/id.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/idref.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/idrefs-stl.cxx24
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/idrefs.cxx25
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/language.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/name.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/ncname.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/nmtoken.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/nmtokens-stl.cxx24
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/nmtokens.cxx25
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/normalized-string-stl.cxx1
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/normalized-string.cxx23
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/qname.cxx24
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/string.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/token.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/non-validating/uri.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/substitution-map.cxx49
-rw-r--r--libxsde/xsde/cxx/serializer/validating/base64-binary.cxx24
-rw-r--r--libxsde/xsde/cxx/serializer/validating/hex-binary.cxx24
-rw-r--r--libxsde/xsde/cxx/serializer/validating/id.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/validating/idref.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/validating/idrefs-stl.cxx24
-rw-r--r--libxsde/xsde/cxx/serializer/validating/idrefs.cxx25
-rw-r--r--libxsde/xsde/cxx/serializer/validating/inheritance-map.cxx25
-rw-r--r--libxsde/xsde/cxx/serializer/validating/language.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/validating/name.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/validating/ncname.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/validating/nmtoken.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/validating/nmtokens-stl.cxx24
-rw-r--r--libxsde/xsde/cxx/serializer/validating/nmtokens.cxx25
-rw-r--r--libxsde/xsde/cxx/serializer/validating/normalized-string.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/validating/qname.cxx24
-rw-r--r--libxsde/xsde/cxx/serializer/validating/string.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/validating/token.cxx22
-rw-r--r--libxsde/xsde/cxx/serializer/validating/uri.cxx22
38 files changed, 763 insertions, 109 deletions
diff --git a/libxsde/xsde/cxx/serializer/context.cxx b/libxsde/xsde/cxx/serializer/context.cxx
index faa1ed4..0a53c74 100644
--- a/libxsde/xsde/cxx/serializer/context.cxx
+++ b/libxsde/xsde/cxx/serializer/context.cxx
@@ -13,6 +13,10 @@
# include <xsde/cxx/serializer/exceptions.hxx>
#endif
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
#ifdef XSDE_ENCODING_ISO8859_1
# include <xsde/cxx/iso8859-1.hxx>
#endif
@@ -738,7 +742,11 @@ namespace xsde
buf = data_buf_;
else
{
+#ifndef XSDE_CUSTOM_ALLOCATOR
buf = new char[utf_n];
+#else
+ buf = static_cast<char*> (alloc (utf_n));
+#endif
#ifndef XSDE_EXCEPTIONS
if (buf == 0)
@@ -763,7 +771,11 @@ namespace xsde
buf = data_buf_;
else
{
+#ifndef XSDE_CUSTOM_ALLOCATOR
buf = new char[utf_n];
+#else
+ buf = static_cast<char*> (alloc (utf_n));
+#endif
#ifndef XSDE_EXCEPTIONS
if (buf == 0)
@@ -788,7 +800,11 @@ namespace xsde
buf = fix;
else
{
+#ifndef XSDE_CUSTOM_ALLOCATOR
buf = new char[utf_n];
+#else
+ buf = static_cast<char*> (alloc (utf_n));
+#endif
#ifndef XSDE_EXCEPTIONS
if (buf == 0)
diff --git a/libxsde/xsde/cxx/serializer/non-validating/base64-binary.cxx b/libxsde/xsde/cxx/serializer/non-validating/base64-binary.cxx
index 89afb12..180823e 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/base64-binary.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/base64-binary.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/base64-binary.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,16 @@ namespace xsde
base64_binary_simpl::
~base64_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 base64_binary_simpl::
@@ -156,7 +168,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;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/hex-binary.cxx b/libxsde/xsde/cxx/serializer/non-validating/hex-binary.cxx
index 9c5a49c..36d3e32 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/hex-binary.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/hex-binary.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-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;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/id.cxx b/libxsde/xsde/cxx/serializer/non-validating/id.cxx
index db50bef..ac7ede2 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/id.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/id.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/id.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,15 @@ namespace xsde
id_simpl::
~id_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void id_simpl::
@@ -33,7 +44,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/idref.cxx b/libxsde/xsde/cxx/serializer/non-validating/idref.cxx
index c4022e7..e52650f 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/idref.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/idref.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/idref.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,15 @@ namespace xsde
idref_simpl::
~idref_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void idref_simpl::
@@ -33,7 +44,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/idrefs-stl.cxx b/libxsde/xsde/cxx/serializer/non-validating/idrefs-stl.cxx
index ab48695..b95719a 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/idrefs-stl.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/idrefs-stl.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/idrefs-stl.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,16 @@ namespace xsde
idrefs_simpl::
~idrefs_simpl ()
{
- if (free_)
- delete const_cast<string_sequence*> (value_);
+ if (free_ && value_)
+ {
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
+ }
}
void idrefs_simpl::
@@ -91,7 +103,13 @@ namespace xsde
if (free_)
{
- delete const_cast<string_sequence*> (value_);
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/idrefs.cxx b/libxsde/xsde/cxx/serializer/non-validating/idrefs.cxx
index 11261a6..f812526 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/idrefs.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/idrefs.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/idrefs.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,16 @@ namespace xsde
idrefs_simpl::
~idrefs_simpl ()
{
- if (free_)
- delete const_cast<string_sequence*> (value_);
+ if (free_ && value_)
+ {
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
+ }
}
void idrefs_simpl::
@@ -91,7 +103,13 @@ namespace xsde
if (free_)
{
- delete const_cast<string_sequence*> (value_);
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
value_ = 0;
}
}
@@ -106,4 +124,3 @@ namespace xsde
}
}
}
-
diff --git a/libxsde/xsde/cxx/serializer/non-validating/language.cxx b/libxsde/xsde/cxx/serializer/non-validating/language.cxx
index 72ccd8b..801aa3a 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/language.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/language.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/language.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,15 @@ namespace xsde
language_simpl::
~language_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void language_simpl::
@@ -33,7 +44,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/name.cxx b/libxsde/xsde/cxx/serializer/non-validating/name.cxx
index 851dcf9..6e8e0b1 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/name.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/name.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/name.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,15 @@ namespace xsde
name_simpl::
~name_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void name_simpl::
@@ -33,7 +44,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/ncname.cxx b/libxsde/xsde/cxx/serializer/non-validating/ncname.cxx
index 3c86986..eee9d60 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/ncname.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/ncname.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/ncname.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,15 @@ namespace xsde
ncname_simpl::
~ncname_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void ncname_simpl::
@@ -33,7 +44,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/nmtoken.cxx b/libxsde/xsde/cxx/serializer/non-validating/nmtoken.cxx
index a384c04..8f153ff 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/nmtoken.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/nmtoken.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/nmtoken.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,15 @@ namespace xsde
nmtoken_simpl::
~nmtoken_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void nmtoken_simpl::
@@ -33,7 +44,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/nmtokens-stl.cxx b/libxsde/xsde/cxx/serializer/non-validating/nmtokens-stl.cxx
index 6636b33..7cea1f1 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/nmtokens-stl.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/nmtokens-stl.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/nmtokens-stl.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,16 @@ namespace xsde
nmtokens_simpl::
~nmtokens_simpl ()
{
- if (free_)
- delete const_cast<string_sequence*> (value_);
+ if (free_ && value_)
+ {
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
+ }
}
void nmtokens_simpl::
@@ -91,7 +103,13 @@ namespace xsde
if (free_)
{
- delete const_cast<string_sequence*> (value_);
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/nmtokens.cxx b/libxsde/xsde/cxx/serializer/non-validating/nmtokens.cxx
index ad40fc4..57afd8d 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/nmtokens.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/nmtokens.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/nmtokens.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,16 @@ namespace xsde
nmtokens_simpl::
~nmtokens_simpl ()
{
- if (free_)
- delete const_cast<string_sequence*> (value_);
+ if (free_ && value_)
+ {
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
+ }
}
void nmtokens_simpl::
@@ -91,7 +103,13 @@ namespace xsde
if (free_)
{
- delete const_cast<string_sequence*> (value_);
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
value_ = 0;
}
}
@@ -106,4 +124,3 @@ namespace xsde
}
}
}
-
diff --git a/libxsde/xsde/cxx/serializer/non-validating/normalized-string-stl.cxx b/libxsde/xsde/cxx/serializer/non-validating/normalized-string-stl.cxx
index 5810de3..b5209c3 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/normalized-string-stl.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/normalized-string-stl.cxx
@@ -33,4 +33,3 @@ namespace xsde
}
}
}
-
diff --git a/libxsde/xsde/cxx/serializer/non-validating/normalized-string.cxx b/libxsde/xsde/cxx/serializer/non-validating/normalized-string.cxx
index b1bbf29..202ac76 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/normalized-string.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/normalized-string.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/normalized-string.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,15 @@ namespace xsde
normalized_string_simpl::
~normalized_string_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void normalized_string_simpl::
@@ -33,7 +44,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
@@ -41,4 +57,3 @@ namespace xsde
}
}
}
-
diff --git a/libxsde/xsde/cxx/serializer/non-validating/qname.cxx b/libxsde/xsde/cxx/serializer/non-validating/qname.cxx
index 19c7daa..ec267ef 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/qname.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/qname.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/qname.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,16 @@ namespace xsde
qname_simpl::
~qname_simpl ()
{
- if (free_)
- delete const_cast<qname*> (value_);
+ if (free_ && value_)
+ {
+ qname* v = const_cast<qname*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~qname ();
+ cxx::free (v);
+#endif
+ }
}
void qname_simpl::
@@ -52,7 +64,13 @@ namespace xsde
if (free_)
{
- delete const_cast<qname*> (value_);
+ qname* v = const_cast<qname*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~qname ();
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/string.cxx b/libxsde/xsde/cxx/serializer/non-validating/string.cxx
index 7b1e546..1c6c50f 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/string.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/string.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/string.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,15 @@ namespace xsde
string_simpl::
~string_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void string_simpl::
@@ -33,7 +44,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/token.cxx b/libxsde/xsde/cxx/serializer/non-validating/token.cxx
index 5ff0739..2af141c 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/token.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/token.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/token.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,15 @@ namespace xsde
token_simpl::
~token_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void token_simpl::
@@ -33,7 +44,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/non-validating/uri.cxx b/libxsde/xsde/cxx/serializer/non-validating/uri.cxx
index 43bafbd..5640302 100644
--- a/libxsde/xsde/cxx/serializer/non-validating/uri.cxx
+++ b/libxsde/xsde/cxx/serializer/non-validating/uri.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/non-validating/uri.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,15 @@ namespace xsde
uri_simpl::
~uri_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void uri_simpl::
@@ -33,7 +44,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/substitution-map.cxx b/libxsde/xsde/cxx/serializer/substitution-map.cxx
index 0dfc97f..28f01b5 100644
--- a/libxsde/xsde/cxx/serializer/substitution-map.cxx
+++ b/libxsde/xsde/cxx/serializer/substitution-map.cxx
@@ -12,6 +12,10 @@
# include <stdlib.h> // exit
#endif
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
#include <xsde/cxx/serializer/substitution-map.hxx>
#include <xsde/cxx/serializer/substitution-map-load.hxx>
@@ -29,7 +33,14 @@ namespace xsde
{
for (const_iterator i (begin ()), e (end ()); i != e; ++i)
{
- delete *static_cast<hashmap**> (const_cast<void*> (*i));
+ hashmap* p = *static_cast<hashmap**> (const_cast<void*> (*i));
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete p;
+#else
+ if (p)
+ p->~hashmap ();
+ cxx::free (p);
+#endif
}
}
@@ -45,8 +56,23 @@ namespace xsde
m = *static_cast<hashmap**> (const_cast<void*> (p));
else
{
+#ifndef XSDE_CUSTOM_ALLOCATOR
m = new hashmap (XSDE_SERIALIZER_SMAP_BUCKET_BUCKETS,
sizeof (value));
+#else
+ m = static_cast<hashmap*> (alloc (sizeof (hashmap)));
+
+#ifdef XSDE_EXCEPTIONS
+ alloc_guard mg (m);
+ new (m) hashmap (XSDE_SERIALIZER_SMAP_BUCKET_BUCKETS,
+ sizeof (value));
+ mg.release ();
+#else
+ if (m)
+ new (m) hashmap (XSDE_SERIALIZER_SMAP_BUCKET_BUCKETS,
+ sizeof (value));
+#endif
+#endif
#ifndef XSDE_EXCEPTIONS
if (m == 0 || m->_error () != hashmap::error_none)
@@ -166,7 +192,21 @@ namespace xsde
{
if (count == 0)
{
+#ifndef XSDE_CUSTOM_ALLOCATOR
map = new substitution_map (XSDE_SERIALIZER_SMAP_BUCKETS);
+#else
+ map = static_cast<substitution_map*> (
+ alloc (sizeof (substitution_map)));
+
+#ifdef XSDE_EXCEPTIONS
+ alloc_guard mg (map);
+ new (map) substitution_map (XSDE_SERIALIZER_SMAP_BUCKETS);
+ mg.release ();
+#else
+ if (map)
+ new (map) substitution_map (XSDE_SERIALIZER_SMAP_BUCKETS);
+#endif
+#endif
#ifndef XSDE_EXCEPTIONS
if (map == 0 || map->_error () != substitution_map::error_none)
@@ -189,7 +229,14 @@ namespace xsde
~substitution_map_init ()
{
if (--count == 0)
+ {
+#ifndef XSDE_CUSTOM_ALLOCATOR
delete map;
+#else
+ map->~substitution_map ();
+ cxx::free (map);
+#endif
+ }
}
// substitution_map_entry
diff --git a/libxsde/xsde/cxx/serializer/validating/base64-binary.cxx b/libxsde/xsde/cxx/serializer/validating/base64-binary.cxx
index e192be7..04b3ef0 100644
--- a/libxsde/xsde/cxx/serializer/validating/base64-binary.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/base64-binary.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/validating/base64-binary.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,16 @@ namespace xsde
base64_binary_simpl::
~base64_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 base64_binary_simpl::
@@ -156,7 +168,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;
}
}
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;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/id.cxx b/libxsde/xsde/cxx/serializer/validating/id.cxx
index 55e91ef..b9baf40 100644
--- a/libxsde/xsde/cxx/serializer/validating/id.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/id.cxx
@@ -10,6 +10,10 @@
#include <xsde/cxx/serializer/validating/id.hxx>
#include <xsde/cxx/serializer/validating/string-common.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -21,8 +25,15 @@ namespace xsde
id_simpl::
~id_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void id_simpl::
@@ -49,7 +60,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/idref.cxx b/libxsde/xsde/cxx/serializer/validating/idref.cxx
index 93e4228..f4f3014 100644
--- a/libxsde/xsde/cxx/serializer/validating/idref.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/idref.cxx
@@ -10,6 +10,10 @@
#include <xsde/cxx/serializer/validating/idref.hxx>
#include <xsde/cxx/serializer/validating/string-common.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -21,8 +25,15 @@ namespace xsde
idref_simpl::
~idref_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void idref_simpl::
@@ -49,7 +60,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/idrefs-stl.cxx b/libxsde/xsde/cxx/serializer/validating/idrefs-stl.cxx
index df51d23..04f225a 100644
--- a/libxsde/xsde/cxx/serializer/validating/idrefs-stl.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/idrefs-stl.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/validating/idrefs-stl.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,16 @@ namespace xsde
idrefs_simpl::
~idrefs_simpl ()
{
- if (free_)
- delete const_cast<string_sequence*> (value_);
+ if (free_ && value_)
+ {
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
+ }
}
void idrefs_simpl::
@@ -92,7 +104,13 @@ namespace xsde
if (free_)
{
- delete const_cast<string_sequence*> (value_);
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/idrefs.cxx b/libxsde/xsde/cxx/serializer/validating/idrefs.cxx
index da2ac9b..4b5d7d2 100644
--- a/libxsde/xsde/cxx/serializer/validating/idrefs.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/idrefs.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/validating/idrefs.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,16 @@ namespace xsde
idrefs_simpl::
~idrefs_simpl ()
{
- if (free_)
- delete const_cast<string_sequence*> (value_);
+ if (free_ && value_)
+ {
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
+ }
}
void idrefs_simpl::
@@ -92,7 +104,13 @@ namespace xsde
if (free_)
{
- delete const_cast<string_sequence*> (value_);
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
value_ = 0;
}
}
@@ -107,4 +125,3 @@ namespace xsde
}
}
}
-
diff --git a/libxsde/xsde/cxx/serializer/validating/inheritance-map.cxx b/libxsde/xsde/cxx/serializer/validating/inheritance-map.cxx
index 35e2dc5..b320ee7 100644
--- a/libxsde/xsde/cxx/serializer/validating/inheritance-map.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/inheritance-map.cxx
@@ -12,6 +12,10 @@
# include <stdlib.h> // exit
#endif
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
#include <xsde/cxx/serializer/validating/inheritance-map.hxx>
#include <xsde/cxx/serializer/validating/inheritance-map-load.hxx>
@@ -50,7 +54,21 @@ namespace xsde
{
if (count == 0)
{
+#ifndef XSDE_CUSTOM_ALLOCATOR
map = new inheritance_map (XSDE_SERIALIZER_IMAP_BUCKETS);
+#else
+ map = static_cast<inheritance_map*> (
+ alloc (sizeof (inheritance_map)));
+
+#ifdef XSDE_EXCEPTIONS
+ alloc_guard mg (map);
+ new (map) inheritance_map (XSDE_SERIALIZER_IMAP_BUCKETS);
+ mg.release ();
+#else
+ if (map)
+ new (map) inheritance_map (XSDE_SERIALIZER_IMAP_BUCKETS);
+#endif
+#endif
#ifndef XSDE_EXCEPTIONS
if (map == 0 || map->_error () != inheritance_map::error_none)
@@ -73,7 +91,14 @@ namespace xsde
~inheritance_map_init ()
{
if (--count == 0)
+ {
+#ifndef XSDE_CUSTOM_ALLOCATOR
delete map;
+#else
+ map->~inheritance_map ();
+ cxx::free (map);
+#endif
+ }
}
// inheritance_map_entry
diff --git a/libxsde/xsde/cxx/serializer/validating/language.cxx b/libxsde/xsde/cxx/serializer/validating/language.cxx
index 662c512..08be3bf 100644
--- a/libxsde/xsde/cxx/serializer/validating/language.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/language.cxx
@@ -6,6 +6,10 @@
#include <xsde/cxx/serializer/validating/language.hxx>
#include <xsde/cxx/serializer/validating/string-common.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -17,8 +21,15 @@ namespace xsde
language_simpl::
~language_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void language_simpl::
@@ -78,7 +89,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/name.cxx b/libxsde/xsde/cxx/serializer/validating/name.cxx
index c1fec6e..4c974c0 100644
--- a/libxsde/xsde/cxx/serializer/validating/name.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/name.cxx
@@ -8,6 +8,10 @@
#include <xsde/cxx/serializer/validating/name.hxx>
#include <xsde/cxx/serializer/validating/string-common.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -19,8 +23,15 @@ namespace xsde
name_simpl::
~name_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void name_simpl::
@@ -67,7 +78,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/ncname.cxx b/libxsde/xsde/cxx/serializer/validating/ncname.cxx
index ee6079b..86b9ecb 100644
--- a/libxsde/xsde/cxx/serializer/validating/ncname.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/ncname.cxx
@@ -10,6 +10,10 @@
#include <xsde/cxx/serializer/validating/ncname.hxx>
#include <xsde/cxx/serializer/validating/string-common.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -21,8 +25,15 @@ namespace xsde
ncname_simpl::
~ncname_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void ncname_simpl::
@@ -49,7 +60,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/nmtoken.cxx b/libxsde/xsde/cxx/serializer/validating/nmtoken.cxx
index a230b57..c2f4a12 100644
--- a/libxsde/xsde/cxx/serializer/validating/nmtoken.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/nmtoken.cxx
@@ -8,6 +8,10 @@
#include <xsde/cxx/serializer/validating/nmtoken.hxx>
#include <xsde/cxx/serializer/validating/string-common.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -19,8 +23,15 @@ namespace xsde
nmtoken_simpl::
~nmtoken_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void nmtoken_simpl::
@@ -58,7 +69,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/nmtokens-stl.cxx b/libxsde/xsde/cxx/serializer/validating/nmtokens-stl.cxx
index 9633fbe..b72ae0a 100644
--- a/libxsde/xsde/cxx/serializer/validating/nmtokens-stl.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/nmtokens-stl.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/validating/nmtokens-stl.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,16 @@ namespace xsde
nmtokens_simpl::
~nmtokens_simpl ()
{
- if (free_)
- delete const_cast<string_sequence*> (value_);
+ if (free_ && value_)
+ {
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
+ }
}
void nmtokens_simpl::
@@ -92,7 +104,13 @@ namespace xsde
if (free_)
{
- delete const_cast<string_sequence*> (value_);
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/nmtokens.cxx b/libxsde/xsde/cxx/serializer/validating/nmtokens.cxx
index 9c93ef5..bfc52be 100644
--- a/libxsde/xsde/cxx/serializer/validating/nmtokens.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/nmtokens.cxx
@@ -5,6 +5,10 @@
#include <xsde/cxx/serializer/validating/nmtokens.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -16,8 +20,16 @@ namespace xsde
nmtokens_simpl::
~nmtokens_simpl ()
{
- if (free_)
- delete const_cast<string_sequence*> (value_);
+ if (free_ && value_)
+ {
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
+ }
}
void nmtokens_simpl::
@@ -92,7 +104,13 @@ namespace xsde
if (free_)
{
- delete const_cast<string_sequence*> (value_);
+ string_sequence* v = const_cast<string_sequence*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~string_sequence ();
+ cxx::free (v);
+#endif
value_ = 0;
}
}
@@ -107,4 +125,3 @@ namespace xsde
}
}
}
-
diff --git a/libxsde/xsde/cxx/serializer/validating/normalized-string.cxx b/libxsde/xsde/cxx/serializer/validating/normalized-string.cxx
index 89bb32c..8d807a4 100644
--- a/libxsde/xsde/cxx/serializer/validating/normalized-string.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/normalized-string.cxx
@@ -6,6 +6,10 @@
#include <xsde/cxx/serializer/validating/normalized-string.hxx>
#include <xsde/cxx/serializer/validating/string-common.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -17,8 +21,15 @@ namespace xsde
normalized_string_simpl::
~normalized_string_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void normalized_string_simpl::
@@ -51,7 +62,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/qname.cxx b/libxsde/xsde/cxx/serializer/validating/qname.cxx
index a51685e..cca29d6 100644
--- a/libxsde/xsde/cxx/serializer/validating/qname.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/qname.cxx
@@ -9,6 +9,10 @@
#include <xsde/cxx/serializer/validating/qname.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -20,8 +24,16 @@ namespace xsde
qname_simpl::
~qname_simpl ()
{
- if (free_)
- delete const_cast<qname*> (value_);
+ if (free_ && value_)
+ {
+ qname* v = const_cast<qname*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~qname ();
+ cxx::free (v);
+#endif
+ }
}
void qname_simpl::
@@ -69,7 +81,13 @@ namespace xsde
if (free_)
{
- delete const_cast<qname*> (value_);
+ qname* v = const_cast<qname*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete v;
+#else
+ v->~qname ();
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/string.cxx b/libxsde/xsde/cxx/serializer/validating/string.cxx
index a8d287e..a8f6dfa 100644
--- a/libxsde/xsde/cxx/serializer/validating/string.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/string.cxx
@@ -6,6 +6,10 @@
#include <xsde/cxx/serializer/validating/string.hxx>
#include <xsde/cxx/serializer/validating/string-common.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -17,8 +21,15 @@ namespace xsde
string_simpl::
~string_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void string_simpl::
@@ -38,7 +49,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/token.cxx b/libxsde/xsde/cxx/serializer/validating/token.cxx
index 30e98f8..d38ef33 100644
--- a/libxsde/xsde/cxx/serializer/validating/token.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/token.cxx
@@ -6,6 +6,10 @@
#include <xsde/cxx/serializer/validating/token.hxx>
#include <xsde/cxx/serializer/validating/string-common.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -17,8 +21,15 @@ namespace xsde
token_simpl::
~token_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void token_simpl::
@@ -63,7 +74,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}
diff --git a/libxsde/xsde/cxx/serializer/validating/uri.cxx b/libxsde/xsde/cxx/serializer/validating/uri.cxx
index a1b7a86..3cfdc26 100644
--- a/libxsde/xsde/cxx/serializer/validating/uri.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/uri.cxx
@@ -6,6 +6,10 @@
#include <xsde/cxx/serializer/validating/uri.hxx>
#include <xsde/cxx/serializer/validating/string-common.hxx>
+#ifdef XSDE_CUSTOM_ALLOCATOR
+# include <xsde/cxx/allocator.hxx>
+#endif
+
namespace xsde
{
namespace cxx
@@ -17,8 +21,15 @@ namespace xsde
uri_simpl::
~uri_simpl ()
{
- if (free_)
- delete[] const_cast<char*> (value_);
+ if (free_ && value_)
+ {
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
+ }
}
void uri_simpl::
@@ -42,7 +53,12 @@ namespace xsde
if (free_)
{
- delete[] const_cast<char*> (value_);
+ char* v = const_cast<char*> (value_);
+#ifndef XSDE_CUSTOM_ALLOCATOR
+ delete[] v;
+#else
+ cxx::free (v);
+#endif
value_ = 0;
}
}