From 2e501c68a8641a2b3c430b55f13491a9c1c5d0f5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 11 May 2010 12:20:11 +0200 Subject: Add support for custom allocators New example: examples/cxx/hybrid/allocator. --- libxsde/xsde/allocator.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 libxsde/xsde/allocator.c (limited to 'libxsde/xsde/allocator.c') diff --git a/libxsde/xsde/allocator.c b/libxsde/xsde/allocator.c new file mode 100644 index 0000000..7874295 --- /dev/null +++ b/libxsde/xsde/allocator.c @@ -0,0 +1,32 @@ +// file : xsde/allocator.c +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// This is the default implementation of the custom allocator functions. +// It is primarily useful for testing when XSD/e is configured with custom +// allocators. You can also replace this implementation with your own if +// you would like to test with that. +// + +#include + +#include + +void* +xsde_alloc (size_t n) +{ + return malloc (n); +} + +void* +xsde_realloc (void* p, size_t n) +{ + return realloc (p, n); +} + +void +xsde_free (void* p) +{ + free (p); +} -- cgit v1.1