trailer_info_get(): reorder parameters
This is another preparatory refactor to unify the trailer formatters. Take const struct process_trailer_options *opts as the first parameter, because these options are required for parsing trailers (e.g., whether to treat "---" as the end of the log message). And take struct trailer_info *info last, because it's an "out parameter" (something that the caller wants to use as the output of this function). Signed-off-by: Linus Arver <linusa@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
ae0ec2e0e0
commit
9aa1b2bc89
@ -332,7 +332,7 @@ static int has_conforming_footer(struct strbuf *sb, struct strbuf *sob,
|
||||
sb->buf[sb->len - ignore_footer] = '\0';
|
||||
}
|
||||
|
||||
trailer_info_get(&info, sb->buf, &opts);
|
||||
trailer_info_get(&opts, sb->buf, &info);
|
||||
|
||||
if (ignore_footer)
|
||||
sb->buf[sb->len - ignore_footer] = saved_char;
|
||||
|
11
trailer.c
11
trailer.c
@ -997,7 +997,7 @@ void parse_trailers(const struct process_trailer_options *opts,
|
||||
struct strbuf val = STRBUF_INIT;
|
||||
size_t i;
|
||||
|
||||
trailer_info_get(info, str, opts);
|
||||
trailer_info_get(opts, str, info);
|
||||
|
||||
for (i = 0; i < info->trailer_nr; i++) {
|
||||
int separator_pos;
|
||||
@ -1032,8 +1032,9 @@ void free_trailers(struct list_head *trailers)
|
||||
}
|
||||
}
|
||||
|
||||
void trailer_info_get(struct trailer_info *info, const char *str,
|
||||
const struct process_trailer_options *opts)
|
||||
void trailer_info_get(const struct process_trailer_options *opts,
|
||||
const char *str,
|
||||
struct trailer_info *info)
|
||||
{
|
||||
size_t end_of_log_message = 0, trailer_block_start = 0;
|
||||
struct strbuf **trailer_lines, **ptr;
|
||||
@ -1150,7 +1151,7 @@ void format_trailers_from_commit(const struct process_trailer_options *opts,
|
||||
{
|
||||
struct trailer_info info;
|
||||
|
||||
trailer_info_get(&info, msg, opts);
|
||||
trailer_info_get(opts, msg, &info);
|
||||
format_trailer_info(opts, &info, msg, out);
|
||||
trailer_info_release(&info);
|
||||
}
|
||||
@ -1161,7 +1162,7 @@ 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->internal.info, msg, &opts);
|
||||
trailer_info_get(&opts, msg, &iter->internal.info);
|
||||
iter->internal.cur = 0;
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,9 @@ void parse_trailers(const struct process_trailer_options *,
|
||||
const char *str,
|
||||
struct list_head *head);
|
||||
|
||||
void trailer_info_get(struct trailer_info *info, const char *str,
|
||||
const struct process_trailer_options *opts);
|
||||
void trailer_info_get(const struct process_trailer_options *,
|
||||
const char *str,
|
||||
struct trailer_info *);
|
||||
|
||||
void trailer_info_release(struct trailer_info *info);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user