diff.c: factor out diff_flush_patch_all_file_pairs

In a later patch we want to do more things before and after all filepairs are flushed. So factor flushing out all file pairs into its own function that the new code can be plugged in easily. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Jun 29, 2017 at 17:06 UTC ec33150671409e5995da25a6b2ab595a3ecd64de
1 file changed +12 -5
diff.c
+12 -5
@@ -4734,6 +4734,17 @@ void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc)
4734 warning(_(rename_limit_advice), varname, needed);
4735 }
4736
4737 +static void diff_flush_patch_all_file_pairs(struct diff_options *o)
4738 +{
4739 + int i;
4740 + struct diff_queue_struct *q = &diff_queued_diff;
4741 + for (i = 0; i < q->nr; i++) {
4742 + struct diff_filepair *p = q->queue[i];
4743 + if (check_pair_status(p))
4744 + diff_flush_patch(p, o);
4745 + }
4746 +}
4747 +
4748 void diff_flush(struct diff_options *options)
4749 {
4750 struct diff_queue_struct *q = &diff_queued_diff;
@@ -4826,11 +4837,7 @@ void diff_flush(struct diff_options *options)
4837 }
4838 }
4839
4829 - for (i = 0; i < q->nr; i++) {
4830 - struct diff_filepair *p = q->queue[i];
4831 - if (check_pair_status(p))
4832 - diff_flush_patch(p, options);
4833 - }
4840 + diff_flush_patch_all_file_pairs(options);
4841 }
4842
4843 if (output_format & DIFF_FORMAT_CALLBACK)