Browse Source

eliminate commit_cmds driver callback

no driver implements it, and this isn't likely to change any time soon.
master
Oswald Buddenhagen 2 months ago
parent
commit
43271d8fad
  1. 3
      src/driver.h
  2. 9
      src/drv_imap.c
  3. 7
      src/drv_maildir.c
  4. 38
      src/drv_proxy.c
  5. 1
      src/drv_proxy_gen.pl
  6. 1
      src/sync.c

3
src/driver.h

@ -295,9 +295,6 @@ struct driver {
void (*cancel_cmds)( store_t *ctx, void (*cancel_cmds)( store_t *ctx,
void (*cb)( void *aux ), void *aux ); 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. */ /* Get approximate amount of memory occupied by the driver. */
uint (*get_memory_usage)( store_t *ctx ); uint (*get_memory_usage)( store_t *ctx );

9
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 *******************/ /******************* imap_get_memory_usage *******************/
static uint static uint
@ -4039,7 +4031,6 @@ struct driver imap_driver = {
imap_trash_msg, imap_trash_msg,
imap_close_box, imap_close_box,
imap_cancel_cmds, imap_cancel_cmds,
imap_commit_cmds,
imap_get_memory_usage, imap_get_memory_usage,
imap_get_fail_state, imap_get_fail_state,
}; };

7
src/drv_maildir.c

@ -1853,12 +1853,6 @@ maildir_cancel_cmds( store_t *gctx ATTR_UNUSED,
cb( aux ); cb( aux );
} }
static void
maildir_commit_cmds( store_t *gctx )
{
(void) gctx;
}
static uint static uint
maildir_get_memory_usage( store_t *gctx ATTR_UNUSED ) maildir_get_memory_usage( store_t *gctx ATTR_UNUSED )
{ {
@ -1983,7 +1977,6 @@ struct driver maildir_driver = {
maildir_trash_msg, maildir_trash_msg,
maildir_close_box, maildir_close_box,
maildir_cancel_cmds, maildir_cancel_cmds,
maildir_commit_cmds,
maildir_get_memory_usage, maildir_get_memory_usage,
maildir_get_fail_state, maildir_get_fail_state,
}; };

38
src/drv_proxy.c

@ -21,7 +21,6 @@ typedef union proxy_store {
driver_t *real_driver; driver_t *real_driver;
store_t *real_store; store_t *real_store;
gen_cmd_t *pending_cmds, **pending_cmds_append; gen_cmd_t *pending_cmds, **pending_cmds_append;
gen_cmd_t *check_cmds, **check_cmds_append;
wakeup_t wakeup; wakeup_t wakeup;
uint fake_nextuid; uint fake_nextuid;
char is_fake; // Was "created" by dry-run char is_fake; // Was "created" by dry-run
@ -91,42 +90,25 @@ proxy_wakeup( void *aux )
} }
static void 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; proxy_store_t *ctx = cmd->ctx;
if (ctx->force_async) { 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; cmd->next = NULL;
if (checked) { *ctx->pending_cmds_append = cmd;
*ctx->check_cmds_append = cmd; ctx->pending_cmds_append = &cmd->next;
ctx->check_cmds_append = &cmd->next; conf_wakeup( &ctx->wakeup, 0 );
} else {
*ctx->pending_cmds_append = cmd;
ctx->pending_cmds_append = &cmd->next;
conf_wakeup( &ctx->wakeup, 0 );
}
} else { } else {
cmd->queued_cb( cmd ); cmd->queued_cb( cmd );
proxy_cmd_done( 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 static void
proxy_cancel_queued_cmds( proxy_store_t *ctx ) 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 // This would involve directly invoking the result callbacks with
// DRV_CANCEL, for which we'd need another set of dispatch functions. // DRV_CANCEL, for which we'd need another set of dispatch functions.
// The autotest doesn't need that, so save the effort. // 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 = cb;
cmd->callback_aux = aux; cmd->callback_aux = aux;
@assign_state@ @assign_state@
proxy_invoke( &cmd->gen, @checked@, "@name@" ); proxy_invoke( &cmd->gen, "@name@" );
} }
//# END //# 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_fake_cb_args , cmd->to_trash ? 0 : ctx->fake_nextuid++
//# DEFINE store_msg_counted 1 //# 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_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_print_pass_args , cmd->uid, fmt_flags( cmd->add ).str, fmt_flags( cmd->del ).str
//# DEFINE set_msg_flags_driable 1 //# 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_fake_cb_args , 0
//# DEFINE close_box_counted 1 //# DEFINE close_box_counted 1
//# DEFINE commit_cmds_print_args
proxy_flush_checked_cmds( ctx );
//# END
//# DEFINE cancel_cmds_print_cb_args //# DEFINE cancel_cmds_print_cb_args
proxy_cancel_queued_cmds( ctx ); proxy_cancel_queued_cmds( ctx );
//# END //# END
@ -465,7 +442,6 @@ proxy_alloc_store( store_t *real_ctx, const char *label, int force_async )
ctx->label = label; ctx->label = label;
ctx->force_async = force_async; ctx->force_async = force_async;
ctx->pending_cmds_append = &ctx->pending_cmds; ctx->pending_cmds_append = &ctx->pending_cmds;
ctx->check_cmds_append = &ctx->check_cmds;
ctx->real_driver = real_ctx->driver; ctx->real_driver = real_ctx->driver;
ctx->real_store = real_ctx; ctx->real_store = real_ctx;
ctx->real_driver->set_callbacks( ctx->real_store, ctx->real_driver->set_callbacks( ctx->real_store,

1
src/drv_proxy_gen.pl

@ -158,7 +158,6 @@ for (@ptypes) {
my $r_pass_args = make_args($r_cmd_args); my $r_pass_args = make_args($r_cmd_args);
$replace{'assign_state'} = $r_pass_args =~ s/([^,]+), /cmd->$1 = $1\;\n/gr; $replace{'assign_state'} = $r_pass_args =~ s/([^,]+), /cmd->$1 = $1\;\n/gr;
$replace{'checked'} = '0';
$template = "CALLBACK"; $template = "CALLBACK";
} else { } else {
$pass_args = make_args($cmd_args); $pass_args = make_args($cmd_args);

1
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++) { for (t = 0; t < 2; t++) {
svars->drv[t]->commit_cmds( svars->ctx[t] );
svars->state[t] |= ST_SENT_FLAGS; svars->state[t] |= ST_SENT_FLAGS;
msgs_flags_set( svars, t ); msgs_flags_set( svars, t );
if (check_cancel( svars )) if (check_cancel( svars ))

Loading…
Cancel
Save