Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
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
Chen Yisong
googletest
Commits
e120fc58
Commit
e120fc58
authored
Mar 26, 2009
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Works around a VC bug by avoiding defining a function named strdup().
parent
3c7bbf5b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
gtest-port.h
include/gtest/internal/gtest-port.h
+8
-3
gtest-death-test.cc
src/gtest-death-test.cc
+2
-2
gtest-port.cc
src/gtest-port.cc
+2
-2
No files found.
include/gtest/internal/gtest-port.h
View file @
e120fc58
...
...
@@ -736,13 +736,18 @@ namespace posix {
typedef
struct
_stat
stat_struct
;
inline
int
chdir
(
const
char
*
dir
)
{
return
::
_chdir
(
dir
);
}
// We cannot write ::_fileno() as MSVC defines it as a macro.
inline
int
fileno
(
FILE
*
file
)
{
return
_fileno
(
file
);
}
inline
int
isatty
(
int
fd
)
{
return
::
_isatty
(
fd
);
}
inline
int
stat
(
const
char
*
path
,
stat_struct
*
buf
)
{
return
::
_stat
(
path
,
buf
);
}
inline
int
stat
(
const
char
*
path
,
stat_struct
*
buf
)
{
return
::
_stat
(
path
,
buf
);
}
inline
int
strcasecmp
(
const
char
*
s1
,
const
char
*
s2
)
{
return
::
_stricmp
(
s1
,
s2
);
}
inline
const
char
*
strdup
(
const
char
*
src
)
{
return
::
_strdup
(
src
);
}
// We cannot define the function as strdup(const char* src), since
// MSVC defines strdup as a macro.
inline
char
*
StrDup
(
const
char
*
src
)
{
return
::
_strdup
(
src
);
}
inline
int
rmdir
(
const
char
*
dir
)
{
return
::
_rmdir
(
dir
);
}
inline
bool
IsDir
(
const
stat_struct
&
st
)
{
return
(
_S_IFDIR
&
st
.
st_mode
)
!=
0
;
...
...
@@ -757,7 +762,7 @@ using ::fileno;
using
::
isatty
;
using
::
stat
;
using
::
strcasecmp
;
using
::
strdup
;
inline
char
*
StrDup
(
const
char
*
src
)
{
return
::
strdup
(
src
);
}
using
::
rmdir
;
inline
bool
IsDir
(
const
stat_struct
&
st
)
{
return
S_ISDIR
(
st
.
st_mode
);
}
...
...
src/gtest-death-test.cc
View file @
e120fc58
...
...
@@ -810,7 +810,7 @@ class Arguments {
}
}
void
AddArgument
(
const
char
*
argument
)
{
args_
.
insert
(
args_
.
end
()
-
1
,
strd
up
(
argument
));
args_
.
insert
(
args_
.
end
()
-
1
,
posix
::
StrD
up
(
argument
));
}
template
<
typename
Str
>
...
...
@@ -818,7 +818,7 @@ class Arguments {
for
(
typename
::
std
::
vector
<
Str
>::
const_iterator
i
=
arguments
.
begin
();
i
!=
arguments
.
end
();
++
i
)
{
args_
.
insert
(
args_
.
end
()
-
1
,
strd
up
(
i
->
c_str
()));
args_
.
insert
(
args_
.
end
()
-
1
,
posix
::
StrD
up
(
i
->
c_str
()));
}
}
char
*
const
*
Argv
()
{
...
...
src/gtest-port.cc
View file @
e120fc58
...
...
@@ -98,7 +98,7 @@ bool RE::PartialMatch(const char* str, const RE& re) {
// Initializes an RE from its string representation.
void
RE
::
Init
(
const
char
*
regex
)
{
pattern_
=
strd
up
(
regex
);
pattern_
=
posix
::
StrD
up
(
regex
);
// Reserves enough bytes to hold the regular expression used for a
// full match.
...
...
@@ -346,7 +346,7 @@ bool RE::PartialMatch(const char* str, const RE& re) {
void
RE
::
Init
(
const
char
*
regex
)
{
pattern_
=
full_pattern_
=
NULL
;
if
(
regex
!=
NULL
)
{
pattern_
=
posix
::
strd
up
(
regex
);
pattern_
=
posix
::
StrD
up
(
regex
);
}
is_valid_
=
ValidateRegex
(
regex
);
...
...
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