Commit aa5a92d121d4fcc56d9661ce1c76534b410784c7

Chris Young 2012-06-08T18:57:35

OS4 compatibility

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