Skip to content

Commit

Permalink
Don't use unix or win namespaces (flutter#6277)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetf authored Sep 19, 2018
1 parent 60c5bb8 commit 2b25fd7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions fml/unique_fd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ namespace internal {

#if OS_WIN

namespace win {
namespace os_win {

void UniqueFDTraits::Free(HANDLE fd) {
CloseHandle(fd);
}

} // namespace win
} // namespace os_win

#else // OS_WIN

namespace unix {
namespace os_unix {

void UniqueFDTraits::Free(int fd) {
close(fd);
}

} // namespace unix
} // namespace os_unix

#endif // OS_WIN

Expand Down
12 changes: 6 additions & 6 deletions fml/unique_fd.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,39 @@ namespace internal {

#if OS_WIN

namespace win {
namespace os_win {

struct UniqueFDTraits {
static HANDLE InvalidValue() { return INVALID_HANDLE_VALUE; }
static bool IsValid(HANDLE value) { return value != InvalidValue(); }
static void Free(HANDLE fd);
};

} // namespace win
} // namespace os_win

#else // OS_WIN

namespace unix {
namespace os_unix {

struct UniqueFDTraits {
static int InvalidValue() { return -1; }
static bool IsValid(int value) { return value >= 0; }
static void Free(int fd);
};

} // namespace unix
} // namespace os_unix

#endif // OS_WIN

} // namespace internal

#if OS_WIN

using UniqueFD = UniqueObject<HANDLE, internal::win::UniqueFDTraits>;
using UniqueFD = UniqueObject<HANDLE, internal::os_win::UniqueFDTraits>;

#else // OS_WIN

using UniqueFD = UniqueObject<int, internal::unix::UniqueFDTraits>;
using UniqueFD = UniqueObject<int, internal::os_unix::UniqueFDTraits>;

#endif // OS_WIN

Expand Down

0 comments on commit 2b25fd7

Please sign in to comment.