diff --git a/include/tr/hash.h b/include/tr/hash.h index a4328f5..793894f 100644 --- a/include/tr/hash.h +++ b/include/tr/hash.h @@ -32,6 +32,7 @@ TR_CLASS(TR_Hash) { TR_Tree root; + int cleanup_no_free; }; TR_INSTANCE_INIT(TR_Hash); TR_CLASSVARS_DECL(TR_Hash) {}; diff --git a/src/hash/cleanup.c b/src/hash/cleanup.c index 2eb0d76..5245ea3 100644 --- a/src/hash/cleanup.c +++ b/src/hash/cleanup.c @@ -35,7 +35,11 @@ tDelete(const void * node, const void * data, const int depth) void TR_hashCleanup(TR_Hash this) { - TR_treeDestroy(&(this->root), tDelete); + if (this->cleanup_no_free) { + TR_treeDestroy(&(this->root), NULL); + } else { + TR_treeDestroy(&(this->root), tDelete); + } } // vim: set ts=4 sw=4: