imap-send.c: remove struct msg_data
Now that its flags member has been deleted, all that is left is a strbuf. So use a strbuf directly. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
719125c522
commit
cbc607614d
18
imap-send.c
18
imap-send.c
@ -68,10 +68,6 @@ struct store {
|
|||||||
int recent; /* # of recent messages - don't trust this beyond the initial read */
|
int recent; /* # of recent messages - don't trust this beyond the initial read */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct msg_data {
|
|
||||||
struct strbuf data;
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char imap_send_usage[] = "git imap-send < <mbox>";
|
static const char imap_send_usage[] = "git imap-send < <mbox>";
|
||||||
|
|
||||||
#undef DRV_OK
|
#undef DRV_OK
|
||||||
@ -1279,7 +1275,7 @@ static void lf_to_crlf(struct strbuf *msg)
|
|||||||
* Store msg to IMAP. Also detach and free the data from msg->data,
|
* Store msg to IMAP. Also detach and free the data from msg->data,
|
||||||
* leaving msg->data empty.
|
* leaving msg->data empty.
|
||||||
*/
|
*/
|
||||||
static int imap_store_msg(struct store *gctx, struct msg_data *msg)
|
static int imap_store_msg(struct store *gctx, struct strbuf *msg)
|
||||||
{
|
{
|
||||||
struct imap_store *ctx = (struct imap_store *)gctx;
|
struct imap_store *ctx = (struct imap_store *)gctx;
|
||||||
struct imap *imap = ctx->imap;
|
struct imap *imap = ctx->imap;
|
||||||
@ -1287,11 +1283,11 @@ static int imap_store_msg(struct store *gctx, struct msg_data *msg)
|
|||||||
const char *prefix, *box;
|
const char *prefix, *box;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
lf_to_crlf(&msg->data);
|
lf_to_crlf(msg);
|
||||||
memset(&cb, 0, sizeof(cb));
|
memset(&cb, 0, sizeof(cb));
|
||||||
|
|
||||||
cb.dlen = msg->data.len;
|
cb.dlen = msg->len;
|
||||||
cb.data = strbuf_detach(&msg->data, NULL);
|
cb.data = strbuf_detach(msg, NULL);
|
||||||
|
|
||||||
box = gctx->name;
|
box = gctx->name;
|
||||||
prefix = !strcmp(box, "INBOX") ? "" : ctx->prefix;
|
prefix = !strcmp(box, "INBOX") ? "" : ctx->prefix;
|
||||||
@ -1449,7 +1445,7 @@ static int git_imap_config(const char *key, const char *val, void *cb)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct strbuf all_msgs = STRBUF_INIT;
|
struct strbuf all_msgs = STRBUF_INIT;
|
||||||
struct msg_data msg = {STRBUF_INIT};
|
struct strbuf msg = STRBUF_INIT;
|
||||||
struct store *ctx = NULL;
|
struct store *ctx = NULL;
|
||||||
int ofs = 0;
|
int ofs = 0;
|
||||||
int r;
|
int r;
|
||||||
@ -1511,10 +1507,10 @@ int main(int argc, char **argv)
|
|||||||
unsigned percent = n * 100 / total;
|
unsigned percent = n * 100 / total;
|
||||||
|
|
||||||
fprintf(stderr, "%4u%% (%d/%d) done\r", percent, n, total);
|
fprintf(stderr, "%4u%% (%d/%d) done\r", percent, n, total);
|
||||||
if (!split_msg(&all_msgs, &msg.data, &ofs))
|
if (!split_msg(&all_msgs, &msg, &ofs))
|
||||||
break;
|
break;
|
||||||
if (server.use_html)
|
if (server.use_html)
|
||||||
wrap_in_html(&msg.data);
|
wrap_in_html(&msg);
|
||||||
r = imap_store_msg(ctx, &msg);
|
r = imap_store_msg(ctx, &msg);
|
||||||
if (r != DRV_OK)
|
if (r != DRV_OK)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user