Commit efb432c9b9d65c53ba12293423090810e820b178

Edward Thomson 2016-06-01T11:05:45

Merge pull request #3801 from ethomson/warning cleanup: unused warning

diff --git a/src/commit.c b/src/commit.c
index 79ddf2a..99a8085 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -40,7 +40,6 @@ void git_commit__free(void *_commit)
 
 static int git_commit__create_buffer_internal(
 	git_buf *out,
-	git_repository *repo,
 	const git_signature *author,
 	const git_signature *committer,
 	const char *message_encoding,
@@ -51,7 +50,7 @@ static int git_commit__create_buffer_internal(
 	size_t i = 0;
 	const git_oid *parent;
 
-	assert(out && repo && tree);
+	assert(out && tree);
 
 	git_oid__writebuf(out, "tree ", tree);
 
@@ -150,7 +149,7 @@ static int git_commit__create_internal(
 	if ((error = validate_tree_and_parents(&parents, repo, tree, parent_cb, parent_payload, current_id, validate)) < 0)
 		goto cleanup;
 
-	error = git_commit__create_buffer_internal(&buf, repo, author, committer,
+	error = git_commit__create_buffer_internal(&buf, author, committer,
 						   message_encoding, message, tree,
 						   &parents);
 
@@ -813,7 +812,7 @@ int git_commit_create_buffer(git_buf *out,
 		return error;
 
 	error = git_commit__create_buffer_internal(
-		out, repo, author, committer,
+		out, author, committer,
 		message_encoding, message, tree_id,
 		&parents_arr);
 
diff --git a/src/filebuf.c b/src/filebuf.c
index 6eee530..5823994 100644
--- a/src/filebuf.c
+++ b/src/filebuf.c
@@ -70,7 +70,7 @@ static int lock_file(git_filebuf *file, int flags, mode_t mode)
 		git_file source;
 		char buffer[FILEIO_BUFSIZE];
 		ssize_t read_bytes;
-		int error;
+		int error = 0;
 
 		source = p_open(file->path_original, O_RDONLY);
 		if (source < 0) {
diff --git a/src/global.c b/src/global.c
index acca599..e1836ee 100644
--- a/src/global.c
+++ b/src/global.c
@@ -228,6 +228,9 @@ void git__free_tls_data(void)
 
 BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved)
 {
+	GIT_UNUSED(hInstDll);
+	GIT_UNUSED(lpvReserved);
+
 	/* This is how Windows lets us know our thread is being shut down */
 	if (fdwReason == DLL_THREAD_DETACH) {
 		git__free_tls_data();
diff --git a/src/rebase.c b/src/rebase.c
index 9f3b6ec..470e62a 100644
--- a/src/rebase.c
+++ b/src/rebase.c
@@ -1047,15 +1047,12 @@ static int rebase_commit_inmemory(
 	const char *message_encoding,
 	const char *message)
 {
-	git_rebase_operation *operation;
 	git_commit *commit = NULL;
 	int error = 0;
 
-	operation = git_array_get(rebase->operations, rebase->current);
-
-	assert(operation);
 	assert(rebase->index);
 	assert(rebase->last_commit);
+	assert(rebase->current < rebase->operations.size);
 
 	if ((error = rebase_commit__create(&commit, rebase, rebase->index,
 		rebase->last_commit, author, committer, message_encoding, message)) < 0)
diff --git a/tests/checkout/typechange.c b/tests/checkout/typechange.c
index c2949e3..1efea93 100644
--- a/tests/checkout/typechange.c
+++ b/tests/checkout/typechange.c
@@ -229,6 +229,9 @@ static int make_submodule_dirty(git_submodule *sm, const char *name, void *paylo
 	git_buf dirtypath = GIT_BUF_INIT;
 	git_repository *submodule_repo;
 
+	GIT_UNUSED(name);
+	GIT_UNUSED(payload);
+
 	/* remove submodule directory in preparation for init and repo_init */
 	cl_git_pass(git_buf_joinpath(
 		&submodulepath,