Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
e120fc58
Commit
e120fc58
authored
Mar 26, 2009
by
zhanyong.wan
Browse files
Works around a VC bug by avoiding defining a function named strdup().
parent
3c7bbf5b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
include/gtest/internal/gtest-port.h
include/gtest/internal/gtest-port.h
+8
-3
src/gtest-death-test.cc
src/gtest-death-test.cc
+2
-2
src/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
,
s
tr
d
up
(
argument
));
args_
.
insert
(
args_
.
end
()
-
1
,
posix
::
S
tr
D
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
,
s
tr
d
up
(
i
->
c_str
()));
args_
.
insert
(
args_
.
end
()
-
1
,
posix
::
S
tr
D
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_
=
s
tr
d
up
(
regex
);
pattern_
=
posix
::
S
tr
D
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
::
s
tr
d
up
(
regex
);
pattern_
=
posix
::
S
tr
D
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