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>

Michael Haggerty committed Jan 15, 2013 at 09:06 UTC cbc607614d5b1be0a1a039a5b777ed751708ef7f
1 file changed +7 -11
imap-send.c
+7 -11
@@ -68,10 +68,6 @@ struct store {
68 int recent; /* # of recent messages - don't trust this beyond the initial read */
69 };
70
71 -struct msg_data {
72 - struct strbuf data;
73 -};
74 -
71 static const char imap_send_usage[] = "git imap-send < <mbox>";
72
73 #undef DRV_OK
@@ -1279,7 +1275,7 @@ static void lf_to_crlf(struct strbuf *msg)
1275 * Store msg to IMAP. Also detach and free the data from msg->data,
1276 * leaving msg->data empty.
1277 */
1282 -static int imap_store_msg(struct store *gctx, struct msg_data *msg)
1278 +static int imap_store_msg(struct store *gctx, struct strbuf *msg)
1279 {
1280 struct imap_store *ctx = (struct imap_store *)gctx;
1281 struct imap *imap = ctx->imap;
@@ -1287,11 +1283,11 @@ static int imap_store_msg(struct store *gctx, struct msg_data *msg)
1283 const char *prefix, *box;
1284 int ret;
1285
1290 - lf_to_crlf(&msg->data);
1286 + lf_to_crlf(msg);
1287 memset(&cb, 0, sizeof(cb));
1288
1293 - cb.dlen = msg->data.len;
1294 - cb.data = strbuf_detach(&msg->data, NULL);
1289 + cb.dlen = msg->len;
1290 + cb.data = strbuf_detach(msg, NULL);
1291
1292 box = gctx->name;
1293 prefix = !strcmp(box, "INBOX") ? "" : ctx->prefix;
@@ -1449,7 +1445,7 @@ static int git_imap_config(const char *key, const char *val, void *cb)
1445 int main(int argc, char **argv)
1446 {
1447 struct strbuf all_msgs = STRBUF_INIT;
1452 - struct msg_data msg = {STRBUF_INIT};
1448 + struct strbuf msg = STRBUF_INIT;
1449 struct store *ctx = NULL;
1450 int ofs = 0;
1451 int r;
@@ -1511,10 +1507,10 @@ int main(int argc, char **argv)
1507 unsigned percent = n * 100 / total;
1508
1509 fprintf(stderr, "%4u%% (%d/%d) done\r", percent, n, total);
1514 - if (!split_msg(&all_msgs, &msg.data, &ofs))
1510 + if (!split_msg(&all_msgs, &msg, &ofs))
1511 break;
1512 if (server.use_html)
1517 - wrap_in_html(&msg.data);
1513 + wrap_in_html(&msg);
1514 r = imap_store_msg(ctx, &msg);
1515 if (r != DRV_OK)
1516 break;