summaryrefslogtreecommitdiff
path: root/trailer.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-08-10 18:03:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-10 19:41:25 (GMT)
commit8abc89800c09cda7910c2211ebbbbb95a3008b63 (patch)
tree5b44f9610fdcc743b0bf5257a072ff2477757797 /trailer.c
parentcf8899d285d2648013040ec7196ffd3de0606664 (diff)
downloadgit-8abc89800c09cda7910c2211ebbbbb95a3008b63.zip
git-8abc89800c09cda7910c2211ebbbbb95a3008b63.tar.gz
git-8abc89800c09cda7910c2211ebbbbb95a3008b63.tar.bz2
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.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/trailer.c b/trailer.c
index 11f0b9f..9bcd54e 100644
--- a/trailer.c
+++ b/trailer.c
@@ -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);