Commit 7a2e56a3f6115c3a145e4f73d0aa8bea6dded899

Russell Belfer 2014-04-29T14:30:15

Get rid of redundant git_diff_options_init fn Since git_diff_init_options was introduced, remove this old fn.

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