Commit a0f777c87f1dca716ef71fbd378de86ab1bafeba

Vicent Marti 2013-01-23T23:44:34

opts: Add getters too

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);