Initialize trace to zero

This commit is contained in:
Rodrigo Arias 2023-01-20 15:40:29 +01:00 committed by Rodrigo Arias Mallo
parent 9a4af7e0ec
commit 0687197f08
2 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@
static struct emu_trace *cur_trace = NULL; static struct emu_trace *cur_trace = NULL;
static void static void
trace_add(struct emu_trace *trace, struct emu_stream *stream) add_stream(struct emu_trace *trace, struct emu_stream *stream)
{ {
DL_APPEND(trace->streams, stream); DL_APPEND(trace->streams, stream);
trace->nstreams++; trace->nstreams++;
@ -41,7 +41,7 @@ load_stream(struct emu_trace *trace, const char *path)
return -1; return -1;
} }
trace_add(trace, stream); add_stream(trace, stream);
return 0; return 0;
} }
@ -84,6 +84,8 @@ cb_nftw(const char *fpath, const struct stat *sb,
int int
emu_trace_load(struct emu_trace *trace, const char *tracedir) emu_trace_load(struct emu_trace *trace, const char *tracedir)
{ {
memset(trace, 0, sizeof(struct emu_trace));
cur_trace = trace; cur_trace = trace;
if (snprintf(trace->tracedir, PATH_MAX, "%s", tracedir) >= PATH_MAX) { if (snprintf(trace->tracedir, PATH_MAX, "%s", tracedir) >= PATH_MAX) {

View File

@ -13,8 +13,6 @@ struct emu_trace {
long nstreams; long nstreams;
struct emu_stream *streams; struct emu_stream *streams;
heap_head_t sorted_stream;
}; };
int emu_trace_load(struct emu_trace *trace, const char *tracedir); int emu_trace_load(struct emu_trace *trace, const char *tracedir);