diff options
Diffstat (limited to 'TAO/tao/PortableServer/POA_Current_Impl.inl')
-rw-r--r-- | TAO/tao/PortableServer/POA_Current_Impl.inl | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/TAO/tao/PortableServer/POA_Current_Impl.inl b/TAO/tao/PortableServer/POA_Current_Impl.inl index db220558ae6..cf3fee49d65 100644 --- a/TAO/tao/PortableServer/POA_Current_Impl.inl +++ b/TAO/tao/PortableServer/POA_Current_Impl.inl @@ -25,7 +25,22 @@ namespace TAO ACE_INLINE void POA_Current_Impl::object_id (const PortableServer::ObjectId &id) { - this->object_id_ = id; + if (this->object_id_.release () || + this->object_id_.get_buffer() == this->object_id_buf_) + { + // Resize the current object_id_. If it is less than the + // length of the current buffer, no allocation will take place. + size_t id_size = id.length (); + this->object_id_.length (id_size); + + // Get the buffer and copy the new object id in it's place. + ACE_OS::memcpy (this->object_id_.get_buffer (), + id.get_buffer (), id_size); + } + else + { + this->object_id_ = id; + } } ACE_INLINE const PortableServer::ObjectId & @@ -38,6 +53,8 @@ namespace TAO POA_Current_Impl::replace_object_id ( const PortableServer::ObjectId &system_id) { + // This has the effect of replacing the underlying buffer + // with that of another object id without copying. object_id_.replace (system_id.maximum (), system_id.length (), const_cast <CORBA::Octet *> (system_id.get_buffer ()), |