Commit 20e13db8 authored by Robert Schmidt's avatar Robert Schmidt

Implement logTerm() to close logging subsystem

parent d2523bfa
......@@ -411,6 +411,16 @@ int register_log_component(char *name,
return computed_compidx;
}
static void unregister_all_log_components(void)
{
log_component_t* lc = &g_log->log_component[0];
while (lc->name) {
free((char *)lc->name); // defined as const, but assigned through strdup()
free(lc->filelog_name);
lc++;
}
}
int isLogInitDone (void)
{
if (g_log == NULL)
......@@ -502,6 +512,12 @@ int logInit (void)
return 0;
}
void logTerm(void)
{
unregister_all_log_components();
free_and_zero(g_log);
}
#include <sys/syscall.h>
static inline int log_header(log_component_t *c,
char *log_buffer,
......
......@@ -302,6 +302,7 @@ extern "C" {
# include "log_if.h"
/*----------------------------------------------------------------------------*/
int logInit (void);
void logTerm (void);
int isLogInitDone (void);
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
void vlogRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, va_list args );
......
......@@ -666,6 +666,7 @@ int main(int argc, char **argv)
vcd_signal_dumper_close();
loader_reset();
logTerm();
return (n_errors);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment