summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2021-09-17 15:14:55 +0200
committerJohnny Willemsen <jwillemsen@remedy.nl>2021-09-17 15:14:55 +0200
commit4b188f271990a6781ad8d8a9833dcafe29e2a3fe (patch)
tree7d005da8c189b93c482a5eaaf00ad4e107c807c3 /TAO/tao
parent63c63c2dfa220b140a90626fc21a226260108fbb (diff)
downloadATCD-4b188f271990a6781ad8d8a9833dcafe29e2a3fe.tar.gz
Use uniform initialization and fix g++ unitialized warning
* TAO/tao/Queued_Data.cpp: * TAO/tao/Queued_Data.h: * TAO/tao/Queued_Data.inl:
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/Queued_Data.cpp26
-rw-r--r--TAO/tao/Queued_Data.h9
-rw-r--r--TAO/tao/Queued_Data.inl15
3 files changed, 21 insertions, 29 deletions
diff --git a/TAO/tao/Queued_Data.cpp b/TAO/tao/Queued_Data.cpp
index 438f9d8a5c4..d7c86459964 100644
--- a/TAO/tao/Queued_Data.cpp
+++ b/TAO/tao/Queued_Data.cpp
@@ -131,23 +131,25 @@ TAO_Queued_Data::release (TAO_Queued_Data *qd)
if (qd->allocator_)
{
+ // Store the allocator first on the stack, destructor of
+ // qd will be called first, fixes gcc warning
+ ACE_Allocator *alloc = qd->allocator_;
ACE_DES_FREE (qd,
- qd->allocator_->free,
+ alloc->free,
TAO_Queued_Data);
-
- return;
}
-
- // @todo: Need to be removed at some point of time!
- if (TAO_debug_level == 4)
+ else
{
- // This debug is for testing purposes!
- TAOLIB_DEBUG ((LM_DEBUG,
- "TAO (%P|%t) - Queued_Data[%d]::release\n",
- "Using global pool for releasing\n"));
+ // @todo: Need to be removed at some point of time!
+ if (TAO_debug_level == 4)
+ {
+ // This debug is for testing purposes!
+ TAOLIB_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Queued_Data[%d]::release\n",
+ "Using global pool for releasing\n"));
+ }
+ delete qd;
}
- delete qd;
-
}
diff --git a/TAO/tao/Queued_Data.h b/TAO/tao/Queued_Data.h
index ee3b6969cc2..c13e1a97b48 100644
--- a/TAO/tao/Queued_Data.h
+++ b/TAO/tao/Queued_Data.h
@@ -108,9 +108,8 @@ public:
const TAO_GIOP_Message_State& state () const;
private:
-
/// The message block that contains the message.
- ACE_Message_Block *msg_block_;
+ ACE_Message_Block *msg_block_ {};
/*!
@name Missing Data details
@@ -122,21 +121,21 @@ private:
/*! Data missing in the above message that hasn't been read or processed yet,
the value TAO_MISSING_DATA_UNDEFINED indicates it hasn't been processed yet,
otherwise greater or equal zero. */
- size_t missing_data_;
+ size_t missing_data_ {};
//@}
/// State of this queued data
TAO_GIOP_Message_State state_;
/// Pounter to the next element in the queue.
- TAO_Queued_Data *next_;
+ TAO_Queued_Data *next_ {};
/// Replace the datablock with a one allocated on the heap or
/// allocator
static void replace_data_block (ACE_Message_Block &mb);
/// The allocator used to allocate this class.
- ACE_Allocator *allocator_;
+ ACE_Allocator *allocator_ {};
};
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Queued_Data.inl b/TAO/tao/Queued_Data.inl
index c90cb50c2e1..18f1e227486 100644
--- a/TAO/tao/Queued_Data.inl
+++ b/TAO/tao/Queued_Data.inl
@@ -6,11 +6,9 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE void
TAO_Queued_Data::replace_data_block (ACE_Message_Block &mb)
{
- size_t const newsize =
- ACE_CDR::total_length (&mb, 0) + ACE_CDR::MAX_ALIGNMENT;
+ size_t const newsize = ACE_CDR::total_length (&mb, 0) + ACE_CDR::MAX_ALIGNMENT;
- ACE_Data_Block *db =
- mb.data_block ()->clone_nocopy ();
+ ACE_Data_Block *db = mb.data_block ()->clone_nocopy ();
if (db->size (newsize) == -1)
return;
@@ -30,10 +28,7 @@ TAO_Queued_Data::replace_data_block (ACE_Message_Block &mb)
ACE_INLINE
TAO_Queued_Data::TAO_Queued_Data (ACE_Allocator *alloc)
- : msg_block_ (0),
- missing_data_ (0),
- state_ (),
- next_ (0),
+ : state_ (),
allocator_ (alloc)
{
}
@@ -42,9 +37,7 @@ ACE_INLINE
TAO_Queued_Data::TAO_Queued_Data (ACE_Message_Block *mb,
ACE_Allocator *alloc)
: msg_block_ (mb),
- missing_data_ (0),
state_ (),
- next_ (0),
allocator_ (alloc)
{
}
@@ -54,12 +47,10 @@ TAO_Queued_Data::TAO_Queued_Data (const TAO_Queued_Data &qd)
: msg_block_ (qd.msg_block_->duplicate ()),
missing_data_ (qd.missing_data_),
state_ (qd.state_),
- next_ (0),
allocator_ (qd.allocator_)
{
}
-
ACE_INLINE size_t
TAO_Queued_Data::missing_data () const
{