From 8042037fd9e6d012f04f8dcc13c2215d72ccee06 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 25 Jun 2016 19:01:45 +0200 Subject: Added PugiXML and used it for hashfile (nw) --- .../docs/samples/custom_memory_management.cpp | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 3rdparty/pugixml/docs/samples/custom_memory_management.cpp (limited to '3rdparty/pugixml/docs/samples/custom_memory_management.cpp') diff --git a/3rdparty/pugixml/docs/samples/custom_memory_management.cpp b/3rdparty/pugixml/docs/samples/custom_memory_management.cpp new file mode 100644 index 00000000000..2cb5520ea72 --- /dev/null +++ b/3rdparty/pugixml/docs/samples/custom_memory_management.cpp @@ -0,0 +1,27 @@ +#include "pugixml.hpp" + +#include + +// tag::decl[] +void* custom_allocate(size_t size) +{ + return new (std::nothrow) char[size]; +} + +void custom_deallocate(void* ptr) +{ + delete[] static_cast(ptr); +} +// end::decl[] + +int main() +{ +// tag::call[] + pugi::set_memory_management_functions(custom_allocate, custom_deallocate); +// end::call[] + + pugi::xml_document doc; + doc.load_string(""); +} + +// vim:et -- cgit v1.2.3-70-g09d2