summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2022-09-15 17:44:46 +0200
committerJohnny Willemsen <jwillemsen@remedy.nl>2022-09-15 17:44:46 +0200
commit5c2ec52d1b878b4a8a7d18a6eb2f8319746b0ddf (patch)
treea50e5982663bafce6f625b207a46f22302ae947c
parent789d53da61f50e325628797a925de9f16d023ec3 (diff)
downloadATCD-5c2ec52d1b878b4a8a7d18a6eb2f8319746b0ddf.tar.gz
Make use of default, uniform initialisation, and nullptr
* ACE/ace/Dirent.h: * ACE/ace/Dirent.inl: * ACE/ace/Dirent_Selector.cpp: * ACE/ace/Dirent_Selector.h: * ACE/ace/Malloc_T.cpp: * ACE/ace/POSIX_Asynch_IO.cpp:
-rw-r--r--ACE/ace/Dirent.h4
-rw-r--r--ACE/ace/Dirent.inl22
-rw-r--r--ACE/ace/Dirent_Selector.cpp8
-rw-r--r--ACE/ace/Dirent_Selector.h6
-rw-r--r--ACE/ace/Malloc_T.cpp1
-rw-r--r--ACE/ace/POSIX_Asynch_IO.cpp1
6 files changed, 12 insertions, 30 deletions
diff --git a/ACE/ace/Dirent.h b/ACE/ace/Dirent.h
index 02551013d07..9d57d4e9839 100644
--- a/ACE/ace/Dirent.h
+++ b/ACE/ace/Dirent.h
@@ -34,7 +34,7 @@ class ACE_Export ACE_Dirent
{
public:
/// Default constructor.
- ACE_Dirent ();
+ ACE_Dirent () = default;
/// Constructor calls @c opendir()
explicit ACE_Dirent (const ACE_TCHAR *dirname);
@@ -98,7 +98,7 @@ public:
private:
/// Pointer to the directory stream.
- ACE_DIR *dirp_;
+ ACE_DIR *dirp_ {};
};
ACE_END_VERSIONED_NAMESPACE_DECL
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;
}
}
diff --git a/ACE/ace/Dirent_Selector.cpp b/ACE/ace/Dirent_Selector.cpp
index 5d7279fde9e..7591b0b00d4 100644
--- a/ACE/ace/Dirent_Selector.cpp
+++ b/ACE/ace/Dirent_Selector.cpp
@@ -13,14 +13,6 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-// Construction/Destruction
-
-ACE_Dirent_Selector::ACE_Dirent_Selector ()
- : namelist_ (0),
- n_ (0)
-{
-}
-
ACE_Dirent_Selector::~ACE_Dirent_Selector ()
{
// Free up any allocated resources.
diff --git a/ACE/ace/Dirent_Selector.h b/ACE/ace/Dirent_Selector.h
index a3622d557dd..2751a53272e 100644
--- a/ACE/ace/Dirent_Selector.h
+++ b/ACE/ace/Dirent_Selector.h
@@ -35,7 +35,7 @@ class ACE_Export ACE_Dirent_Selector
{
public:
/// Constructor
- ACE_Dirent_Selector ();
+ ACE_Dirent_Selector () = default;
/// Destructor.
virtual ~ACE_Dirent_Selector ();
@@ -57,10 +57,10 @@ public:
protected:
/// Ptr to the namelist array.
- ACE_DIRENT **namelist_;
+ ACE_DIRENT **namelist_ {};
/// Number of entries in the array.
- int n_;
+ int n_ {};
};
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ACE/ace/Malloc_T.cpp b/ACE/ace/Malloc_T.cpp
index 3d6a11a61cc..c336a0d8fde 100644
--- a/ACE/ace/Malloc_T.cpp
+++ b/ACE/ace/Malloc_T.cpp
@@ -792,7 +792,6 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_free (void *ap)
// Search until we find the location where the blocks belongs. Note
// that addresses are kept in sorted order.
-
ACE_SEH_TRY
{
for (;
diff --git a/ACE/ace/POSIX_Asynch_IO.cpp b/ACE/ace/POSIX_Asynch_IO.cpp
index 9f524ec5871..c032bca87b9 100644
--- a/ACE/ace/POSIX_Asynch_IO.cpp
+++ b/ACE/ace/POSIX_Asynch_IO.cpp
@@ -1967,7 +1967,6 @@ ACE_POSIX_Asynch_Transmit_Handler::handle_read_file (const ACE_Asynch_Read_File:
// Failure.
if (result.success () == 0)
{
- //
ACE_SEH_TRY
{
this->result_->complete (this->bytes_transferred_,