From f79026b4912bcd2336667f4c1663c06e233f0b32 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Mon, 4 Jul 2011 11:43:34 +0200 Subject: fileops: Cleanup Cleaned up the structure of the whole OS-abstraction layer. fileops.c now contains a set of utility methods for file management used by the library. These are abstractions on top of the original POSIX calls. There's a new file called `posix.c` that contains emulations/reimplementations of all the POSIX calls the library uses. These are prefixed with `p_`. There's a specific posix file for each platform (win32 and unix). All the path-related methods have been moved from `utils.c` to `path.c` and have their own prefix. --- src/blob.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/blob.c') diff --git a/src/blob.c b/src/blob.c index 2e3c7b3b2..b8282e505 100644 --- a/src/blob.c +++ b/src/blob.c @@ -91,9 +91,9 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat if (repo->path_workdir == NULL) return git__throw(GIT_ENOTFOUND, "Failed to create blob. (No working directory found)"); - git__joinpath(full_path, repo->path_workdir, path); + git_path_join(full_path, repo->path_workdir, path); - error = gitfo_lstat(full_path, &st); + error = p_lstat(full_path, &st); if (error < 0) { return git__throw(GIT_EOSERR, "Failed to stat blob. %s", strerror(errno)); } @@ -102,12 +102,12 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat size = st.st_size; if (!islnk) - if ((fd = gitfo_open(full_path, O_RDONLY)) < 0) + if ((fd = p_open(full_path, O_RDONLY)) < 0) return git__throw(GIT_ENOTFOUND, "Failed to create blob. Could not open '%s'", full_path); if ((error = git_odb_open_wstream(&stream, repo->db, (size_t)size, GIT_OBJ_BLOB)) < GIT_SUCCESS) { if (!islnk) - gitfo_close(fd); + p_close(fd); return git__rethrow(error, "Failed to create blob"); } @@ -115,13 +115,13 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat ssize_t read_len; if (!islnk) - read_len = gitfo_read(fd, buffer, sizeof(buffer)); + read_len = p_read(fd, buffer, sizeof(buffer)); else - read_len = gitfo_readlink(full_path, buffer, sizeof(buffer)); + read_len = p_readlink(full_path, buffer, sizeof(buffer)); if (read_len < 0) { if (!islnk) - gitfo_close(fd); + p_close(fd); stream->free(stream); return git__throw(GIT_EOSERR, "Failed to create blob. Can't read full file"); } @@ -133,7 +133,7 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat error = stream->finalize_write(oid, stream); stream->free(stream); if (!islnk) - gitfo_close(fd); + p_close(fd); return error == GIT_SUCCESS ? GIT_SUCCESS : git__rethrow(error, "Failed to create blob"); } -- cgit v1.2.1