mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
97e9d0b78a
commit
de7c27a186
10
trailer.h
10
trailer.h
@@ -32,16 +32,16 @@ int trailer_set_if_missing(enum trailer_if_missing *item, const char *value);
|
||||
struct trailer_info {
|
||||
/*
|
||||
* True if there is a blank line before the location pointed to by
|
||||
* trailer_start.
|
||||
* trailer_block_start.
|
||||
*/
|
||||
int blank_line_before_trailer;
|
||||
|
||||
/*
|
||||
* Pointers to the start and end of the trailer block found. If there
|
||||
* is no trailer block found, these 2 pointers point to the end of the
|
||||
* input string.
|
||||
* Offsets to the trailer block start and end positions in the input
|
||||
* string. If no trailer block is found, these are both set to the
|
||||
* "true" end of the input (find_end_of_log_message()).
|
||||
*/
|
||||
const char *trailer_start, *trailer_end;
|
||||
size_t trailer_block_start, trailer_block_end;
|
||||
|
||||
/*
|
||||
* Array of trailers found.
|
||||
|
||||
Reference in New Issue
Block a user