Skip to content

Commit ad43e37

Browse files
jeffhostetlergitster
authored andcommitted
trace2: trim trailing whitespace in normal format error message
Avoid creating unnecessary trailing whitespace in normal target format error messages when the message is omitted. Signed-off-by: Jeff Hostetler <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 04f10d3 commit ad43e37

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

trace2/tr2_tgt_normal.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,11 @@ static void fn_error_va_fl(const char *file, int line, const char *fmt,
142142
{
143143
struct strbuf buf_payload = STRBUF_INIT;
144144

145-
strbuf_addstr(&buf_payload, "error ");
146-
maybe_append_string_va(&buf_payload, fmt, ap);
145+
strbuf_addstr(&buf_payload, "error");
146+
if (fmt && *fmt) {
147+
strbuf_addch(&buf_payload, ' ');
148+
maybe_append_string_va(&buf_payload, fmt, ap);
149+
}
147150
normal_io_write_fl(file, line, &buf_payload);
148151
strbuf_release(&buf_payload);
149152
}

0 commit comments

Comments
 (0)