]> git.ipfire.org Git - thirdparty/git.git/commit
trailer: use offsets for trailer_start/trailer_end
authorLinus Arver <linusa@google.com>
Fri, 20 Oct 2023 19:01:35 +0000 (19:01 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Dec 2023 19:55:04 +0000 (11:55 -0800)
commitde7c27a1869953158436e60542ea556d78c3f4c2
tree7e41270d3513327b9d95fe109fdbeabc9eeebe9c
parent97e9d0b78a038de37245acbef11a10c4ae2feeb3
trailer: use offsets for trailer_start/trailer_end

Previously these fields in the trailer_info struct were of type "const
char *" and pointed to positions in the input string directly (to the
start and end positions of the trailer block).

Use offsets to make the intended usage less ambiguous. We only need to
reference the input string in format_trailer_info(), so update that
function to take a pointer to the input.

While we're at it, rename trailer_start to trailer_block_start to be
more explicit about these offsets (that they are for the entire trailer
block including other trailers). Ditto for trailer_end.

Reported-by: Glen Choo <glencbz@gmail.com>
Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
trailer.c
trailer.h