opts: Add getters too
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
diff --git a/include/git2/common.h b/include/git2/common.h
index 7e7c7e3..7066d5e 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -125,8 +125,10 @@ GIT_EXTERN(int) git_libgit2_capabilities(void);
enum {
- GIT_OPT_MWINDOW_SIZE,
- GIT_OPT_MWINDOW_MAPPED_LIMIT
+ GIT_OPT_GET_MWINDOW_SIZE,
+ GIT_OPT_SET_MWINDOW_SIZE,
+ GIT_OPT_GET_MWINDOW_MAPPED_LIMIT,
+ GIT_OPT_SET_MWINDOW_MAPPED_LIMIT
};
/**
diff --git a/src/util.c b/src/util.c
index 243748a..085b627 100644
--- a/src/util.c
+++ b/src/util.c
@@ -45,13 +45,21 @@ void git_libgit2_opts(int key, ...)
va_start(ap, key);
switch(key) {
- case GIT_OPT_MWINDOW_SIZE:
+ case GIT_OPT_SET_MWINDOW_SIZE:
git_mwindow__window_size = va_arg(ap, size_t);
break;
- case GIT_OPT_MWINDOW_MAPPED_LIMIT:
+ case GIT_OPT_GET_MWINDOW_SIZE:
+ *(va_arg(ap, size_t *)) = git_mwindow__window_size;
+ break;
+
+ case GIT_OPT_SET_MWINDOW_MAPPED_LIMIT:
git_mwindow__mapped_limit = va_arg(ap, size_t);
break;
+
+ case GIT_OPT_GET_MWINDOW_MAPPED_LIMIT:
+ *(va_arg(ap, size_t *)) = git_mwindow__mapped_limit;
+ break;
}
va_end(ap);