Skip to content

Commit

Permalink
virtual: Contexts are now required or checked
Browse files Browse the repository at this point in the history
Satisfies static analyzers
  • Loading branch information
cmouse authored and mrannanj committed Feb 20, 2018
1 parent fe1ec4b commit b230128
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/plugins/virtual/virtual-search.c
Expand Up @@ -123,7 +123,7 @@ virtual_search_init(struct mailbox_transaction_context *t,

int virtual_search_deinit(struct mail_search_context *ctx)
{
struct virtual_search_context *vctx = VIRTUAL_CONTEXT(ctx);
struct virtual_search_context *vctx = VIRTUAL_CONTEXT_REQUIRE(ctx);

array_free(&vctx->result);
array_free(&vctx->records);
Expand All @@ -134,7 +134,7 @@ int virtual_search_deinit(struct mail_search_context *ctx)
bool virtual_search_next_nonblock(struct mail_search_context *ctx,
struct mail **mail_r, bool *tryagain_r)
{
struct virtual_search_context *vctx = VIRTUAL_CONTEXT(ctx);
struct virtual_search_context *vctx = VIRTUAL_CONTEXT_REQUIRE(ctx);
struct index_search_context *ictx = (struct index_search_context *)ctx;
uint32_t seq;

Expand Down Expand Up @@ -180,7 +180,7 @@ static void search_args_set_full_match(struct mail_search_arg *args)

bool virtual_search_next_update_seq(struct mail_search_context *ctx)
{
struct virtual_search_context *vctx = VIRTUAL_CONTEXT(ctx);
struct virtual_search_context *vctx = VIRTUAL_CONTEXT_REQUIRE(ctx);
const struct virtual_search_record *recs;
unsigned int count;

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/virtual/virtual-storage.c
Expand Up @@ -24,7 +24,7 @@
#define VIRTUAL_DEFAULT_MAX_OPEN_MAILBOXES 64

#define VIRTUAL_BACKEND_CONTEXT(obj) \
MODULE_CONTEXT(obj, virtual_backend_storage_module)
MODULE_CONTEXT_REQUIRE(obj, virtual_backend_storage_module)

struct virtual_backend_mailbox {
union mailbox_module_context module_ctx;
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/virtual/virtual-storage.h
Expand Up @@ -10,6 +10,8 @@

#define VIRTUAL_CONTEXT(obj) \
MODULE_CONTEXT(obj, virtual_storage_module)
#define VIRTUAL_CONTEXT_REQUIRE(obj) \
MODULE_CONTEXT_REQUIRE(obj, virtual_storage_module)

struct virtual_save_context;

Expand Down

0 comments on commit b230128

Please sign in to comment.