Ensure all the hcache backends clean up in the same way.
/**
* hcache_bdb_close - Implements HcacheOps::close()
*/
-static void hcache_bdb_close(void **vctx)
+static void hcache_bdb_close(void **ptr)
{
- if (!vctx || !*vctx)
+ if (!ptr || !*ptr)
return;
- struct HcacheDbCtx *ctx = *vctx;
+ struct HcacheDbCtx *db = *ptr;
- ctx->db->close(ctx->db, 0);
- ctx->env->close(ctx->env, 0);
- mutt_file_unlock(ctx->fd);
- close(ctx->fd);
- unlink(ctx->lockfile);
- FREE(vctx);
+ db->db->close(db->db, 0);
+ db->env->close(db->env, 0);
+ mutt_file_unlock(db->fd);
+ close(db->fd);
+ unlink(db->lockfile);
+ FREE(ptr);
}
/**
/**
* hcache_gdbm_close - Implements HcacheOps::close()
*/
-static void hcache_gdbm_close(void **ctx)
+static void hcache_gdbm_close(void **ptr)
{
- if (!ctx)
+ if (!ptr || !*ptr)
return;
- GDBM_FILE db = *ctx;
+ GDBM_FILE db = *ptr;
gdbm_close(db);
+ *ptr = NULL;
}
/**
/**
* hcache_kyotocabinet_close - Implements HcacheOps::close()
*/
-static void hcache_kyotocabinet_close(void **ctx)
+static void hcache_kyotocabinet_close(void **ptr)
{
- if (!ctx || !*ctx)
+ if (!ptr || !*ptr)
return;
- KCDB *db = *ctx;
+ KCDB *db = *ptr;
if (!kcdbclose(db))
{
int ecode = kcdbecode(db);
mutt_debug(LL_DEBUG2, "kcdbclose failed: %s (ecode %d)\n", kcdbemsg(db), ecode);
}
kcdbdel(db);
+ *ptr = NULL;
}
/**
/**
* hcache_lmdb_close - Implements HcacheOps::close()
*/
-static void hcache_lmdb_close(void **vctx)
+static void hcache_lmdb_close(void **ptr)
{
- if (!vctx || !*vctx)
+ if (!ptr || !*ptr)
return;
- struct HcacheLmdbCtx *ctx = *vctx;
+ struct HcacheLmdbCtx *db = *ptr;
- if (ctx->txn && (ctx->txn_mode == TXN_WRITE))
+ if (db->txn && (db->txn_mode == TXN_WRITE))
{
- mdb_txn_commit(ctx->txn);
- ctx->txn_mode = TXN_UNINITIALIZED;
- ctx->txn = NULL;
+ mdb_txn_commit(db->txn);
+ db->txn_mode = TXN_UNINITIALIZED;
+ db->txn = NULL;
}
- mdb_env_close(ctx->env);
- FREE(vctx);
+ mdb_env_close(db->env);
+ FREE(ptr);
}
/**
/**
* hcache_qdbm_close - Implements HcacheOps::close()
*/
-static void hcache_qdbm_close(void **ctx)
+static void hcache_qdbm_close(void **ptr)
{
- if (!ctx || !*ctx)
+ if (!ptr || !*ptr)
return;
- VILLA *db = *ctx;
+ VILLA *db = *ptr;
vlclose(db);
+ *ptr = NULL;
}
/**
/**
* hcache_tokyocabinet_close - Implements HcacheOps::close()
*/
-static void hcache_tokyocabinet_close(void **ctx)
+static void hcache_tokyocabinet_close(void **ptr)
{
- if (!ctx || !*ctx)
+ if (!ptr || !*ptr)
return;
- TCBDB *db = *ctx;
+ TCBDB *db = *ptr;
if (!tcbdbclose(db))
{
int ecode = tcbdbecode(db);
mutt_debug(LL_DEBUG2, "tcbdbclose failed: %s (ecode %d)\n", tcbdberrmsg(ecode), ecode);
}
tcbdbdel(db);
+ *ptr = NULL;
}
/**