From 43271d8fad03c2cefd387a8cd80d578c2aa6fd34 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 30 Jul 2024 08:25:20 +0200 Subject: [PATCH] eliminate commit_cmds driver callback no driver implements it, and this isn't likely to change any time soon. --- src/driver.h | 3 --- src/drv_imap.c | 9 --------- src/drv_maildir.c | 7 ------- src/drv_proxy.c | 38 +++++++------------------------------- src/drv_proxy_gen.pl | 1 - src/sync.c | 1 - 6 files changed, 7 insertions(+), 52 deletions(-) diff --git a/src/driver.h b/src/driver.h index d3068bc..f7c5b95 100644 --- a/src/driver.h +++ b/src/driver.h @@ -295,9 +295,6 @@ struct driver { void (*cancel_cmds)( store_t *ctx, void (*cb)( void *aux ), void *aux ); - /* Commit any pending set_msg_flags() commands. */ - void (*commit_cmds)( store_t *ctx ); - /* Get approximate amount of memory occupied by the driver. */ uint (*get_memory_usage)( store_t *ctx ); diff --git a/src/drv_imap.c b/src/drv_imap.c index 681117e..5b67535 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -3653,14 +3653,6 @@ imap_cancel_cmds( store_t *gctx, } } -/******************* imap_commit_cmds *******************/ - -static void -imap_commit_cmds( store_t *gctx ) -{ - (void)gctx; -} - /******************* imap_get_memory_usage *******************/ static uint @@ -4039,7 +4031,6 @@ struct driver imap_driver = { imap_trash_msg, imap_close_box, imap_cancel_cmds, - imap_commit_cmds, imap_get_memory_usage, imap_get_fail_state, }; diff --git a/src/drv_maildir.c b/src/drv_maildir.c index cdffc32..847bc06 100644 --- a/src/drv_maildir.c +++ b/src/drv_maildir.c @@ -1853,12 +1853,6 @@ maildir_cancel_cmds( store_t *gctx ATTR_UNUSED, cb( aux ); } -static void -maildir_commit_cmds( store_t *gctx ) -{ - (void) gctx; -} - static uint maildir_get_memory_usage( store_t *gctx ATTR_UNUSED ) { @@ -1983,7 +1977,6 @@ struct driver maildir_driver = { maildir_trash_msg, maildir_close_box, maildir_cancel_cmds, - maildir_commit_cmds, maildir_get_memory_usage, maildir_get_fail_state, }; diff --git a/src/drv_proxy.c b/src/drv_proxy.c index 37dbc34..ffe2e06 100644 --- a/src/drv_proxy.c +++ b/src/drv_proxy.c @@ -21,7 +21,6 @@ typedef union proxy_store { driver_t *real_driver; store_t *real_store; gen_cmd_t *pending_cmds, **pending_cmds_append; - gen_cmd_t *check_cmds, **check_cmds_append; wakeup_t wakeup; uint fake_nextuid; char is_fake; // Was "created" by dry-run @@ -91,42 +90,25 @@ proxy_wakeup( void *aux ) } static void -proxy_invoke( gen_cmd_t *cmd, int checked, const char *name ) +proxy_invoke( gen_cmd_t *cmd, const char *name ) { proxy_store_t *ctx = cmd->ctx; if (ctx->force_async) { - debug( "%s[% 2d] Queue %s%s\n", ctx->label, cmd->tag, name, checked ? " (checked)" : "" ); + debug( "%s[% 2d] Queue %s\n", ctx->label, cmd->tag, name ); cmd->next = NULL; - if (checked) { - *ctx->check_cmds_append = cmd; - ctx->check_cmds_append = &cmd->next; - } else { - *ctx->pending_cmds_append = cmd; - ctx->pending_cmds_append = &cmd->next; - conf_wakeup( &ctx->wakeup, 0 ); - } + *ctx->pending_cmds_append = cmd; + ctx->pending_cmds_append = &cmd->next; + conf_wakeup( &ctx->wakeup, 0 ); } else { cmd->queued_cb( cmd ); proxy_cmd_done( cmd ); } } -static void -proxy_flush_checked_cmds( proxy_store_t *ctx ) -{ - if (ctx->check_cmds) { - *ctx->pending_cmds_append = ctx->check_cmds; - ctx->pending_cmds_append = ctx->check_cmds_append; - ctx->check_cmds_append = &ctx->check_cmds; - ctx->check_cmds = NULL; - conf_wakeup( &ctx->wakeup, 0 ); - } -} - static void proxy_cancel_queued_cmds( proxy_store_t *ctx ) { - if (ctx->pending_cmds || ctx->check_cmds) { + if (ctx->pending_cmds) { // This would involve directly invoking the result callbacks with // DRV_CANCEL, for which we'd need another set of dispatch functions. // The autotest doesn't need that, so save the effort. @@ -253,7 +235,7 @@ static @type@proxy_@name@( store_t *gctx@decl_args@, void (*cb)( @decl_cb_args@v cmd->callback = cb; cmd->callback_aux = aux; @assign_state@ - proxy_invoke( &cmd->gen, @checked@, "@name@" ); + proxy_invoke( &cmd->gen, "@name@" ); } //# END @@ -382,7 +364,6 @@ static @type@proxy_@name@( store_t *gctx@decl_args@, void (*cb)( @decl_cb_args@v //# DEFINE store_msg_fake_cb_args , cmd->to_trash ? 0 : ctx->fake_nextuid++ //# DEFINE store_msg_counted 1 -//# DEFINE set_msg_flags_checked 1 //# DEFINE set_msg_flags_print_fmt_args , uid=%u, add=%s, del=%s //# DEFINE set_msg_flags_print_pass_args , cmd->uid, fmt_flags( cmd->add ).str, fmt_flags( cmd->del ).str //# DEFINE set_msg_flags_driable 1 @@ -397,10 +378,6 @@ static @type@proxy_@name@( store_t *gctx@decl_args@, void (*cb)( @decl_cb_args@v //# DEFINE close_box_fake_cb_args , 0 //# DEFINE close_box_counted 1 -//# DEFINE commit_cmds_print_args - proxy_flush_checked_cmds( ctx ); -//# END - //# DEFINE cancel_cmds_print_cb_args proxy_cancel_queued_cmds( ctx ); //# END @@ -465,7 +442,6 @@ proxy_alloc_store( store_t *real_ctx, const char *label, int force_async ) ctx->label = label; ctx->force_async = force_async; ctx->pending_cmds_append = &ctx->pending_cmds; - ctx->check_cmds_append = &ctx->check_cmds; ctx->real_driver = real_ctx->driver; ctx->real_store = real_ctx; ctx->real_driver->set_callbacks( ctx->real_store, diff --git a/src/drv_proxy_gen.pl b/src/drv_proxy_gen.pl index 6b9c868..dd1021f 100755 --- a/src/drv_proxy_gen.pl +++ b/src/drv_proxy_gen.pl @@ -158,7 +158,6 @@ for (@ptypes) { my $r_pass_args = make_args($r_cmd_args); $replace{'assign_state'} = $r_pass_args =~ s/([^,]+), /cmd->$1 = $1\;\n/gr; - $replace{'checked'} = '0'; $template = "CALLBACK"; } else { $pass_args = make_args($cmd_args); diff --git a/src/sync.c b/src/sync.c index c66370c..7f95e85 100644 --- a/src/sync.c +++ b/src/sync.c @@ -1373,7 +1373,6 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux } } for (t = 0; t < 2; t++) { - svars->drv[t]->commit_cmds( svars->ctx[t] ); svars->state[t] |= ST_SENT_FLAGS; msgs_flags_set( svars, t ); if (check_cancel( svars ))