commit a960dec7e3242ff887bcf4278cd07c321645ff68 Author: Oswald Buddenhagen <o...@kde.org> Date: Sat Mar 12 16:16:42 2011 +0100
get rid of redundant literal_pending state flag src/drv_imap.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/drv_imap.c b/src/drv_imap.c index e00a29d..179f548 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -90,7 +90,7 @@ typedef struct imap_store { int store_canceled; /* context is invalid, only ref_count keeps it alive */ parse_list_state_t parse_list_sts; /* command queue */ - int nexttag, num_pending, num_in_progress, literal_pending; + int nexttag, num_pending, num_in_progress; struct imap_cmd *pending, **pending_append; struct imap_cmd *in_progress, **in_progress_append; @@ -269,8 +269,6 @@ send_imap_cmd( imap_store_t *ctx, struct imap_cmd *cmd ) if (socket_write( &ctx->conn, p, cmd->param.data_len, GiveOwn ) < 0 || socket_write( &ctx->conn, "\r\n", 2, KeepOwn ) < 0) goto bail; - } else if (cmd->param.cont || cmd->param.data) { - ctx->literal_pending = 1; } if (cmd->param.to_trash && ctx->trashnc == TrashUnknown) ctx->trashnc = TrashChecking; @@ -288,7 +286,12 @@ send_imap_cmd( imap_store_t *ctx, struct imap_cmd *cmd ) static int cmd_submittable( imap_store_t *ctx, struct imap_cmd *cmd ) { - return !ctx->literal_pending && + struct imap_cmd *cmdp; + + return !(ctx->in_progress && + (cmdp = (struct imap_cmd *)((char *)ctx->in_progress_append - + offsetof(struct imap_cmd, next)), 1) && + (cmdp->param.cont || cmdp->param.data)) && !(cmd->param.to_trash && ctx->trashnc == TrashChecking) && ctx->num_in_progress < ((imap_store_conf_t *)ctx->gen.conf)->server->max_in_progress; } @@ -905,8 +908,6 @@ imap_socket_read( void *aux ) } if (socket_write( &ctx->conn, "\r\n", 2, KeepOwn ) < 0) return; - if (!cmdp->param.cont) - ctx->literal_pending = 0; } else { tag = atoi( arg ); for (pcmdp = &ctx->in_progress; (cmdp = *pcmdp); pcmdp = &cmdp->next) @@ -918,8 +919,6 @@ imap_socket_read( void *aux ) if (!(*pcmdp = cmdp->next)) ctx->in_progress_append = pcmdp; ctx->num_in_progress--; - if (cmdp->param.cont || cmdp->param.data) - ctx->literal_pending = 0; arg = next_arg( &cmd ); if (!strcmp( "OK", arg )) { if (cmdp->param.to_trash) ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ isync-devel mailing list isync-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/isync-devel