Rename posix wrappers with 'p_' prefix.
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
diff --git a/src/date.c b/src/date.c
index 5529dc2..658b09e 100644
--- a/src/date.c
+++ b/src/date.c
@@ -271,7 +271,7 @@ static int match_multi_number(unsigned long num, char c, const char *date, char
case '.':
now = time(NULL);
refuse_future = NULL;
- if (gmtime_r(&now, &now_tm))
+ if (p_gmtime_r(&now, &now_tm))
refuse_future = &now_tm;
if (num > 70) {
@@ -334,7 +334,7 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
*/
if (num >= 100000000 && nodate(tm)) {
time_t time = num;
- if (gmtime_r(&time, tm)) {
+ if (p_gmtime_r(&time, tm)) {
*tm_gmt = 1;
return end - date;
}
@@ -561,7 +561,7 @@ static git_time_t update_tm(struct tm *tm, struct tm *now, unsigned long sec)
}
n = mktime(tm) - sec;
- localtime_r(&n, tm);
+ p_localtime_r(&n, tm);
return n;
}
@@ -639,7 +639,7 @@ static void date_never(struct tm *tm, struct tm *now, int *num)
time_t n = 0;
GIT_UNUSED(now);
GIT_UNUSED(num);
- localtime_r(&n, tm);
+ p_localtime_r(&n, tm);
}
static const struct special {
@@ -832,7 +832,7 @@ static git_time_t approxidate_str(const char *date,
time_t time_sec;
time_sec = tv->tv_sec;
- localtime_r(&time_sec, &tm);
+ p_localtime_r(&time_sec, &tm);
now = tm;
tm.tm_year = -1;
@@ -870,7 +870,7 @@ int git__date_parse(git_time_t *out, const char *date)
return 0;
}
- gettimeofday(&tv, NULL);
+ p_gettimeofday(&tv, NULL);
*out = approxidate_str(date, &tv, &error_ret);
return error_ret;
}
diff --git a/src/posix.h b/src/posix.h
index d020d94..3f52f9b 100644
--- a/src/posix.h
+++ b/src/posix.h
@@ -59,9 +59,17 @@ extern int p_rename(const char *from, const char *to);
typedef int GIT_SOCKET;
#define INVALID_SOCKET -1
+#define p_localtime_r localtime_r
+#define p_gmtime_r gmtime_r
+#define p_gettimeofday gettimeofday
+
#else
typedef SOCKET GIT_SOCKET;
+extern struct tm * p_localtime_r (const time_t *timer, struct tm *result);
+extern struct tm * p_gmtime_r (const time_t *timer, struct tm *result);
+extern int p_gettimeofday(struct timeval *tv, struct timezone *tz);
+
#endif
diff --git a/src/signature.c b/src/signature.c
index 6b28a3e..332bdf6 100644
--- a/src/signature.c
+++ b/src/signature.c
@@ -119,8 +119,8 @@ int git_signature_now(git_signature **sig_out, const char *name, const char *ema
time(&now);
- utc_tm = gmtime_r(&now, &_utc);
- local_tm = localtime_r(&now, &_local);
+ utc_tm = p_gmtime_r(&now, &_utc);
+ local_tm = p_localtime_r(&now, &_local);
offset = mktime(local_tm) - mktime(utc_tm);
offset /= 60;
diff --git a/src/win32/posix.h b/src/win32/posix.h
index c38caa8..baa4a3b 100644
--- a/src/win32/posix.h
+++ b/src/win32/posix.h
@@ -52,8 +52,4 @@ extern int p_rename(const char *from, const char *to);
extern int p_recv(GIT_SOCKET socket, void *buffer, size_t length, int flags);
extern int p_send(GIT_SOCKET socket, const void *buffer, size_t length, int flags);
-extern struct tm * localtime_r (const time_t *timer, struct tm *result);
-extern struct tm * gmtime_r (const time_t *timer, struct tm *result);
-extern int gettimeofday(struct timeval *tv, struct timezone *tz);
-
#endif
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index 092bafe..f0441df 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -476,7 +476,7 @@ int p_send(GIT_SOCKET socket, const void *buffer, size_t length, int flags)
* On Win32, `gmtime_r` doesn't exist but `gmtime` is threadsafe, so we can use that
*/
struct tm *
-localtime_r (const time_t *timer, struct tm *result)
+p_localtime_r (const time_t *timer, struct tm *result)
{
struct tm *local_result;
local_result = localtime (timer);
@@ -488,7 +488,7 @@ localtime_r (const time_t *timer, struct tm *result)
return result;
}
struct tm *
-gmtime_r (const time_t *timer, struct tm *result)
+p_gmtime_r (const time_t *timer, struct tm *result)
{
struct tm *local_result;
local_result = gmtime (timer);
@@ -512,7 +512,7 @@ struct timezone
int tz_dsttime; /* type of dst correction */
};
-int gettimeofday(struct timeval *tv, struct timezone *tz)
+int p_gettimeofday(struct timeval *tv, struct timezone *tz)
{
FILETIME ft;
unsigned __int64 tmpres = 0;