p_fallocate: don't duplicate definitions for win32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
diff --git a/src/posix.c b/src/posix.c
index ef48c60..242fda8 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"