diff options
author | Jeff King <peff@peff.net> | 2024-10-03 17:13:17 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-10-03 14:22:22 -0700 |
commit | 1164e270b5af80516625b628945ec7365d992055 (patch) | |
tree | 0cf60a382cc20f6bcb1c01416d68ff1f8e9e75ab /diff.c | |
parent | 19752d9c912478b9eef0bd83c2cf6da98974f536 (diff) |
diff: store graph prefix buf in git_graph struct
The diffopt output_prefix interface makes it the callback's job to
handle ownership of the memory it returns, keeping it valid while
callers are using it and then eventually freeing it when we are done
diffing.
In diff_output_prefix_callback() we handle this with a static strbuf,
effectively "leaking" it when the diff is done (but not triggering any
leak detectors because it's technically still reachable). This has not
been a big problem in practice, but it is a problem for libification:
two diffs running in the same process could stomp on each other's prefix
buffers.
Since we only need the strbuf when we are formatting graph padding, we
can give ownership of the strbuf to the git_graph struct, letting us
free it when that struct is no longer in use.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
0 files changed, 0 insertions, 0 deletions