diff options
Diffstat (limited to 'lib/Support/Unix/Path.inc')
-rw-r--r-- | lib/Support/Unix/Path.inc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc index 1c91053..519a016 100644 --- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -89,7 +89,7 @@ namespace { static error_code TempDir(SmallVectorImpl<char> &result) { // FIXME: Don't use TMPDIR if program is SUID or SGID enabled. - const char *dir = 0; + const char *dir = nullptr; (dir = std::getenv("TMPDIR")) || (dir = std::getenv("TMP")) || (dir = std::getenv("TEMP")) || (dir = std::getenv("TEMPDIR")) || #ifdef P_tmpdir @@ -246,7 +246,7 @@ error_code current_path(SmallVectorImpl<char> &result) { #endif while (true) { - if (::getcwd(result.data(), result.capacity()) == 0) { + if (::getcwd(result.data(), result.capacity()) == nullptr) { // See if there was a real error. if (errno != errc::not_enough_memory) return error_code(errno, system_category()); @@ -494,7 +494,7 @@ error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset) { #ifdef MAP_FILE flags |= MAP_FILE; #endif - Mapping = ::mmap(0, Size, prot, flags, FD, Offset); + Mapping = ::mmap(nullptr, Size, prot, flags, FD, Offset); if (Mapping == MAP_FAILED) return error_code(errno, system_category()); return error_code::success(); @@ -525,7 +525,7 @@ mapped_file_region::mapped_file_region(const Twine &path, ec = init(ofd, true, offset); if (ec) - Mapping = 0; + Mapping = nullptr; } mapped_file_region::mapped_file_region(int fd, @@ -545,7 +545,7 @@ mapped_file_region::mapped_file_region(int fd, ec = init(fd, closefd, offset); if (ec) - Mapping = 0; + Mapping = nullptr; } mapped_file_region::~mapped_file_region() { @@ -555,7 +555,7 @@ mapped_file_region::~mapped_file_region() { mapped_file_region::mapped_file_region(mapped_file_region &&other) : Mode(other.Mode), Size(other.Size), Mapping(other.Mapping) { - other.Mapping = 0; + other.Mapping = nullptr; } mapped_file_region::mapmode mapped_file_region::flags() const { @@ -587,7 +587,7 @@ error_code detail::directory_iterator_construct(detail::DirIterState &it, StringRef path){ SmallString<128> path_null(path); DIR *directory = ::opendir(path_null.c_str()); - if (directory == 0) + if (!directory) return error_code(errno, system_category()); it.IterationHandle = reinterpret_cast<intptr_t>(directory); @@ -608,9 +608,9 @@ error_code detail::directory_iterator_destruct(detail::DirIterState &it) { error_code detail::directory_iterator_increment(detail::DirIterState &it) { errno = 0; dirent *cur_dir = ::readdir(reinterpret_cast<DIR *>(it.IterationHandle)); - if (cur_dir == 0 && errno != 0) { + if (cur_dir == nullptr && errno != 0) { return error_code(errno, system_category()); - } else if (cur_dir != 0) { + } else if (cur_dir != nullptr) { StringRef name(cur_dir->d_name, NAMLEN(cur_dir)); if ((name.size() == 1 && name[0] == '.') || (name.size() == 2 && name[0] == '.' && name[1] == '.')) @@ -630,7 +630,7 @@ error_code get_magic(const Twine &path, uint32_t len, // Open path. std::FILE *file = std::fopen(Path.data(), "rb"); - if (file == 0) + if (!file) return error_code(errno, system_category()); // Reserve storage. @@ -667,7 +667,7 @@ error_code map_file_pages(const Twine &path, off_t file_offset, size_t size, #ifdef MAP_FILE flags |= MAP_FILE; #endif - result = ::mmap(0, size, prot, flags, fd, file_offset); + result = ::mmap(nullptr, size, prot, flags, fd, file_offset); if (result == MAP_FAILED) { return error_code(errno, system_category()); } |