]> git.ipfire.org Git - thirdparty/git.git/commit - imap-send.c
imap-send: change msg_data from storing (ptr, len) to storing strbuf
authorMichael Haggerty <mhagger@alum.mit.edu>
Sun, 25 Nov 2012 11:08:39 +0000 (12:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 29 Nov 2012 21:42:11 +0000 (13:42 -0800)
commitf035ab620520dbf286d3303194f10a489d7c7f56
tree57da02b9d571a61f7c99906625655d591e2b895b
parent6360bee4cd902bdea5db5826821edffd6f367d89
imap-send: change msg_data from storing (ptr, len) to storing strbuf

struct msg_data stored (ptr, len) of the data to be included in a
message, kept the character data NUL-terminated, etc., much like a
strbuf would do.  So change it to use a struct strbuf.  This makes
the code clearer and reduces copying a little bit.

A side effect of this change is that the memory for each message is
freed after it is used rather than leaked, though that detail is
unimportant given that imap-send is a top-level command.

By the way, there is a bunch of infrastructure in this file for
dealing with IMAP flags, although there is nothing in the code that
actually allows any flags to be set.  If there is no plan to add
support for flags in the future, a bunch of code could be ripped out
and "struct msg_data" could be completely replaced with strbuf, but
that would be a separate topic.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
imap-send.c