mailinfo: move global "line" into mailinfo() function
authorJunio C Hamano <gitster@pobox.com>
Sun, 18 Oct 2015 22:47:02 +0000 (15:47 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Oct 2015 22:37:52 +0000 (15:37 -0700)
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>
builtin/mailinfo.c
index e7edd743ce2583f675caa5654516511b02747f73..a0416610c95b5c5653eb394f5337379c122cf619 100644 (file)
@@ -12,7 +12,6 @@ static FILE *cmitmsg, *patchfile, *fin, *fout;
 static int keep_subject;
 static int keep_non_patch_brackets_in_subject;
 static const char *metainfo_charset;
-static struct strbuf line = STRBUF_INIT;
 static struct strbuf name = STRBUF_INIT;
 static struct strbuf email = STRBUF_INIT;
 static char *message_id;
@@ -964,6 +963,8 @@ static void handle_info(void)
 static int mailinfo(FILE *in, FILE *out, const char *msg, const char *patch)
 {
        int peek;
+       struct strbuf line = STRBUF_INIT;
+
        fin = in;
        fout = out;
 
@@ -995,7 +996,7 @@ static int mailinfo(FILE *in, FILE *out, const char *msg, const char *patch)
        fclose(patchfile);
 
        handle_info();
-
+       strbuf_release(&line);
        return 0;
 }