Commit d42e4d5f by Edward Thomson

transaction: use GIT_ASSERT

parent 9083a0e6
......@@ -57,7 +57,9 @@ struct git_transaction {
int git_transaction_config_new(git_transaction **out, git_config *cfg)
{
git_transaction *tx;
assert(out && cfg);
GIT_ASSERT_ARG(out);
GIT_ASSERT_ARG(cfg);
tx = git__calloc(1, sizeof(git_transaction));
GIT_ERROR_CHECK_ALLOC(tx);
......@@ -74,7 +76,8 @@ int git_transaction_new(git_transaction **out, git_repository *repo)
git_pool pool;
git_transaction *tx = NULL;
assert(out && repo);
GIT_ASSERT_ARG(out);
GIT_ASSERT_ARG(repo);
if ((error = git_pool_init(&pool, 1)) < 0)
goto on_error;
......@@ -109,7 +112,8 @@ int git_transaction_lock_ref(git_transaction *tx, const char *refname)
int error;
transaction_node *node;
assert(tx && refname);
GIT_ASSERT_ARG(tx);
GIT_ASSERT_ARG(refname);
node = git_pool_mallocz(&tx->pool, sizeof(transaction_node));
GIT_ERROR_CHECK_ALLOC(node);
......@@ -176,7 +180,9 @@ int git_transaction_set_target(git_transaction *tx, const char *refname, const g
int error;
transaction_node *node;
assert(tx && refname && target);
GIT_ASSERT_ARG(tx);
GIT_ASSERT_ARG(refname);
GIT_ASSERT_ARG(target);
if ((error = find_locked(&node, tx, refname)) < 0)
return error;
......@@ -195,7 +201,9 @@ int git_transaction_set_symbolic_target(git_transaction *tx, const char *refname
int error;
transaction_node *node;
assert(tx && refname && target);
GIT_ASSERT_ARG(tx);
GIT_ASSERT_ARG(refname);
GIT_ASSERT_ARG(target);
if ((error = find_locked(&node, tx, refname)) < 0)
return error;
......@@ -272,7 +280,9 @@ int git_transaction_set_reflog(git_transaction *tx, const char *refname, const g
int error;
transaction_node *node;
assert(tx && refname && reflog);
GIT_ASSERT_ARG(tx);
GIT_ASSERT_ARG(refname);
GIT_ASSERT_ARG(reflog);
if ((error = find_locked(&node, tx, refname)) < 0)
return error;
......@@ -320,7 +330,7 @@ int git_transaction_commit(git_transaction *tx)
transaction_node *node;
int error = 0;
assert(tx);
GIT_ASSERT_ARG(tx);
if (tx->type == TRANSACTION_CONFIG) {
error = git_config_unlock(tx->cfg, true);
......@@ -355,7 +365,8 @@ void git_transaction_free(git_transaction *tx)
transaction_node *node;
git_pool pool;
assert(tx);
if (!tx)
return;
if (tx->type == TRANSACTION_CONFIG) {
if (tx->cfg) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment