summaryrefslogtreecommitdiff
path: root/builtin/mailinfo.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-10-18 22:40:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-10-21 22:37:50 (GMT)
commitfbbcafd0607d6fccb2fde39c49619bcd7a7b910b (patch)
tree38d0f902dee8950529f1ee26e5a6cb965660c559 /builtin/mailinfo.c
parent69e24defd629eb6641e653b73459f57ab750c58b (diff)
downloadgit-fbbcafd0607d6fccb2fde39c49619bcd7a7b910b.zip
git-fbbcafd0607d6fccb2fde39c49619bcd7a7b910b.tar.gz
git-fbbcafd0607d6fccb2fde39c49619bcd7a7b910b.tar.bz2
mailinfo: do not let find_boundary() touch global "line" directly
With the previous two commits, we established that the local variable "line" in handle_body() and handle_boundary() functions always refer to the global "line" that is used as the common and shared "current line from the input". They are the only callers of the last function that refers to the global line directly, i.e. find_boundary(). Pass "line" as a parameter to this leaf function to complete the clean-up. Now the only function that directly refers to the global "line" is the caller of handle_body() at the very beginning of this whole callchain. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/mailinfo.c')
-rw-r--r--builtin/mailinfo.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index 9b3f349..e7edd74 100644
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -786,10 +786,10 @@ static int read_one_header_line(struct strbuf *line, FILE *in)
return 1;
}
-static int find_boundary(void)
+static int find_boundary(struct strbuf *line)
{
- while (!strbuf_getline(&line, fin, '\n')) {
- if (*content_top && is_multipart_boundary(&line))
+ while (!strbuf_getline(line, fin, '\n')) {
+ if (*content_top && is_multipart_boundary(line))
return 1;
}
return 0;
@@ -821,7 +821,7 @@ again:
strbuf_release(&newline);
/* skip to the next boundary */
- if (!find_boundary())
+ if (!find_boundary(line))
return 0;
goto again;
}
@@ -850,7 +850,7 @@ static void handle_body(struct strbuf *line)
/* Skip up to the first boundary */
if (*content_top) {
- if (!find_boundary())
+ if (!find_boundary(line))
goto handle_body_out;
}