From: Michael Haggerty <mhagger@alum.mit.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>,
git@vger.kernel.org, Michael Haggerty <mhagger@alum.mit.edu>
Subject: [PATCH 12/14] imap-send.c: use struct imap_store instead of struct store
Date: Mon, 14 Jan 2013 06:32:44 +0100 [thread overview]
Message-ID: <1358141566-26081-13-git-send-email-mhagger@alum.mit.edu> (raw)
In-Reply-To: <1358141566-26081-1-git-send-email-mhagger@alum.mit.edu>
In fact, all struct store instances are upcasts of struct imap_store
anyway, so stop making the distinction.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
imap-send.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/imap-send.c b/imap-send.c
index 3167dcc..31fdbf3 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -781,9 +781,9 @@ static void imap_close_server(struct imap_store *ictx)
free(imap);
}
-static void imap_close_store(struct store *ctx)
+static void imap_close_store(struct imap_store *ctx)
{
- imap_close_server((struct imap_store *)ctx);
+ imap_close_server(ctx);
free(ctx);
}
@@ -868,7 +868,7 @@ static int auth_cram_md5(struct imap_store *ctx, struct imap_cmd *cmd, const cha
return 0;
}
-static struct store *imap_open_store(struct imap_server_conf *srvc)
+static struct imap_store *imap_open_store(struct imap_server_conf *srvc)
{
struct imap_store *ctx;
struct imap *imap;
@@ -1078,10 +1078,10 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)
} /* !preauth */
ctx->prefix = "";
- return (struct store *)ctx;
+ return ctx;
bail:
- imap_close_store(&ctx->gen);
+ imap_close_store(ctx);
return NULL;
}
@@ -1112,9 +1112,8 @@ static void lf_to_crlf(struct strbuf *msg)
* Store msg to IMAP. Also detach and free the data from msg->data,
* leaving msg->data empty.
*/
-static int imap_store_msg(struct store *gctx, struct strbuf *msg)
+static int imap_store_msg(struct imap_store *ctx, struct strbuf *msg)
{
- struct imap_store *ctx = (struct imap_store *)gctx;
struct imap *imap = ctx->imap;
struct imap_cmd_cb cb;
const char *prefix, *box;
@@ -1126,7 +1125,7 @@ static int imap_store_msg(struct store *gctx, struct strbuf *msg)
cb.dlen = msg->len;
cb.data = strbuf_detach(msg, NULL);
- box = gctx->name;
+ box = ctx->gen.name;
prefix = !strcmp(box, "INBOX") ? "" : ctx->prefix;
cb.create = 0;
ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\"", prefix, box);
@@ -1282,7 +1281,7 @@ int main(int argc, char **argv)
{
struct strbuf all_msgs = STRBUF_INIT;
struct strbuf msg = STRBUF_INIT;
- struct store *ctx = NULL;
+ struct imap_store *ctx = NULL;
int ofs = 0;
int r;
int total, n = 0;
@@ -1338,7 +1337,7 @@ int main(int argc, char **argv)
}
fprintf(stderr, "sending %d message%s\n", total, (total != 1) ? "s" : "");
- ctx->name = imap_folder;
+ ctx->gen.name = imap_folder;
while (1) {
unsigned percent = n * 100 / total;
--
1.8.0.3
next prev parent reply other threads:[~2013-01-14 5:41 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-14 5:32 [PATCH 00/14] Remove unused code from imap-send.c Michael Haggerty
2013-01-14 5:32 ` [PATCH 01/14] imap-send.c: remove msg_data::flags, which was always zero Michael Haggerty
2013-01-14 5:57 ` Jonathan Nieder
2013-01-14 9:10 ` Michael Haggerty
2013-01-14 5:32 ` [PATCH 02/14] imap-send.c: remove struct msg_data Michael Haggerty
2013-01-14 5:32 ` [PATCH 03/14] iamp-send.c: remove unused struct imap_store_conf Michael Haggerty
2013-01-14 5:32 ` [PATCH 04/14] imap-send.c: remove struct store_conf Michael Haggerty
2013-01-14 5:32 ` [PATCH 05/14] imap-send.c: remove struct message Michael Haggerty
2013-01-14 5:32 ` [PATCH 06/14] imap-send.c: remove some unused fields from struct store Michael Haggerty
2013-01-14 6:19 ` Jonathan Nieder
2013-01-14 9:25 ` Michael Haggerty
2013-01-14 5:32 ` [PATCH 07/14] imap-send.c: inline imap_parse_list() in imap_list() Michael Haggerty
2013-01-14 5:32 ` [PATCH 08/14] imap-send.c: remove struct imap argument to parse_imap_list_l() Michael Haggerty
2013-01-14 5:32 ` [PATCH 09/14] imap-send.c: remove namespace fields from struct imap Michael Haggerty
2013-01-14 6:43 ` Jonathan Nieder
2013-01-14 9:31 ` Michael Haggerty
2013-01-14 5:32 ` [PATCH 10/14] imap-send.c: remove unused field imap_store::trashnc Michael Haggerty
2013-01-14 5:32 ` [PATCH 11/14] imap-send.c: simplify logic in lf_to_crlf() Michael Haggerty
2013-01-14 6:47 ` Jonathan Nieder
2013-01-14 5:32 ` Michael Haggerty [this message]
2013-01-14 6:52 ` [PATCH 12/14] imap-send.c: use struct imap_store instead of struct store Jonathan Nieder
2013-01-14 5:32 ` [PATCH 13/14] imap-send.c: remove unused field imap_store::uidvalidity Michael Haggerty
2013-01-14 5:32 ` [PATCH 14/14] imap-send.c: fold struct store into struct imap_store Michael Haggerty
2013-01-14 6:06 ` [PATCH 00/14] Remove unused code from imap-send.c Jeff King
2013-01-14 6:57 ` Jonathan Nieder
2013-01-14 9:33 ` Michael Haggerty
2013-01-14 19:02 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358141566-26081-13-git-send-email-mhagger@alum.mit.edu \
--to=mhagger@alum.mit.edu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).