summaryrefslogtreecommitdiff
path: root/src/diff.c
diff options
context:
space:
mode:
authorMatthew Bowen <matthew@mgbowen.com>2014-03-05 21:49:23 -0500
committerMatthew Bowen <matthew@mgbowen.com>2014-03-05 21:49:23 -0500
commitb9f819978c571cc806827e8b3ebc1a58a0755999 (patch)
tree64c94ef334360b064a3bdf9b6069c1422f727150 /src/diff.c
parenta064dc2d0b6206116a35be4b62c58c3c1170d5de (diff)
downloadlibgit2-b9f819978c571cc806827e8b3ebc1a58a0755999.tar.gz
Added function-based initializers for every options struct.
The basic structure of each function is courtesy of arrbee.
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/diff.c b/src/diff.c
index 151990ed6..dc7735f4f 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1413,3 +1413,27 @@ int git_diff__paired_foreach(
return error;
}
+
+int git_diff_init_options(git_diff_options* opts, int version)
+{
+ if (version != GIT_DIFF_OPTIONS_VERSION) {
+ giterr_set(GITERR_INVALID, "Invalid version %d for git_diff_options", version);
+ return -1;
+ } else {
+ git_diff_options o = GIT_DIFF_OPTIONS_INIT;
+ memcpy(opts, &o, sizeof(o));
+ return 0;
+ }
+}
+
+int git_diff_find_init_options(git_diff_find_options* opts, int version)
+{
+ if (version != GIT_DIFF_FIND_OPTIONS_VERSION) {
+ giterr_set(GITERR_INVALID, "Invalid version %d for git_diff_find_options", version);
+ return -1;
+ } else {
+ git_diff_find_options o = GIT_DIFF_FIND_OPTIONS_INIT;
+ memcpy(opts, &o, sizeof(o));
+ return 0;
+ }
+}