Skip to content

Commit fe735a6

Browse files
author
Gaspard Petit
committed
Move declaration of kStdOutFileNo and kStdErrFileno
Move declaration of kStdOutFileNo and kStdErrFileno closer to where they are used to avoid having to guard for GTEST_HAS_STREAM_REDIRECTION twice
1 parent 900c3f9 commit fe735a6

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

googletest/src/gtest-port.cc

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,6 @@
9090
namespace testing {
9191
namespace internal {
9292

93-
#if GTEST_HAS_STREAM_REDIRECTION
94-
#if defined(_MSC_VER) || defined(__BORLANDC__)
95-
// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
96-
const int kStdOutFileno = 1;
97-
const int kStdErrFileno = 2;
98-
#else
99-
const int kStdOutFileno = STDOUT_FILENO;
100-
const int kStdErrFileno = STDERR_FILENO;
101-
#endif // _MSC_VER
102-
#endif // GTEST_HAS_STREAM_REDIRECTION
103-
10493
#if GTEST_OS_LINUX || GTEST_OS_GNU_HURD
10594

10695
namespace {
@@ -1179,6 +1168,15 @@ static std::string GetCapturedStream(CapturedStream** captured_stream) {
11791168
return content;
11801169
}
11811170

1171+
#if defined(_MSC_VER) || defined(__BORLANDC__)
1172+
// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
1173+
const int kStdOutFileno = 1;
1174+
const int kStdErrFileno = 2;
1175+
#else
1176+
const int kStdOutFileno = STDOUT_FILENO;
1177+
const int kStdErrFileno = STDERR_FILENO;
1178+
#endif // _MSC_VER
1179+
11821180
// Starts capturing stdout.
11831181
void CaptureStdout() {
11841182
CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);

0 commit comments

Comments
 (0)