Skip to content

Commit b8ab782

Browse files
committed
attrcache: do not lock/unlock the mutex directly
Improve encapsulation by not referencing the attrcache mutex directly but instead using the `attr_cache_lock` and `attr_cache_unlock` functions.
1 parent b13f0da commit b8ab782

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/attrcache.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ static void attr_cache__free(git_attr_cache *cache)
309309
if (!cache)
310310
return;
311311

312-
unlock = (git_mutex_lock(&cache->lock) == 0);
312+
unlock = (attr_cache_lock(cache) == 0);
313313

314314
if (cache->files != NULL) {
315315
git_attr_file_entry *entry;
@@ -345,7 +345,7 @@ static void attr_cache__free(git_attr_cache *cache)
345345
cache->cfg_excl_file = NULL;
346346

347347
if (unlock)
348-
git_mutex_unlock(&cache->lock);
348+
attr_cache_unlock(cache);
349349
git_mutex_free(&cache->lock);
350350

351351
git__free(cache);
@@ -429,7 +429,7 @@ int git_attr_cache__insert_macro(git_repository *repo, git_attr_rule *macro)
429429
if (macro->assigns.length == 0)
430430
return 0;
431431

432-
if (git_mutex_lock(&cache->lock) < 0) {
432+
if (attr_cache_lock(cache) < 0) {
433433
giterr_set(GITERR_OS, "unable to get attr cache lock");
434434
error = -1;
435435
} else {

0 commit comments

Comments
 (0)