Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-04-12 23:44:51 +0400
committerVicent Marti <tanoku@gmail.com>2013-04-22 18:50:51 +0400
commitb12b72ea82776bbbd4296eeac1376055b0487edf (patch)
tree193ea7ff5f0a026c6157663cc9e181df3c3da364 /src/util.c
parentbadd85a61354ef7b62c5f8e53d740738e5ef1e57 (diff)
Add range checking around cache opts
Add a git_cache_set_max_object_size method that does more checking around setting the max object size. Also add a git_cache_size to read the number of objects currently in the cache. This makes it easier to write tests.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c
index 0b5fbdc5a..1ed5d5d16 100644
--- a/src/util.c
+++ b/src/util.c
@@ -95,14 +95,16 @@ int git_libgit2_opts(int key, ...)
error = git_futils_dirs_set(error, va_arg(ap, const char *));
break;
- case GIT_OPT_SET_CACHE_LIMIT: {
+ case GIT_OPT_SET_CACHE_LIMIT:
+ {
git_otype type = (git_otype)va_arg(ap, int);
- git_cache__max_object_size[type] = va_arg(ap, size_t);
+ size_t size = va_arg(ap, size_t);
+ error = git_cache_set_max_object_size(type, size);
break;
}
case GIT_OPT_ENABLE_CACHING:
- git_cache__enabled = va_arg(ap, int);
+ git_cache__enabled = (va_arg(ap, int) != 0);
break;
}