Skip to content

Commit 43550ef

Browse files
committed
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 <[email protected]>
1 parent 13c6df2 commit 43550ef

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

builtin/mailinfo.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ struct mailinfo {
2020
int keep_subject;
2121
int keep_non_patch_brackets_in_subject;
2222

23+
int patch_lines;
2324
int filter_stage; /* still reading log or are we copying patch? */
2425
int header_stage; /* still checking in-body headers? */
2526
};
@@ -30,7 +31,6 @@ static enum {
3031
} transfer_encoding;
3132

3233
static struct strbuf charset = STRBUF_INIT;
33-
static int patch_lines;
3434
static struct strbuf **p_hdr_data, **s_hdr_data;
3535
static int use_scissors;
3636
static int add_message_id;
@@ -707,10 +707,10 @@ static int handle_commit_msg(struct mailinfo *mi, struct strbuf *line)
707707
return 0;
708708
}
709709

710-
static void handle_patch(const struct strbuf *line)
710+
static void handle_patch(struct mailinfo *mi, const struct strbuf *line)
711711
{
712712
fwrite(line->buf, 1, line->len, patchfile);
713-
patch_lines++;
713+
mi->patch_lines++;
714714
}
715715

716716
static void handle_filter(struct mailinfo *mi, struct strbuf *line)
@@ -721,7 +721,7 @@ static void handle_filter(struct mailinfo *mi, struct strbuf *line)
721721
break;
722722
mi->filter_stage++;
723723
case 1:
724-
handle_patch(line);
724+
handle_patch(mi, line);
725725
break;
726726
}
727727
}
@@ -941,7 +941,7 @@ static void handle_info(struct mailinfo *mi)
941941

942942
for (i = 0; header[i]; i++) {
943943
/* 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])
945945
hdr = s_hdr_data[i];
946946
else if (p_hdr_data[i])
947947
hdr = p_hdr_data[i];

0 commit comments

Comments
 (0)