diff options
Diffstat (limited to 'ACE/ace/Dirent.inl')
-rw-r--r-- | ACE/ace/Dirent.inl | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/ACE/ace/Dirent.inl b/ACE/ace/Dirent.inl index 163954c712f..46c290a4fb0 100644 --- a/ACE/ace/Dirent.inl +++ b/ACE/ace/Dirent.inl @@ -8,30 +8,22 @@ ACE_Dirent::open (const ACE_TCHAR *dirname) { // If the directory stream is already open, close it to prevent // possible resource leaks. - - if (this->dirp_ != 0) + if (this->dirp_) { ACE_OS::closedir (this->dirp_); - this->dirp_ = 0; + this->dirp_ = nullptr; } this->dirp_ = ACE_OS::opendir (dirname); - if (this->dirp_ == 0) + if (!this->dirp_) return -1; else return 0; } ACE_INLINE -ACE_Dirent::ACE_Dirent () - : dirp_ (0) -{ -} - -ACE_INLINE ACE_Dirent::ACE_Dirent (const ACE_TCHAR *dirname) - : dirp_ (0) { if (this->open (dirname) == -1) ACELIB_ERROR ((LM_ERROR, @@ -42,25 +34,25 @@ ACE_Dirent::ACE_Dirent (const ACE_TCHAR *dirname) ACE_INLINE ACE_Dirent::~ACE_Dirent () { - if (this->dirp_ != 0) + if (this->dirp_) ACE_OS::closedir (this->dirp_); } ACE_INLINE ACE_DIRENT * ACE_Dirent::read () { - return this->dirp_ ? ACE_OS::readdir (this->dirp_) : 0; + return this->dirp_ ? ACE_OS::readdir (this->dirp_) : nullptr; } ACE_INLINE void ACE_Dirent::close () { - if (this->dirp_ != 0) + if (this->dirp_) { ACE_OS::closedir (this->dirp_); // Prevent double closure - this->dirp_ = 0; + this->dirp_ = nullptr; } } |