From c2f18b9b068c20760bfce9cdc81ef4c13f3307b5 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 26 May 2016 10:51:16 -0500 Subject: [PATCH 1/5] cleanup: unused warning --- tests/checkout/typechange.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/checkout/typechange.c b/tests/checkout/typechange.c index c2949e3da..1efea931a 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, From 0d77a56f397b4d65bfcc0a5d66884dcac1ba7a16 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 26 May 2016 12:28:32 -0500 Subject: [PATCH 2/5] checkout: drop unused repo --- src/commit.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/commit.c b/src/commit.c index 79ddf2a63..99a80855c 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); From e3c42fee7732c9e06fde4f5a8942a454e4514319 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 26 May 2016 12:39:09 -0500 Subject: [PATCH 3/5] filebuf: fix uninitialized warning --- src/filebuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filebuf.c b/src/filebuf.c index 6eee530ee..582399470 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) { From 4505a42a23cfb55fcfd88d89d150686a78636805 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 26 May 2016 12:42:43 -0500 Subject: [PATCH 4/5] rebase: change assertion to avoid It looks like we're getting the operation and not doing anything with it, when in fact we are asserting that it's not null. Simply assert that we are within the operation boundary instead of using the `git_array_get` macro to do this for us. --- src/rebase.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/rebase.c b/src/rebase.c index 9f3b6ec6e..470e62a23 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) From 14cf05dae8e0555be439fd2ab797191cb7629df0 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 26 May 2016 12:52:29 -0500 Subject: [PATCH 5/5] win32: clean up unused warnings in DllMain --- src/global.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/global.c b/src/global.c index acca59985..e1836ee0f 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();