From 2011bb4f34d773a7de2d64769ca9f508feba8089 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 3 Oct 2024 17:06:54 -0400 Subject: diff: drop line_prefix_length field The diff_options structure holds a line_prefix string and an associated length. But the length is always just the strlen() of the NUL-terminated string. Let's simplify the code by just storing the string pointer and assuming it is NUL-terminated when we use it. This will cause us to compute the string length in a few extra spots, but I don't think any of these are particularly hot code paths. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff.c | 1 - 1 file changed, 1 deletion(-) (limited to 'diff.c') diff --git a/diff.c b/diff.c index a83409944b..f725d217de 100644 --- a/diff.c +++ b/diff.c @@ -5395,7 +5395,6 @@ static int diff_opt_line_prefix(const struct option *opt, BUG_ON_OPT_NEG(unset); options->line_prefix = optarg; - options->line_prefix_length = strlen(options->line_prefix); graph_setup_line_prefix(options); return 0; } -- cgit 1.2.3-korg