Skip to content

Commit 4996e0b

Browse files
avargitster
authored andcommitted
trace2: use designated initializers for "struct tr2_dst"
Convert the "static struct tr2_dst" assignments in trace2/* to use designated initializers. I don't think it improves readability to include the explicit 0-ing out of the fd/initialized/need_close/too_many_files members, so let's have those be initialized implicitly by the compiler. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9859305 commit 4996e0b

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

trace2/tr2_tgt_event.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#include "trace2/tr2_tgt.h"
1111
#include "trace2/tr2_tls.h"
1212

13-
static struct tr2_dst tr2dst_event = { TR2_SYSENV_EVENT, 0, 0, 0, 0 };
13+
static struct tr2_dst tr2dst_event = {
14+
.sysenv_var = TR2_SYSENV_EVENT,
15+
};
1416

1517
/*
1618
* The version number of the JSON data generated by the EVENT target in this

trace2/tr2_tgt_normal.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
#include "trace2/tr2_tgt.h"
1010
#include "trace2/tr2_tls.h"
1111

12-
static struct tr2_dst tr2dst_normal = { TR2_SYSENV_NORMAL, 0, 0, 0, 0 };
12+
static struct tr2_dst tr2dst_normal = {
13+
.sysenv_var = TR2_SYSENV_NORMAL,
14+
};
1315

1416
/*
1517
* Use the TR2_SYSENV_NORMAL_BRIEF setting to omit the "<time> <file>:<line>"

trace2/tr2_tgt_perf.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
#include "trace2/tr2_tgt.h"
1212
#include "trace2/tr2_tls.h"
1313

14-
static struct tr2_dst tr2dst_perf = { TR2_SYSENV_PERF, 0, 0, 0, 0 };
14+
static struct tr2_dst tr2dst_perf = {
15+
.sysenv_var = TR2_SYSENV_PERF,
16+
};
1517

1618
/*
1719
* Use TR2_SYSENV_PERF_BRIEF to omit the "<time> <file>:<line>"

0 commit comments

Comments
 (0)