diff options
Diffstat (limited to 'mailinfo.c')
-rw-r--r-- | mailinfo.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/mailinfo.c b/mailinfo.c index f289941f7e..e19abe3cb9 100644 --- a/mailinfo.c +++ b/mailinfo.c @@ -179,12 +179,6 @@ static void handle_content_type(struct mailinfo *mi, struct strbuf *line) } } -static void handle_message_id(struct mailinfo *mi, const struct strbuf *line) -{ - if (mi->add_message_id) - mi->message_id = strdup(line->buf); -} - static void handle_content_transfer_encoding(struct mailinfo *mi, const struct strbuf *line) { @@ -495,7 +489,8 @@ static int check_header(struct mailinfo *mi, len = strlen("Message-Id: "); strbuf_add(&sb, line->buf + len, line->len - len); decode_header(mi, &sb); - handle_message_id(mi, &sb); + if (mi->add_message_id) + mi->message_id = strbuf_detach(&sb, NULL); ret = 1; goto check_header_out; } @@ -732,7 +727,7 @@ static int read_one_header_line(struct strbuf *line, FILE *in) struct strbuf continuation = STRBUF_INIT; /* Get the first part of the line. */ - if (strbuf_getline(line, in, '\n')) + if (strbuf_getline_lf(line, in)) return 0; /* @@ -756,7 +751,7 @@ static int read_one_header_line(struct strbuf *line, FILE *in) peek = fgetc(in); ungetc(peek, in); if (peek != ' ' && peek != '\t') break; - if (strbuf_getline(&continuation, in, '\n')) + if (strbuf_getline_lf(&continuation, in)) break; continuation.buf[0] = ' '; strbuf_rtrim(&continuation); @@ -769,7 +764,7 @@ static int read_one_header_line(struct strbuf *line, FILE *in) static int find_boundary(struct mailinfo *mi, struct strbuf *line) { - while (!strbuf_getline(line, mi->input, '\n')) { + while (!strbuf_getline_lf(line, mi->input)) { if (*(mi->content_top) && is_multipart_boundary(mi, line)) return 1; } @@ -820,7 +815,7 @@ again: strbuf_release(&newline); /* replenish line */ - if (strbuf_getline(line, mi->input, '\n')) + if (strbuf_getline_lf(line, mi->input)) return 0; strbuf_addch(line, '\n'); return 1; |