summaryrefslogtreecommitdiff
path: root/src/unix
diff options
context:
space:
mode:
authorJacques Germishuys <jacquesg@striata.com>2014-07-12 14:45:56 +0200
committerJacques Germishuys <jacquesg@striata.com>2014-08-05 20:51:59 +0200
commit2f795d8fc50d81641d95723d9ddd92795886bed3 (patch)
tree906e6feb62306a9ee2aaaf3abc3aa1f15645c7ba /src/unix
parentd07fd4425f654825099729e1caa2b3b25341a91d (diff)
downloadlibgit2-2f795d8fc50d81641d95723d9ddd92795886bed3.tar.gz
Cleanup portability/compatibility layer
* Removes mingw-compat.h * Cleans up separation of compiler/platform idiosyncrasies * Unifies mingw/msvc stat structures and functions * (Tries to) hide more compiler specific implementation details (even in our internal API)
Diffstat (limited to 'src/unix')
-rw-r--r--src/unix/posix.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/unix/posix.h b/src/unix/posix.h
index ccdc7536e..0c8732aff 100644
--- a/src/unix/posix.h
+++ b/src/unix/posix.h
@@ -10,7 +10,16 @@
#include <stdio.h>
#include <sys/param.h>
+typedef int GIT_SOCKET;
+#define INVALID_SOCKET -1
+
+#define p_strcasecmp(s1, s2) strcasecmp(s1, s2)
+#define p_strncasecmp(s1, s2, c) strncasecmp(s1, s2, c)
+
+#define p_lseek(f,n,w) lseek(f, n, w)
+#define p_fstat(f,b) fstat(f, b)
#define p_lstat(p,b) lstat(p,b)
+
#define p_readlink(a, b, c) readlink(a, b, c)
#define p_symlink(o,n) symlink(o, n)
#define p_link(o,n) link(o, n)
@@ -18,6 +27,10 @@
#define p_mkdir(p,m) mkdir(p, m)
#define p_fsync(fd) fsync(fd)
+#define p_recv(s,b,l,f) recv(s,b,l,f)
+#define p_send(s,b,l,f) send(s,b,l,f)
+#define p_inet_pton(a, b, c) inet_pton(a, b, c)
+
/* The OpenBSD realpath function behaves differently */
#if !defined(__OpenBSD__)
# define p_realpath(p, po) realpath(p, po)
@@ -28,9 +41,17 @@ char *p_realpath(const char *, char *);
#define p_vsnprintf(b, c, f, a) vsnprintf(b, c, f, a)
#define p_snprintf(b, c, f, ...) snprintf(b, c, f, __VA_ARGS__)
#define p_mkstemp(p) mkstemp(p)
-#define p_inet_pton(a, b, c) inet_pton(a, b, c)
+#define p_stat(p,b) stat(p, b)
+#define p_chdir(p) chdir(p)
+#define p_chmod(p,m) chmod(p, m)
+#define p_rmdir(p) rmdir(p)
+#define p_access(p,m) access(p,m)
+#define p_ftruncate(fd, sz) ftruncate(fd, sz)
/* see win32/posix.h for explanation about why this exists */
#define p_lstat_posixly(p,b) lstat(p,b)
+#define p_localtime_r(c, r) localtime_r(c, r)
+#define p_gmtime_r(c, r) gmtime_r(c, r)
+
#endif