Browse Source

now its possible to say a hash that it should not free its members on cleanup... useful if several structures hold the members

1.0.0
Georg Hopp 11 years ago
parent
commit
0b485ec798
  1. 1
      include/tr/hash.h
  2. 4
      src/hash/cleanup.c

1
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) {};

4
src/hash/cleanup.c

@ -35,7 +35,11 @@ tDelete(const void * node, const void * data, const int depth)
void
TR_hashCleanup(TR_Hash this)
{
if (this->cleanup_no_free) {
TR_treeDestroy(&(this->root), NULL);
} else {
TR_treeDestroy(&(this->root), tDelete);
}
}
// vim: set ts=4 sw=4:
Loading…
Cancel
Save