vendor/libgit2/src/transaction.c in rugged-0.28.5 vs vendor/libgit2/src/transaction.c in rugged-0.99.0
- old
+ new
@@ -82,11 +82,11 @@
if (!tx) {
error = -1;
goto on_error;
}
- if ((error = git_strmap_alloc(&tx->locks)) < 0) {
+ if ((error = git_strmap_new(&tx->locks)) < 0) {
error = -1;
goto on_error;
}
if ((error = git_repository_refdb(&tx->db, repo)) < 0)
@@ -117,12 +117,11 @@
GIT_ERROR_CHECK_ALLOC(node->name);
if ((error = git_refdb_lock(&node->payload, tx->db, refname)) < 0)
return error;
- git_strmap_insert(tx->locks, node->name, node, &error);
- if (error < 0)
+ if ((error = git_strmap_set(tx->locks, node->name, node)) < 0)
goto cleanup;
return 0;
cleanup:
@@ -132,18 +131,14 @@
}
static int find_locked(transaction_node **out, git_transaction *tx, const char *refname)
{
transaction_node *node;
- size_t pos;
- pos = git_strmap_lookup_index(tx->locks, refname);
- if (!git_strmap_valid_index(tx->locks, pos)) {
+ if ((node = git_strmap_get(tx->locks, refname)) == NULL) {
git_error_set(GIT_ERROR_REFERENCE, "the specified reference is not locked");
return GIT_ENOTFOUND;
}
-
- node = git_strmap_value_at(tx->locks, pos);
*out = node;
return 0;
}