mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 06:47:53 +00:00
Rename posix wrappers with 'p_' prefix.
This commit is contained in:
parent
1a728066c3
commit
9ecf860d48
12
src/date.c
12
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;
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user