From d8a2cacf7b0ddc264a1013b84748be673235c3a0 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Fri, 29 Sep 2023 15:30:47 +0200 Subject: [PATCH] trace: remove global default trace json Trace initialization should be handled by application (moving this to baresip) --- src/main/init.c | 8 -------- test/trace.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/init.c b/src/main/init.c index b84012979..0d99f80e5 100644 --- a/src/main/init.c +++ b/src/main/init.c @@ -168,10 +168,6 @@ int libre_init(void) return err; } -#ifdef RE_TRACE_ENABLED - re_trace_init("re_trace.json"); -#endif - err = re_thread_init(); return err; @@ -183,10 +179,6 @@ int libre_init(void) */ void libre_close(void) { - -#ifdef RE_TRACE_ENABLED - re_trace_close(); -#endif (void)fd_setsize(0); net_sock_close(); re_thread_close(); diff --git a/test/trace.c b/test/trace.c index f92bac75a..be85c828e 100644 --- a/test/trace.c +++ b/test/trace.c @@ -28,6 +28,9 @@ int test_trace(void) if (test_mode == TEST_THREAD) return ESKIPPED; + err = re_trace_init("test_trace.json"); + TEST_ERR(err); + RE_TRACE_PROCESS_NAME("retest"); RE_TRACE_THREAD_NAME("test_trace"); RE_TRACE_BEGIN("test", "Test Loop Start"); @@ -51,6 +54,18 @@ int test_trace(void) RE_TRACE_END("test", "Test Loop End"); + err = re_trace_close(); + TEST_ERR(err); + + /* Test TRACE after close - should do nothing */ + RE_TRACE_BEGIN("test", "test after close"); + +#ifdef WIN32 + (void)_unlink("test_trace.json"); +#else + (void)unlink("test_trace.json"); +#endif + out: return err; }