Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
9ecf860d
Commit
9ecf860d
authored
Jun 06, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename posix wrappers with 'p_' prefix.
parent
1a728066
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
15 deletions
+19
-15
src/date.c
+6
-6
src/posix.h
+8
-0
src/signature.c
+2
-2
src/win32/posix.h
+0
-4
src/win32/posix_w32.c
+3
-3
No files found.
src/date.c
View file @
9ecf860d
...
...
@@ -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
;
}
src/posix.h
View file @
9ecf860d
...
...
@@ -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
...
...
src/signature.c
View file @
9ecf860d
...
...
@@ -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
;
...
...
src/win32/posix.h
View file @
9ecf860d
...
...
@@ -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
src/win32/posix_w32.c
View file @
9ecf860d
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment