diff options
author | Evan Huus <eapache@gmail.com> | 2012-10-27 02:42:05 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2012-10-27 02:42:05 +0000 |
commit | b464dcd8888d1cd8ad4e16022d358d555a27f4fd (patch) | |
tree | 2a100927c562fe065e682b54113cd63f4a1582f2 /epan/wmem/wmem_core.c | |
parent | 2ea364607a49c3c73ba0ddadf4ed88e7bf9bce98 (diff) |
Create init and cleanup functions for wmem as a whole.
Call them from epan_init() and epan_cleanup().
Expose a permanent wmem scope for allocations that should only be freed when
epan is done (which is *not* necessarily when the program finishes).
svn path=/trunk/; revision=45805
Diffstat (limited to 'epan/wmem/wmem_core.c')
-rw-r--r-- | epan/wmem/wmem_core.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/epan/wmem/wmem_core.c b/epan/wmem/wmem_core.c index 1da5328c36..5dcb8ed559 100644 --- a/epan/wmem/wmem_core.c +++ b/epan/wmem/wmem_core.c @@ -27,6 +27,9 @@ #include "wmem_core.h" #include "wmem_allocator.h" +#include "wmem_allocator_glib.h" + +static wmem_allocator_t *permanent_scope; void * wmem_alloc(wmem_allocator_t *allocator, size_t size) @@ -57,6 +60,24 @@ wmem_destroy_allocator(wmem_allocator_t *allocator) allocator->destroy(allocator); } +wmem_allocator_t * +wmem_permanent_scope(void) +{ + return permanent_scope; +} + +void +wmem_init(void) +{ + permanent_scope = wmem_create_glib_allocator(); +} + +void +wmem_cleanup(void) +{ + wmem_destroy_allocator(permanent_scope); +} + /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * |