already had the correct formatting
This commit is contained in:
+36
-36
@@ -33,16 +33,16 @@ typedef struct private_library_t private_library_t;
|
|||||||
*/
|
*/
|
||||||
struct private_library_t {
|
struct private_library_t {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* public functions
|
* public functions
|
||||||
*/
|
*/
|
||||||
library_t public;
|
library_t public;
|
||||||
|
|
||||||
#ifdef LEAK_DETECTIVE
|
#ifdef LEAK_DETECTIVE
|
||||||
/**
|
/**
|
||||||
* Memory leak detective, if enabled
|
* Memory leak detective, if enabled
|
||||||
*/
|
*/
|
||||||
leak_detective_t *detective;
|
leak_detective_t *detective;
|
||||||
#endif /* LEAK_DETECTIVE */
|
#endif /* LEAK_DETECTIVE */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -56,19 +56,19 @@ library_t *lib;
|
|||||||
*/
|
*/
|
||||||
void library_deinit()
|
void library_deinit()
|
||||||
{
|
{
|
||||||
private_library_t *this = (private_library_t*)lib;
|
private_library_t *this = (private_library_t*)lib;
|
||||||
|
|
||||||
this->public.settings->destroy(this->public.settings);
|
this->public.settings->destroy(this->public.settings);
|
||||||
this->public.printf_hook->destroy(this->public.printf_hook);
|
this->public.printf_hook->destroy(this->public.printf_hook);
|
||||||
|
|
||||||
#ifdef LEAK_DETECTIVE
|
#ifdef LEAK_DETECTIVE
|
||||||
if (this->detective)
|
if (this->detective)
|
||||||
{
|
{
|
||||||
this->detective->destroy(this->detective);
|
this->detective->destroy(this->detective);
|
||||||
}
|
}
|
||||||
#endif /* LEAK_DETECTIVE */
|
#endif /* LEAK_DETECTIVE */
|
||||||
free(this);
|
free(this);
|
||||||
lib = NULL;
|
lib = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -76,31 +76,31 @@ void library_deinit()
|
|||||||
*/
|
*/
|
||||||
void library_init(char *settings)
|
void library_init(char *settings)
|
||||||
{
|
{
|
||||||
printf_hook_t *pfh;
|
printf_hook_t *pfh;
|
||||||
private_library_t *this = malloc_thing(private_library_t);
|
private_library_t *this = malloc_thing(private_library_t);
|
||||||
lib = &this->public;
|
lib = &this->public;
|
||||||
|
|
||||||
lib->leak_detective = FALSE;
|
lib->leak_detective = FALSE;
|
||||||
|
|
||||||
#ifdef LEAK_DETECTIVE
|
#ifdef LEAK_DETECTIVE
|
||||||
this->detective = leak_detective_create();
|
this->detective = leak_detective_create();
|
||||||
#endif /* LEAK_DETECTIVE */
|
#endif /* LEAK_DETECTIVE */
|
||||||
|
|
||||||
pfh = printf_hook_create();
|
pfh = printf_hook_create();
|
||||||
this->public.printf_hook = pfh;
|
this->public.printf_hook = pfh;
|
||||||
|
|
||||||
pfh->add_handler(pfh, 'b', mem_printf_hook,
|
pfh->add_handler(pfh, 'b', mem_printf_hook,
|
||||||
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
|
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
|
||||||
PRINTF_HOOK_ARGTYPE_END);
|
PRINTF_HOOK_ARGTYPE_END);
|
||||||
pfh->add_handler(pfh, 'B', chunk_printf_hook,
|
pfh->add_handler(pfh, 'B', chunk_printf_hook,
|
||||||
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_END);
|
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_END);
|
||||||
pfh->add_handler(pfh, 'T', time_printf_hook,
|
pfh->add_handler(pfh, 'T', time_printf_hook,
|
||||||
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
|
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
|
||||||
PRINTF_HOOK_ARGTYPE_END);
|
PRINTF_HOOK_ARGTYPE_END);
|
||||||
pfh->add_handler(pfh, 'V', time_delta_printf_hook,
|
pfh->add_handler(pfh, 'V', time_delta_printf_hook,
|
||||||
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_POINTER,
|
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_POINTER,
|
||||||
PRINTF_HOOK_ARGTYPE_END);
|
PRINTF_HOOK_ARGTYPE_END);
|
||||||
|
|
||||||
this->public.settings = settings_create(settings);
|
this->public.settings = settings_create(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-13
@@ -28,26 +28,26 @@ typedef struct library_t library_t;
|
|||||||
*/
|
*/
|
||||||
struct library_t {
|
struct library_t {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Printf hook registering facility
|
* Printf hook registering facility
|
||||||
*/
|
*/
|
||||||
printf_hook_t *printf_hook;
|
printf_hook_t *printf_hook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* various settings loaded from settings file
|
* various settings loaded from settings file
|
||||||
*/
|
*/
|
||||||
settings_t *settings;
|
settings_t *settings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* is leak detective running?
|
* is leak detective running?
|
||||||
*/
|
*/
|
||||||
bool leak_detective;
|
bool leak_detective;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize library, creates "lib" instance.
|
* Initialize library, creates "lib" instance.
|
||||||
*
|
*
|
||||||
* @param settings file to read settings from, may be NULL for none
|
* @param settings file to read settings from, may be NULL for none
|
||||||
*/
|
*/
|
||||||
void library_init(char *settings);
|
void library_init(char *settings);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user