summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-02-22 11:32:01 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2019-02-22 14:41:29 +0000
commit7ab7bf46b8675c8f5981daabe7e8a4591676d0d1 (patch)
tree6f4d14e4b0e84406f31d812b9e5d8596a960cc8f
parent32f50452073c2cb76b36428017d7f547ef39791b (diff)
downloadlibgit2-7ab7bf46b8675c8f5981daabe7e8a4591676d0d1.tar.gz
p_fallocate: don't duplicate definitions for win32
-rw-r--r--src/posix.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/posix.c b/src/posix.c
index ef48c6012..242fda8c6 100644
--- a/src/posix.c
+++ b/src/posix.c
@@ -155,6 +155,23 @@ int p_rename(const char *from, const char *to)
return -1;
}
+int p_fallocate(int fd, off_t offset, off_t len)
+{
+#ifdef __APPLE__
+ fstore_t prealloc;
+
+ memset(&prealloc, 0, sizeof(prealloc));
+ prealloc.fst_flags = F_ALLOCATEALL;
+ prealloc.fst_posmode = F_PEOFPOSMODE;
+ prealloc.fst_offset = offset;
+ prealloc.fst_length = len;
+
+ return fcntl(fd, F_PREALLOCATE, &prealloc);
+#else
+ return posix_fallocate(fd, offset, len);
+#endif
+}
+
#endif /* GIT_WIN32 */
ssize_t p_read(git_file fd, void *buf, size_t cnt)
@@ -216,23 +233,6 @@ int p_write(git_file fd, const void *buf, size_t cnt)
return 0;
}
-int p_fallocate(int fd, off_t offset, off_t len)
-{
-#ifdef __APPLE__
- fstore_t prealloc;
-
- memset(&prealloc, 0, sizeof(prealloc));
- prealloc.fst_flags = F_ALLOCATEALL;
- prealloc.fst_posmode = F_PEOFPOSMODE;
- prealloc.fst_offset = offset;
- prealloc.fst_length = len;
-
- return fcntl(fd, F_PREALLOCATE, &prealloc);
-#else
- return posix_fallocate(fd, offset, len);
-#endif
-}
-
#ifdef NO_MMAP
#include "map.h"