From: Jeff Hostetler via GitGitGadget Date: Mon, 20 Dec 2021 15:01:02 GMT Subject: [PATCH 2/9] trace2: convert tr2tls_thread_ctx.thread_name from strbuf to char* Message-ID: <3a4fe07e40e967622035844ff10ded1ed71d94fc.1640012469.git.gitgitgadget@gmail.com> In-Reply-To: From: Jeff Hostetler Use a 'char *' to hold the thread name rather than a 'struct strbuf'. The thread name is set when the thread is created and should not be be modified afterwards. Replace the strbuf with an allocated pointer to make that more clear. This was discussed in: https://lore.kernel.org/all/xmqqa6kdwo24.fsf@gitster.g/ Signed-off-by: Jeff Hostetler --- trace2/tr2_tgt_event.c | 2 +- trace2/tr2_tgt_perf.c | 2 +- trace2/tr2_tls.c | 16 +++++++++------- trace2/tr2_tls.h | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c index 3a0014417cc..ca48d00aebc 100644 --- a/trace2/tr2_tgt_event.c +++ b/trace2/tr2_tgt_event.c @@ -88,7 +88,7 @@ static void event_fmt_prepare(const char *event_name, const char *file, jw_object_string(jw, "event", event_name); jw_object_string(jw, "sid", tr2_sid_get()); - jw_object_string(jw, "thread", ctx->thread_name.buf); + jw_object_string(jw, "thread", ctx->thread_name); /* * In brief mode, only emit