Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-03-13 09:55:40 +0400
committerRussell Belfer <arrbee@arrbee.com>2012-03-13 09:55:40 +0400
commite1de726c15937a8dbf81d12ef0c872cf6576ebd0 (patch)
tree84b437dd23e8250b0a4f983875fb3849569ad63a /src/mwindow.c
parentdda708e78f3c3f43d814d46c29ab9f2b9d47ed5c (diff)
Migrate ODB files to new error handling
This migrates odb.c, odb_loose.c, odb_pack.c and pack.c to the new style of error handling. Also got the unix and win32 versions of map.c. There are some minor changes to other files but no others were completely converted. This also contains an update to filebuf so that a zeroed out filebuf will not think that the fd (== 0) is actually open (and inadvertently call close() on fd 0 if cleaned up). Lastly, this was built and tested on win32 and contains a bunch of fixes for the win32 build which was pretty broken.
Diffstat (limited to 'src/mwindow.c')
-rw-r--r--src/mwindow.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/mwindow.c b/src/mwindow.c
index 39f6aeacc..e3de0709c 100644
--- a/src/mwindow.c
+++ b/src/mwindow.c
@@ -178,8 +178,10 @@ static git_mwindow *new_window(
* window.
*/
- if (git_futils_mmap_ro(&w->window_map, fd, w->offset, (size_t)len) < GIT_SUCCESS)
- goto cleanup;
+ if (git_futils_mmap_ro(&w->window_map, fd, w->offset, (size_t)len) < 0) {
+ git__free(w);
+ return NULL;
+ }
ctl->mmap_calls++;
ctl->open_windows++;
@@ -191,10 +193,6 @@ static git_mwindow *new_window(
ctl->peak_open_windows = ctl->open_windows;
return w;
-
-cleanup:
- git__free(w);
- return NULL;
}
/*
@@ -253,11 +251,10 @@ unsigned char *git_mwindow_open(
int git_mwindow_file_register(git_mwindow_file *mwf)
{
git_mwindow_ctl *ctl = &GIT_GLOBAL->mem_ctl;
- int error;
if (ctl->windowfiles.length == 0 &&
- (error = git_vector_init(&ctl->windowfiles, 8, NULL)) < GIT_SUCCESS)
- return error;
+ git_vector_init(&ctl->windowfiles, 8, NULL) < 0)
+ return -1;
return git_vector_insert(&ctl->windowfiles, mwf);
}