Skip to content

Commit 04f10d3

Browse files
jeffhostetlergitster
authored andcommitted
trace2: remove dead code in maybe_add_string_va()
Remove an unnecessary "if" block in maybe_add_string_va(). Commit "ad006fe419e trace2: NULL is not allowed for va_list" changed "if (fmt && *fmt && ap)" to just "if (fmt && *fmt)" because it isn't safe to treat 'ap' as a pointer. This made the "if" block following it unnecessary. Signed-off-by: Jeff Hostetler <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent da4589c commit 04f10d3

File tree

3 files changed

+0
-15
lines changed

3 files changed

+0
-15
lines changed

trace2/tr2_tgt_event.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,6 @@ static void maybe_add_string_va(struct json_writer *jw, const char *field_name,
205205
strbuf_release(&buf);
206206
return;
207207
}
208-
209-
if (fmt && *fmt) {
210-
jw_object_string(jw, field_name, fmt);
211-
return;
212-
}
213208
}
214209

215210
static void fn_error_va_fl(const char *file, int line, const char *fmt,

trace2/tr2_tgt_normal.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,6 @@ static void maybe_append_string_va(struct strbuf *buf, const char *fmt,
135135
va_end(copy_ap);
136136
return;
137137
}
138-
139-
if (fmt && *fmt) {
140-
strbuf_addstr(buf, fmt);
141-
return;
142-
}
143138
}
144139

145140
static void fn_error_va_fl(const char *file, int line, const char *fmt,

trace2/tr2_tgt_perf.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,6 @@ static void maybe_append_string_va(struct strbuf *buf, const char *fmt,
239239
va_end(copy_ap);
240240
return;
241241
}
242-
243-
if (fmt && *fmt) {
244-
strbuf_addstr(buf, fmt);
245-
return;
246-
}
247242
}
248243

249244
static void fn_error_va_fl(const char *file, int line, const char *fmt,

0 commit comments

Comments
 (0)