summaryrefslogtreecommitdiff
path: root/src/mwindow.c
diff options
context:
space:
mode:
authorScott J. Goldman <scottjg@github.com>2013-01-05 18:20:42 -0800
committerScott J. Goldman <scottjg@github.com>2013-01-05 18:27:24 -0800
commitf9b55bcb5f9fd8c41c74d4be58ebaad13aa9b7f3 (patch)
tree31f8fe78d1f215cd3ce34b3a1e2adaf79daf113b /src/mwindow.c
parentd74b1bc5292a438d68d802082825cbf3a6661074 (diff)
downloadlibgit2-f9b55bcb5f9fd8c41c74d4be58ebaad13aa9b7f3.tar.gz
git_mwindow_file_deregister() shouldn't return errors
As a function that appears to only be called on error paths, I don't think it makes sense for it to return an error, or clobber the global giterr. Note that no existing callsites actually check the return code. In my own application, there are errors where the real error ends up being hidden, as git_mwindow_file_deregister() clobbers the global giterr. I'm not sure this error is even relevant?
Diffstat (limited to 'src/mwindow.c')
-rw-r--r--src/mwindow.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/mwindow.c b/src/mwindow.c
index ee693e4a0..64eba01b9 100644
--- a/src/mwindow.c
+++ b/src/mwindow.c
@@ -293,28 +293,23 @@ int git_mwindow_file_register(git_mwindow_file *mwf)
return ret;
}
-int git_mwindow_file_deregister(git_mwindow_file *mwf)
+void git_mwindow_file_deregister(git_mwindow_file *mwf)
{
git_mwindow_ctl *ctl = &mem_ctl;
git_mwindow_file *cur;
unsigned int i;
- if (git_mutex_lock(&git__mwindow_mutex)) {
- giterr_set(GITERR_THREAD, "unable to lock mwindow mutex");
- return -1;
- }
+ if (git_mutex_lock(&git__mwindow_mutex))
+ return;
git_vector_foreach(&ctl->windowfiles, i, cur) {
if (cur == mwf) {
git_vector_remove(&ctl->windowfiles, i);
git_mutex_unlock(&git__mwindow_mutex);
- return 0;
+ return;
}
}
git_mutex_unlock(&git__mwindow_mutex);
-
- giterr_set(GITERR_ODB, "Failed to find the memory window file to deregister");
- return -1;
}
void git_mwindow_close(git_mwindow **window)