On Wed, 9 Aug 2017 08:24:03 -0400 Jeff King <peff@xxxxxxxx> wrote: > diff --git a/trailer.c b/trailer.c > index 0a0c2c264d..a4ff99f98a 100644 > --- a/trailer.c > +++ b/trailer.c > @@ -164,13 +164,15 @@ static void print_tok_val(FILE *outfile, const char *tok, const char *val) > fprintf(outfile, "%s%c %s\n", tok, separators[0], val); > } > > -static void print_all(FILE *outfile, struct list_head *head, int trim_empty) > +static void print_all(FILE *outfile, struct list_head *head, > + struct process_trailer_options *opts) This can be const, I think. (Same thing for patch 1.) > { > struct list_head *pos; > struct trailer_item *item; > list_for_each(pos, head) { > item = list_entry(pos, struct trailer_item, list); > - if (!trim_empty || strlen(item->value) > 0) > + if ((!opts->trim_empty || strlen(item->value) > 0) && > + (!opts->only_trailers || item->token)) > print_tok_val(outfile, item->token, item->value); > } > } > @@ -897,9 +899,10 @@ static int process_input_file(FILE *outfile, > trailer_info_get(&info, str); > > /* Print lines before the trailers as is */ > - fwrite(str, 1, info.trailer_start - str, outfile); > + if (outfile) Any reason why you expect outfile to possibly be NULL? > + fwrite(str, 1, info.trailer_start - str, outfile); > > - if (!info.blank_line_before_trailer) > + if (outfile && !info.blank_line_before_trailer) Same comment here. > fprintf(outfile, "\n"); > > for (i = 0; i < info.trailer_nr; i++) {