OS4 compatibility
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
diff --git a/include/git2/common.h b/include/git2/common.h
index 4e6c2a5..b692c67 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -107,6 +107,8 @@ GIT_EXTERN(int) git_strarray_copy(git_strarray *tgt, const git_strarray *src);
*/
GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev);
+GIT_EXTERN(int) p_fnmatch(const char *pattern, const char *string, int flags);
+
/** @} */
GIT_END_DECL
#endif
diff --git a/src/path.c b/src/path.c
index 84edf6d..056b6b9 100644
--- a/src/path.c
+++ b/src/path.c
@@ -512,7 +512,7 @@ int git_path_direach(
de_buf = git__malloc(sizeof(struct dirent));
#endif
- while (p_readdir_r(dir, de_buf, &de) == 0 && de != NULL) {
+ while (p_readdir_r(dir, de_buf, de) == 0 && de != NULL) {
int result;
if (is_dot_or_dotdot(de->d_name))
@@ -570,7 +570,7 @@ int git_path_dirload(
path_len -= prefix_len;
need_slash = (path_len > 0 && path[path_len-1] != '/') ? 1 : 0;
- while ((error = p_readdir_r(dir, de_buf, &de)) == 0 && de != NULL) {
+ while ((error = p_readdir_r(dir, de_buf, de)) == 0 && de != NULL) {
char *entry_path;
size_t entry_len;
diff --git a/src/posix.h b/src/posix.h
index d020d94..8e8b394 100644
--- a/src/posix.h
+++ b/src/posix.h
@@ -74,6 +74,10 @@ typedef SOCKET GIT_SOCKET;
# include "unix/posix.h"
#endif
-#define p_readdir_r(d,e,r) readdir_r(d,e,r)
+#ifndef __amigaos4__
+#define p_readdir_r(d,e,r) readdir_r(d,e,&r)
+#else
+#define p_readdir_r(d,e,r) r = readdir(d)
+#endif
#endif