mirror of
https://github.com/git/git.git
synced 2024-11-27 12:03:55 +08:00
trailer: separate public from internal portion of trailer_iterator
The fields here are not meant to be used by downstream callers, so put
them behind an anonymous struct named as "internal" to warn against
their use. This follows the pattern in 576de3d956
(unpack_trees: start
splitting internal fields from public API, 2023-02-27).
Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
ac83bc5054
commit
13211ae23f
10
trailer.c
10
trailer.c
@ -1220,14 +1220,14 @@ void trailer_iterator_init(struct trailer_iterator *iter, const char *msg)
|
||||
strbuf_init(&iter->key, 0);
|
||||
strbuf_init(&iter->val, 0);
|
||||
opts.no_divider = 1;
|
||||
trailer_info_get(&iter->info, msg, &opts);
|
||||
iter->cur = 0;
|
||||
trailer_info_get(&iter->internal.info, msg, &opts);
|
||||
iter->internal.cur = 0;
|
||||
}
|
||||
|
||||
int trailer_iterator_advance(struct trailer_iterator *iter)
|
||||
{
|
||||
while (iter->cur < iter->info.trailer_nr) {
|
||||
char *trailer = iter->info.trailers[iter->cur++];
|
||||
while (iter->internal.cur < iter->internal.info.trailer_nr) {
|
||||
char *trailer = iter->internal.info.trailers[iter->internal.cur++];
|
||||
int separator_pos = find_separator(trailer, separators);
|
||||
|
||||
if (separator_pos < 1)
|
||||
@ -1245,7 +1245,7 @@ int trailer_iterator_advance(struct trailer_iterator *iter)
|
||||
|
||||
void trailer_iterator_release(struct trailer_iterator *iter)
|
||||
{
|
||||
trailer_info_release(&iter->info);
|
||||
trailer_info_release(&iter->internal.info);
|
||||
strbuf_release(&iter->val);
|
||||
strbuf_release(&iter->key);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user