summaryrefslogtreecommitdiff
path: root/mailinfo.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-09-09 04:36:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-09-09 04:36:01 (GMT)
commit71165f027fed7d0d47f8cb50dd46ab4b11821a40 (patch)
treec983f83af8d4b6407779801439c7325d82b725ca /mailinfo.c
parent9bef64223606a2c5fdc696745ce02b4af62bda90 (diff)
parentecf30b237cb278040f18c597c1dbdbc49793094d (diff)
downloadgit-71165f027fed7d0d47f8cb50dd46ab4b11821a40.zip
git-71165f027fed7d0d47f8cb50dd46ab4b11821a40.tar.gz
git-71165f027fed7d0d47f8cb50dd46ab4b11821a40.tar.bz2
Merge branch 'rs/mailinfo-lib' into maint
Small code clean-up. * rs/mailinfo-lib: mailinfo: recycle strbuf in check_header()
Diffstat (limited to 'mailinfo.c')
-rw-r--r--mailinfo.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/mailinfo.c b/mailinfo.c
index 9f19ca1..e19abe3 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;
}