Browse Source

prepend "get_" to getters in driver_t

this makes it callbacks consistently start with a verb.
wip/movedetect
Oswald Buddenhagen 8 years ago
parent
commit
d54809e268
  1. 4
      src/driver.h
  2. 12
      src/drv_imap.c
  3. 8
      src/drv_maildir.c
  4. 2
      src/main.c
  5. 2
      src/sync.c

4
src/driver.h

@ -259,10 +259,10 @@ struct driver {
void (*commit_cmds)( store_t *ctx ); void (*commit_cmds)( store_t *ctx );
/* Get approximate amount of memory occupied by the driver. */ /* Get approximate amount of memory occupied by the driver. */
int (*memory_usage)( store_t *ctx ); int (*get_memory_usage)( store_t *ctx );
/* Get the FAIL_* state of the driver. */ /* Get the FAIL_* state of the driver. */
int (*fail_state)( store_conf_t *conf ); int (*get_fail_state)( store_conf_t *conf );
}; };
void free_generic_messages( message_t * ); void free_generic_messages( message_t * );

12
src/drv_imap.c

@ -2875,20 +2875,20 @@ imap_commit_cmds( store_t *gctx )
(void)gctx; (void)gctx;
} }
/******************* imap_memory_usage *******************/ /******************* imap_get_memory_usage *******************/
static int static int
imap_memory_usage( store_t *gctx ) imap_get_memory_usage( store_t *gctx )
{ {
imap_store_t *ctx = (imap_store_t *)gctx; imap_store_t *ctx = (imap_store_t *)gctx;
return ctx->buffer_mem + ctx->conn.buffer_mem; return ctx->buffer_mem + ctx->conn.buffer_mem;
} }
/******************* imap_fail_state *******************/ /******************* imap_get_fail_state *******************/
static int static int
imap_fail_state( store_conf_t *gconf ) imap_get_fail_state( store_conf_t *gconf )
{ {
return ((imap_store_conf_t *)gconf)->server->failed; return ((imap_store_conf_t *)gconf)->server->failed;
} }
@ -3208,6 +3208,6 @@ struct driver imap_driver = {
imap_close_box, imap_close_box,
imap_cancel_cmds, imap_cancel_cmds,
imap_commit_cmds, imap_commit_cmds,
imap_memory_usage, imap_get_memory_usage,
imap_fail_state, imap_get_fail_state,
}; };

8
src/drv_maildir.c

@ -1796,13 +1796,13 @@ maildir_commit_cmds( store_t *gctx )
} }
static int static int
maildir_memory_usage( store_t *gctx ATTR_UNUSED ) maildir_get_memory_usage( store_t *gctx ATTR_UNUSED )
{ {
return 0; return 0;
} }
static int static int
maildir_fail_state( store_conf_t *gconf ) maildir_get_fail_state( store_conf_t *gconf )
{ {
return ((maildir_store_conf_t *)gconf)->failed; return ((maildir_store_conf_t *)gconf)->failed;
} }
@ -1890,6 +1890,6 @@ struct driver maildir_driver = {
maildir_close_box, maildir_close_box,
maildir_cancel_cmds, maildir_cancel_cmds,
maildir_commit_cmds, maildir_commit_cmds,
maildir_memory_usage, maildir_get_memory_usage,
maildir_fail_state, maildir_get_fail_state,
}; };

2
src/main.c

@ -800,7 +800,7 @@ sync_chans( main_vars_t *mvars, int ent )
info( "Channel %s\n", mvars->chan->name ); info( "Channel %s\n", mvars->chan->name );
mvars->skip = mvars->cben = 0; mvars->skip = mvars->cben = 0;
for (t = 0; t < 2; t++) { for (t = 0; t < 2; t++) {
int st = mvars->chan->stores[t]->driver->fail_state( mvars->chan->stores[t] ); int st = mvars->chan->stores[t]->driver->get_fail_state( mvars->chan->stores[t] );
if (st != FAIL_TEMP) { if (st != FAIL_TEMP) {
info( "Skipping due to %sfailed %s store %s.\n", info( "Skipping due to %sfailed %s store %s.\n",
(st == FAIL_WAIT) ? "temporarily " : "", str_ms[t], mvars->chan->stores[t]->name ); (st == FAIL_WAIT) ? "temporarily " : "", str_ms[t], mvars->chan->stores[t]->name );

2
src/sync.c

@ -1881,7 +1881,7 @@ msgs_copied( sync_vars_t *svars, int t )
if (!(svars->state[t] & ST_SENT_NEW)) { if (!(svars->state[t] & ST_SENT_NEW)) {
for (tmsg = svars->new_msgs[t]; tmsg; tmsg = tmsg->next) { for (tmsg = svars->new_msgs[t]; tmsg; tmsg = tmsg->next) {
if ((srec = tmsg->srec) && srec->tuid[0]) { if ((srec = tmsg->srec) && srec->tuid[0]) {
if (svars->drv[t]->memory_usage( svars->ctx[t] ) >= BufferLimit) { if (svars->drv[t]->get_memory_usage( svars->ctx[t] ) >= BufferLimit) {
svars->new_msgs[t] = tmsg; svars->new_msgs[t] = tmsg;
goto out; goto out;
} }

Loading…
Cancel
Save