aboutsummaryrefslogtreecommitdiffstats
path: root/trace2
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-07-31 15:54:32 -0700
committerJunio C Hamano <gitster@pobox.com>2025-08-02 22:44:58 -0700
commitcb8e82a6414653d5dbda81eedb8ca0cd9ce34c68 (patch)
treebe38bc928f0924107a0ddb6f093f49b6b388335e /trace2
parentsub-process: do not use strbuf_split*() (diff)
downloadgit-cb8e82a6414653d5dbda81eedb8ca0cd9ce34c68.tar.gz
git-cb8e82a6414653d5dbda81eedb8ca0cd9ce34c68.zip
trace2: trim_trailing_newline followed by trim is a no-op
strbuf_trim_trailing_newline() removes a LF or a CRLF from the tail of a string. If the code plans to call strbuf_trim() immediately after doing so, the code is better off skipping the EOL trimming in the first place. After all, LF/CRLF at the end is a mere special case of whitespaces at the end of the string, which will be removed by strbuf_rtrim() anyway. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trace2')
-rw-r--r--trace2/tr2_cfg.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/trace2/tr2_cfg.c b/trace2/tr2_cfg.c
index 22a99a0682..2b7cfcd10c 100644
--- a/trace2/tr2_cfg.c
+++ b/trace2/tr2_cfg.c
@@ -39,7 +39,6 @@ static int tr2_cfg_load_patterns(void)
if (buf->len && buf->buf[buf->len - 1] == ',')
strbuf_setlen(buf, buf->len - 1);
- strbuf_trim_trailing_newline(*s);
strbuf_trim(*s);
}
@@ -78,7 +77,6 @@ static int tr2_load_env_vars(void)
if (buf->len && buf->buf[buf->len - 1] == ',')
strbuf_setlen(buf, buf->len - 1);
- strbuf_trim_trailing_newline(*s);
strbuf_trim(*s);
}