diff options
author | Patrick Steinhardt <ps@pks.im> | 2017-02-21 11:43:32 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2017-02-21 16:17:31 +0100 |
commit | b8ab782a6dc206101d78852036a8e86d5b812278 (patch) | |
tree | 5310734f1a6c45b9225f07b59294a1488f0a9877 | |
parent | b13f0da153aa47fbf113c44e734be2be603870b6 (diff) | |
download | libgit2-b8ab782a6dc206101d78852036a8e86d5b812278.tar.gz |
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.
-rw-r--r-- | src/attrcache.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/attrcache.c b/src/attrcache.c index 6cac14bc3..d460db80c 100644 --- a/src/attrcache.c +++ b/src/attrcache.c @@ -309,7 +309,7 @@ static void attr_cache__free(git_attr_cache *cache) if (!cache) return; - unlock = (git_mutex_lock(&cache->lock) == 0); + unlock = (attr_cache_lock(cache) == 0); if (cache->files != NULL) { git_attr_file_entry *entry; @@ -345,7 +345,7 @@ static void attr_cache__free(git_attr_cache *cache) cache->cfg_excl_file = NULL; if (unlock) - git_mutex_unlock(&cache->lock); + attr_cache_unlock(cache); git_mutex_free(&cache->lock); git__free(cache); @@ -429,7 +429,7 @@ int git_attr_cache__insert_macro(git_repository *repo, git_attr_rule *macro) if (macro->assigns.length == 0) return 0; - if (git_mutex_lock(&cache->lock) < 0) { + if (attr_cache_lock(cache) < 0) { giterr_set(GITERR_OS, "unable to get attr cache lock"); error = -1; } else { |