imap-send.c: use struct imap_store instead of struct store
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> 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
fe47e1df2431c0d5a98195df45a8a49a1fb0a91a
1 file changed
+9
-10
imap-send.c
+9
-10
@@ -792,9 +792,9 @@ static void imap_close_server(struct imap_store *ictx)
792
free(imap);
793
}
794
795
-static void imap_close_store(struct store *ctx)
795
+static void imap_close_store(struct imap_store *ctx)
796
{
797
- imap_close_server((struct imap_store *)ctx);
797
+ imap_close_server(ctx);
798
free(ctx);
799
}
800
@@ -879,7 +879,7 @@ static int auth_cram_md5(struct imap_store *ctx, struct imap_cmd *cmd, const cha
879
return 0;
880
}
881
882
-static struct store *imap_open_store(struct imap_server_conf *srvc)
882
+static struct imap_store *imap_open_store(struct imap_server_conf *srvc)
883
{
884
struct imap_store *ctx;
885
struct imap *imap;
@@ -1089,10 +1089,10 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)
1089
} /* !preauth */
1090
1091
ctx->prefix = "";
1092
- return (struct store *)ctx;
1092
+ return ctx;
1093
1094
bail:
1095
- imap_close_store(&ctx->gen);
1095
+ imap_close_store(ctx);
1096
return NULL;
1097
}
1098
@@ -1138,9 +1138,8 @@ static void lf_to_crlf(struct strbuf *msg)
1138
* Store msg to IMAP. Also detach and free the data from msg->data,
1139
* leaving msg->data empty.
1140
*/
1141
-static int imap_store_msg(struct store *gctx, struct strbuf *msg)
1141
+static int imap_store_msg(struct imap_store *ctx, struct strbuf *msg)
1142
{
1143
- struct imap_store *ctx = (struct imap_store *)gctx;
1143
struct imap *imap = ctx->imap;
1144
struct imap_cmd_cb cb;
1145
const char *prefix, *box;
@@ -1152,7 +1151,7 @@ static int imap_store_msg(struct store *gctx, struct strbuf *msg)
1151
cb.dlen = msg->len;
1152
cb.data = strbuf_detach(msg, NULL);
1153
1155
- box = gctx->name;
1154
+ box = ctx->gen.name;
1155
prefix = !strcmp(box, "INBOX") ? "" : ctx->prefix;
1156
cb.create = 0;
1157
ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\" ", prefix, box);
@@ -1308,7 +1307,7 @@ int main(int argc, char **argv)
1307
{
1308
struct strbuf all_msgs = STRBUF_INIT;
1309
struct strbuf msg = STRBUF_INIT;
1311
- struct store *ctx = NULL;
1310
+ struct imap_store *ctx = NULL;
1311
int ofs = 0;
1312
int r;
1313
int total, n = 0;
@@ -1364,7 +1363,7 @@ int main(int argc, char **argv)
1363
}
1364
1365
fprintf(stderr, "sending %d message%s\n", total, (total != 1) ? "s" : "");
1367
- ctx->name = imap_folder;
1366
+ ctx->gen.name = imap_folder;
1367
while (1) {
1368
unsigned percent = n * 100 / total;
1369