Get rid of redundant git_diff_options_init fn Since git_diff_init_options was introduced, remove this old fn.
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
diff --git a/include/git2/diff.h b/include/git2/diff.h
index afdb2c9..1888088 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -811,23 +811,6 @@ GIT_EXTERN(int) git_diff_find_similar(
git_diff *diff,
const git_diff_find_options *options);
-/**
- * Initialize diff options structure
- *
- * In most cases, you can probably just use `GIT_DIFF_OPTIONS_INIT` to
- * initialize the diff options structure, but in some cases that is not
- * going to work. You can call this function instead. Note that you
- * must pass both a pointer to the structure to be initialized and the
- * `GIT_DIFF_OPTIONS_VERSION` value from the header you compiled with.
- *
- * @param options Pointer to git_diff_options memory to be initialized
- * @param version Should be `GIT_DIFF_OPTIONS_VERSION`
- * @return 0 on success, negative on failure (such as unsupported version)
- */
-GIT_EXTERN(int) git_diff_options_init(
- git_diff_options *options,
- unsigned int version);
-
/**@}*/
diff --git a/src/diff.c b/src/diff.c
index 5a6b127..b34d153 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1282,20 +1282,6 @@ int git_diff_tree_to_workdir_with_index(
return error;
}
-int git_diff_options_init(git_diff_options *options, unsigned int version)
-{
- git_diff_options template = GIT_DIFF_OPTIONS_INIT;
-
- if (version != template.version) {
- giterr_set(GITERR_INVALID,
- "Invalid version %d for git_diff_options", (int)version);
- return -1;
- }
-
- memcpy(options, &template, sizeof(*options));
- return 0;
-}
-
size_t git_diff_num_deltas(const git_diff *diff)
{
assert(diff);
diff --git a/tests/diff/blob.c b/tests/diff/blob.c
index d1fff9c..5270079 100644
--- a/tests/diff/blob.c
+++ b/tests/diff/blob.c
@@ -26,7 +26,7 @@ void test_diff_blob__initialize(void)
g_repo = cl_git_sandbox_init("attr");
- cl_git_pass(git_diff_options_init(&opts, GIT_DIFF_OPTIONS_VERSION));
+ cl_git_pass(git_diff_init_options(&opts, GIT_DIFF_OPTIONS_VERSION));
opts.context_lines = 1;
memset(&expected, 0, sizeof(expected));
diff --git a/tests/diff/tree.c b/tests/diff/tree.c
index 582174b..6ab49fd 100644
--- a/tests/diff/tree.c
+++ b/tests/diff/tree.c
@@ -9,7 +9,7 @@ static diff_expects expect;
void test_diff_tree__initialize(void)
{
- cl_git_pass(git_diff_options_init(&opts, GIT_DIFF_OPTIONS_VERSION));
+ cl_git_pass(git_diff_init_options(&opts, GIT_DIFF_OPTIONS_VERSION));
memset(&expect, 0, sizeof(expect));