Migrated leak_detective to INIT/METHOD macros
This commit is contained in:
@@ -236,10 +236,8 @@ char *whitelist[] = {
|
|||||||
"gnutls_global_init",
|
"gnutls_global_init",
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(leak_detective_t, report, void,
|
||||||
* Report leaks at library destruction
|
private_leak_detective_t *this, bool detailed)
|
||||||
*/
|
|
||||||
static void report(private_leak_detective_t *this, bool detailed)
|
|
||||||
{
|
{
|
||||||
if (lib->leak_detective)
|
if (lib->leak_detective)
|
||||||
{
|
{
|
||||||
@@ -492,10 +490,8 @@ void *realloc_hook(void *old, size_t bytes, const void *caller)
|
|||||||
return hdr + 1;
|
return hdr + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(leak_detective_t, destroy, void,
|
||||||
* Implementation of leak_detective_t.destroy
|
private_leak_detective_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_leak_detective_t *this)
|
|
||||||
{
|
{
|
||||||
if (installed)
|
if (installed)
|
||||||
{
|
{
|
||||||
@@ -509,10 +505,14 @@ static void destroy(private_leak_detective_t *this)
|
|||||||
*/
|
*/
|
||||||
leak_detective_t *leak_detective_create()
|
leak_detective_t *leak_detective_create()
|
||||||
{
|
{
|
||||||
private_leak_detective_t *this = malloc_thing(private_leak_detective_t);
|
private_leak_detective_t *this;
|
||||||
|
|
||||||
this->public.report = (void(*)(leak_detective_t*,bool))report;
|
INIT(this,
|
||||||
this->public.destroy = (void(*)(leak_detective_t*))destroy;
|
.public = {
|
||||||
|
.report = _report,
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
if (getenv("LEAK_DETECTIVE_DISABLE") == NULL)
|
if (getenv("LEAK_DETECTIVE_DISABLE") == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user