Skip to content

Commit

Permalink
dict: Set default transaction commit callback
Browse files Browse the repository at this point in the history
Removes need for NULL check on drivers
  • Loading branch information
cmouse committed May 13, 2016
1 parent 2576153 commit 75a7ba7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib-dict/dict.c
Expand Up @@ -22,6 +22,13 @@ static struct dict *dict_driver_lookup(const char *name)
return NULL;
}

static
void dict_transaction_commit_default_callback(const struct dict_commit_result *result ATTR_UNUSED,
void *context ATTR_UNUSED)
{
/* do nothing */
}

void dict_driver_register(struct dict *driver)
{
if (!array_is_created(&dict_drivers))
Expand Down Expand Up @@ -225,6 +232,8 @@ void dict_transaction_commit_async(struct dict_transaction_context **_ctx,
struct dict_transaction_context *ctx = *_ctx;

*_ctx = NULL;
if (callback == NULL)
callback = dict_transaction_commit_default_callback;
ctx->dict->v.transaction_commit(ctx, TRUE, callback, context);
}

Expand Down

0 comments on commit 75a7ba7

Please sign in to comment.