diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-05-11 12:20:11 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-05-11 12:20:11 +0200 |
commit | 2e501c68a8641a2b3c430b55f13491a9c1c5d0f5 (patch) | |
tree | 49c2748443fe3c1f01108756b647440e0647a11b /libxsde/xsde/cxx/serializer/validating | |
parent | 161beba6cdb0d91b15ad19fa8b3e51d986203915 (diff) |
Add support for custom allocators
New example: examples/cxx/hybrid/allocator.
Diffstat (limited to 'libxsde/xsde/cxx/serializer/validating')
18 files changed, 362 insertions, 53 deletions
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; } } |