summaryrefslogtreecommitdiff
path: root/t/t0040-parse-options.sh
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2021-09-20 23:48:09 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-09-22 11:59:50 -0700
commit995e525b1729ada354e443f16e1c0fad59df25a8 (patch)
treeb7c10effa0ee044325f8dae56bd16e47a5e64d94 /t/t0040-parse-options.sh
parentgrep: stop modifying buffer in strip_timestamp (diff)
downloadtgif-995e525b1729ada354e443f16e1c0fad59df25a8.tar.xz
grep: stop modifying buffer in show_line()
When showing lines via grep (or looking for funcnames), we call show_line() on a multi-line buffer. It finds the end of line and marks it with a NUL. However, we don't need to do so, as the resulting line is only used along with its "eol" marker: - we pass both to next_match(), which takes care to look at only the bytes we specified - we pass the line to output_color() without its matching eol marker. However, we do use the "match" struct we got from next_match() to tell it how many bytes to look at (which can never exceed the string we passed it). So we can stop setting and restoring this NUL marker. That makes the code simpler, and will allow us to take a const buffer in a future patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0040-parse-options.sh')
0 files changed, 0 insertions, 0 deletions