Skip to content

Commit

Permalink
trace,jbuf: trace supports only one trace
Browse files Browse the repository at this point in the history
  • Loading branch information
cspiel1 committed Sep 27, 2023
1 parent c9eb069 commit af375ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/jbuf/jbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <re_types.h>
#include <re_fmt.h>
#include <re_list.h>
#include <re_hash.h>
#include <re_mbuf.h>
#include <re_mem.h>
#include <re_rtp.h>
Expand All @@ -20,7 +19,7 @@
#include <stdlib.h>

#define DEBUG_MODULE "jbuf"
#define DEBUG_LEVEL 5
#define DEBUG_LEVEL 6
#include <re_dbg.h>


Expand Down Expand Up @@ -294,7 +293,9 @@ int jbuf_alloc(struct jbuf **jbp, uint32_t min, uint32_t max)
err = jbuf_resize(jb, max);

#ifdef RE_JBUF_TRACE
(void)re_trace_init("jbuf.json");
err = re_trace_init("jbuf.json");
if (err)
DEBUG_WARNING("could not init trace\n");
#endif

out:
Expand All @@ -317,6 +318,9 @@ int jbuf_alloc(struct jbuf **jbp, uint32_t min, uint32_t max)
*/
int jbuf_resize(struct jbuf *jb, uint32_t packets)
{
if (!jb)
return EINVAL;

if (packets <= jb->packets)
return EINVAL;

Expand Down
3 changes: 3 additions & 0 deletions src/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ int re_trace_init(const char *json_file)
if (!json_file)
return EINVAL;

if (trace.init)
return EINVAL;

trace.event_buffer = mem_zalloc(
TRACE_BUFFER_SIZE * sizeof(struct trace_event), NULL);
if (!trace.event_buffer)
Expand Down

0 comments on commit af375ad

Please sign in to comment.