mailinfo: move patch_lines to struct mailinfo
This one is trivial thanks to previous steps that started passing the structure throughout the input codepaths. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Oct 14, 2015 at 16:13 UTC
43550efa714c0285f0173ff0cebf231956659d62
1 file changed
+5
-5
builtin/mailinfo.c
+5
-5
@@ -20,6 +20,7 @@ struct mailinfo {
20
int keep_subject;
21
int keep_non_patch_brackets_in_subject;
22
23
+ int patch_lines;
24
int filter_stage; /* still reading log or are we copying patch? */
25
int header_stage; /* still checking in-body headers? */
26
};
@@ -30,7 +31,6 @@ static enum {
31
} transfer_encoding;
32
33
static struct strbuf charset = STRBUF_INIT;
33
-static int patch_lines;
34
static struct strbuf **p_hdr_data, **s_hdr_data;
35
static int use_scissors;
36
static int add_message_id;
@@ -707,10 +707,10 @@ static int handle_commit_msg(struct mailinfo *mi, struct strbuf *line)
707
return 0;
708
}
709
710
-static void handle_patch(const struct strbuf *line)
710
+static void handle_patch(struct mailinfo *mi, const struct strbuf *line)
711
{
712
fwrite(line->buf, 1, line->len, patchfile);
713
- patch_lines++;
713
+ mi->patch_lines++;
714
}
715
716
static void handle_filter(struct mailinfo *mi, struct strbuf *line)
@@ -721,7 +721,7 @@ static void handle_filter(struct mailinfo *mi, struct strbuf *line)
721
break;
722
mi->filter_stage++;
723
case 1:
724
- handle_patch(line);
724
+ handle_patch(mi, line);
725
break;
726
}
727
}
@@ -941,7 +941,7 @@ static void handle_info(struct mailinfo *mi)
941
942
for (i = 0; header[i]; i++) {
943
/* only print inbody headers if we output a patch file */
944
- if (patch_lines && s_hdr_data[i])
944
+ if (mi->patch_lines && s_hdr_data[i])
945
hdr = s_hdr_data[i];
946
else if (p_hdr_data[i])
947
hdr = p_hdr_data[i];