]> git.ipfire.org Git - thirdparty/git.git/commit
trace2: do not use strbuf_split*()
authorJunio C Hamano <gitster@pobox.com>
Thu, 31 Jul 2025 22:54:33 +0000 (15:54 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 Aug 2025 05:44:58 +0000 (22:44 -0700)
commit838fe56920684bf0ab734f7ddf2bad69cb5f5d45
treeba5e37d23e3ae0779be34322beb37b1275714b30
parentcb8e82a6414653d5dbda81eedb8ca0cd9ce34c68
trace2: do not use strbuf_split*()

tr2_cfg_load_patterns() and tr2_load_env_vars() functions are
functions with very similar structure that each reads an environment
variable, splits its value at the ',' boundaries, and trims the
resulting string pieces into an array of strbufs.

But the code paths that later use these strbufs take no advantage of
the strbuf-ness of the result (they do not benefit from <ptr,len>
representation to avoid having to run strlen(<ptr>), for example).

Simplify the code by teaching these functions to split into a string
list instead; even the trimming comes for free ;-).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
trace2/tr2_cfg.c