@@ -155,6 +155,23 @@ int p_rename(const char *from, const char *to)
155155 return -1 ;
156156}
157157
158+ int p_fallocate (int fd , off_t offset , off_t len )
159+ {
160+ #ifdef __APPLE__
161+ fstore_t prealloc ;
162+
163+ memset (& prealloc , 0 , sizeof (prealloc ));
164+ prealloc .fst_flags = F_ALLOCATEALL ;
165+ prealloc .fst_posmode = F_PEOFPOSMODE ;
166+ prealloc .fst_offset = offset ;
167+ prealloc .fst_length = len ;
168+
169+ return fcntl (fd , F_PREALLOCATE , & prealloc );
170+ #else
171+ return posix_fallocate (fd , offset , len );
172+ #endif
173+ }
174+
158175#endif /* GIT_WIN32 */
159176
160177ssize_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)
216233 return 0 ;
217234}
218235
219- int p_fallocate (int fd , off_t offset , off_t len )
220- {
221- #ifdef __APPLE__
222- fstore_t prealloc ;
223-
224- memset (& prealloc , 0 , sizeof (prealloc ));
225- prealloc .fst_flags = F_ALLOCATEALL ;
226- prealloc .fst_posmode = F_PEOFPOSMODE ;
227- prealloc .fst_offset = offset ;
228- prealloc .fst_length = len ;
229-
230- return fcntl (fd , F_PREALLOCATE , & prealloc );
231- #else
232- return posix_fallocate (fd , offset , len );
233- #endif
234- }
235-
236236#ifdef NO_MMAP
237237
238238#include "map.h"
0 commit comments