mailinfo: move global "line" into mailinfo() function
With the previous steps, it becomes clear that the mailinfo() function is the only one that wants the "line" to be directly touchable. Move it to the function scope of this function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Oct 18, 2015 at 15:47 UTC
6e21b5089f981e0e239bee722fc0d0edec703b8a
1 file changed
+3
-2
builtin/mailinfo.c
+3
-2
@@ -12,7 +12,6 @@ static FILE *cmitmsg, *patchfile, *fin, *fout;
12
static int keep_subject;
13
static int keep_non_patch_brackets_in_subject;
14
static const char *metainfo_charset;
15
-static struct strbuf line = STRBUF_INIT;
15
static struct strbuf name = STRBUF_INIT;
16
static struct strbuf email = STRBUF_INIT;
17
static char *message_id;
@@ -964,6 +963,8 @@ static void handle_info(void)
963
static int mailinfo(FILE *in, FILE *out, const char *msg, const char *patch)
964
{
965
int peek;
966
+ struct strbuf line = STRBUF_INIT;
967
+
968
fin = in;
969
fout = out;
970
@@ -995,7 +996,7 @@ static int mailinfo(FILE *in, FILE *out, const char *msg, const char *patch)
996
fclose(patchfile);
997
998
handle_info();
998
-
999
+ strbuf_release(&line);
1000
return 0;
1001
}
1002