aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2011-04-29 14:00:45 +0200
committerMartin Willi <martin@revosec.ch>2011-05-16 15:22:21 +0200
commit42e0f26e5339745f180e7b284beae32b8fb27c4d (patch)
tree328bcf47d67c560fdbd39bfdb77d9810d31ab7e0 /src/libstrongswan
parent61a141d01ce2bac2d4361f595162b7680658be28 (diff)
downloadstrongswan-42e0f26e5339745f180e7b284beae32b8fb27c4d.tar.bz2
strongswan-42e0f26e5339745f180e7b284beae32b8fb27c4d.tar.xz
Migrated leak_detective to INIT/METHOD macros
Diffstat (limited to 'src/libstrongswan')
-rw-r--r--src/libstrongswan/utils/leak_detective.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/libstrongswan/utils/leak_detective.c b/src/libstrongswan/utils/leak_detective.c
index 39505d3f3..a295ce419 100644
--- a/src/libstrongswan/utils/leak_detective.c
+++ b/src/libstrongswan/utils/leak_detective.c
@@ -236,10 +236,8 @@ char *whitelist[] = {
"gnutls_global_init",
};
-/**
- * Report leaks at library destruction
- */
-static void report(private_leak_detective_t *this, bool detailed)
+METHOD(leak_detective_t, report, void,
+ private_leak_detective_t *this, bool detailed)
{
if (lib->leak_detective)
{
@@ -492,10 +490,8 @@ void *realloc_hook(void *old, size_t bytes, const void *caller)
return hdr + 1;
}
-/**
- * Implementation of leak_detective_t.destroy
- */
-static void destroy(private_leak_detective_t *this)
+METHOD(leak_detective_t, destroy, void,
+ private_leak_detective_t *this)
{
if (installed)
{
@@ -509,10 +505,14 @@ static void destroy(private_leak_detective_t *this)
*/
leak_detective_t *leak_detective_create()
{
- private_leak_detective_t *this = malloc_thing(private_leak_detective_t);
-
- this->public.report = (void(*)(leak_detective_t*,bool))report;
- this->public.destroy = (void(*)(leak_detective_t*))destroy;
+ private_leak_detective_t *this;
+
+ INIT(this,
+ .public = {
+ .report = _report,
+ .destroy = _destroy,
+ },
+ );
if (getenv("LEAK_DETECTIVE_DISABLE") == NULL)
{