Commit 9ecf860d by Ben Straub

Rename posix wrappers with 'p_' prefix.

parent 1a728066
...@@ -271,7 +271,7 @@ static int match_multi_number(unsigned long num, char c, const char *date, char ...@@ -271,7 +271,7 @@ static int match_multi_number(unsigned long num, char c, const char *date, char
case '.': case '.':
now = time(NULL); now = time(NULL);
refuse_future = NULL; refuse_future = NULL;
if (gmtime_r(&now, &now_tm)) if (p_gmtime_r(&now, &now_tm))
refuse_future = &now_tm; refuse_future = &now_tm;
if (num > 70) { if (num > 70) {
...@@ -334,7 +334,7 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt ...@@ -334,7 +334,7 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
*/ */
if (num >= 100000000 && nodate(tm)) { if (num >= 100000000 && nodate(tm)) {
time_t time = num; time_t time = num;
if (gmtime_r(&time, tm)) { if (p_gmtime_r(&time, tm)) {
*tm_gmt = 1; *tm_gmt = 1;
return end - date; return end - date;
} }
...@@ -561,7 +561,7 @@ static git_time_t update_tm(struct tm *tm, struct tm *now, unsigned long sec) ...@@ -561,7 +561,7 @@ static git_time_t update_tm(struct tm *tm, struct tm *now, unsigned long sec)
} }
n = mktime(tm) - sec; n = mktime(tm) - sec;
localtime_r(&n, tm); p_localtime_r(&n, tm);
return n; return n;
} }
...@@ -639,7 +639,7 @@ static void date_never(struct tm *tm, struct tm *now, int *num) ...@@ -639,7 +639,7 @@ static void date_never(struct tm *tm, struct tm *now, int *num)
time_t n = 0; time_t n = 0;
GIT_UNUSED(now); GIT_UNUSED(now);
GIT_UNUSED(num); GIT_UNUSED(num);
localtime_r(&n, tm); p_localtime_r(&n, tm);
} }
static const struct special { static const struct special {
...@@ -832,7 +832,7 @@ static git_time_t approxidate_str(const char *date, ...@@ -832,7 +832,7 @@ static git_time_t approxidate_str(const char *date,
time_t time_sec; time_t time_sec;
time_sec = tv->tv_sec; time_sec = tv->tv_sec;
localtime_r(&time_sec, &tm); p_localtime_r(&time_sec, &tm);
now = tm; now = tm;
tm.tm_year = -1; tm.tm_year = -1;
...@@ -870,7 +870,7 @@ int git__date_parse(git_time_t *out, const char *date) ...@@ -870,7 +870,7 @@ int git__date_parse(git_time_t *out, const char *date)
return 0; return 0;
} }
gettimeofday(&tv, NULL); p_gettimeofday(&tv, NULL);
*out = approxidate_str(date, &tv, &error_ret); *out = approxidate_str(date, &tv, &error_ret);
return error_ret; return error_ret;
} }
...@@ -59,9 +59,17 @@ extern int p_rename(const char *from, const char *to); ...@@ -59,9 +59,17 @@ extern int p_rename(const char *from, const char *to);
typedef int GIT_SOCKET; typedef int GIT_SOCKET;
#define INVALID_SOCKET -1 #define INVALID_SOCKET -1
#define p_localtime_r localtime_r
#define p_gmtime_r gmtime_r
#define p_gettimeofday gettimeofday
#else #else
typedef SOCKET GIT_SOCKET; 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 #endif
......
...@@ -119,8 +119,8 @@ int git_signature_now(git_signature **sig_out, const char *name, const char *ema ...@@ -119,8 +119,8 @@ int git_signature_now(git_signature **sig_out, const char *name, const char *ema
time(&now); time(&now);
utc_tm = gmtime_r(&now, &_utc); utc_tm = p_gmtime_r(&now, &_utc);
local_tm = localtime_r(&now, &_local); local_tm = p_localtime_r(&now, &_local);
offset = mktime(local_tm) - mktime(utc_tm); offset = mktime(local_tm) - mktime(utc_tm);
offset /= 60; offset /= 60;
......
...@@ -52,8 +52,4 @@ extern int p_rename(const char *from, const char *to); ...@@ -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_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 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 #endif
...@@ -476,7 +476,7 @@ int p_send(GIT_SOCKET socket, const void *buffer, size_t length, int flags) ...@@ -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 * On Win32, `gmtime_r` doesn't exist but `gmtime` is threadsafe, so we can use that
*/ */
struct tm * 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; struct tm *local_result;
local_result = localtime (timer); local_result = localtime (timer);
...@@ -488,7 +488,7 @@ localtime_r (const time_t *timer, struct tm *result) ...@@ -488,7 +488,7 @@ localtime_r (const time_t *timer, struct tm *result)
return result; return result;
} }
struct tm * 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; struct tm *local_result;
local_result = gmtime (timer); local_result = gmtime (timer);
...@@ -512,7 +512,7 @@ struct timezone ...@@ -512,7 +512,7 @@ struct timezone
int tz_dsttime; /* type of dst correction */ 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; FILETIME ft;
unsigned __int64 tmpres = 0; unsigned __int64 tmpres = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment