diff options
author | Jeff King <peff@peff.net> | 2017-08-10 21:03:58 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-10 22:41:25 +0300 |
commit | 8abc89800c09cda7910c2211ebbbbb95a3008b63 (patch) | |
tree | 5b44f9610fdcc743b0bf5257a072ff2477757797 /trailer.c | |
parent | cf8899d285d2648013040ec7196ffd3de0606664 (diff) |
trailer: put process_trailers() options into a struct
We already have two options and are about to add a few more.
To avoid having a huge number of boolean arguments, let's
convert to an options struct which can be passed in.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trailer.c')
-rw-r--r-- | trailer.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -967,7 +967,9 @@ static FILE *create_in_place_tempfile(const char *file) return outfile; } -void process_trailers(const char *file, int in_place, int trim_empty, struct string_list *trailers) +void process_trailers(const char *file, + const struct process_trailer_options *opts, + struct string_list *trailers) { LIST_HEAD(head); LIST_HEAD(arg_head); @@ -979,7 +981,7 @@ void process_trailers(const char *file, int in_place, int trim_empty, struct str read_input_file(&sb, file); - if (in_place) + if (opts->in_place) outfile = create_in_place_tempfile(file); /* Print the lines before the trailers */ @@ -989,14 +991,14 @@ void process_trailers(const char *file, int in_place, int trim_empty, struct str process_trailers_lists(&head, &arg_head); - print_all(outfile, &head, trim_empty); + print_all(outfile, &head, opts->trim_empty); free_all(&head); /* Print the lines after the trailers as is */ fwrite(sb.buf + trailer_end, 1, sb.len - trailer_end, outfile); - if (in_place) + if (opts->in_place) if (rename_tempfile(&trailers_tempfile, file)) die_errno(_("could not rename temporary file to %s"), file); |