diff options
Diffstat (limited to 'TAO/TAO_IDL/util/utl_identifier.cpp')
-rw-r--r-- | TAO/TAO_IDL/util/utl_identifier.cpp | 50 |
1 files changed, 10 insertions, 40 deletions
diff --git a/TAO/TAO_IDL/util/utl_identifier.cpp b/TAO/TAO_IDL/util/utl_identifier.cpp index 318f8780c2c..895418ebe6d 100644 --- a/TAO/TAO_IDL/util/utl_identifier.cpp +++ b/TAO/TAO_IDL/util/utl_identifier.cpp @@ -87,12 +87,17 @@ Identifier::Identifier (const char *s, long, long, long) Identifier::~Identifier () { + if (this->pv_string != 0) + { + // The string was allocated using strdup, which uses malloc. + ACE_OS::free (this->pv_string); + } } // Operations char * -Identifier::get_string (void) +Identifier::get_string () { return pv_string; } @@ -101,9 +106,7 @@ void Identifier::replace_string (const char * s) { if (this->pv_string) - { - ACE_OS::free (this->pv_string); - } + ACE_OS::free (this->pv_string); pv_string = ACE_OS::strdup (s); } @@ -125,12 +128,7 @@ Identifier::case_compare (Identifier *o) UTL_String member (this->pv_string); UTL_String other (o->get_string ()); - long result = member.compare (&other); - - member.destroy (); - other.destroy (); - - return result; + return member.compare (&other); } // Report no error if the two identifiers differ only in case. @@ -140,29 +138,11 @@ Identifier::case_compare_quiet (Identifier *o) UTL_String member (this->pv_string); UTL_String other (o->get_string ()); - long result = member.compare_quiet (&other); - - member.destroy (); - other.destroy (); - - return result; -} - -Identifier * -Identifier::copy (void) -{ - Identifier *retval = 0; - ACE_NEW_RETURN (retval, - Identifier (this->pv_string, - 1, - 0, - I_FALSE), - 0); - - return retval; + return member.compare_quiet (&other); } // Dumping + void Identifier::dump (ostream &o) { @@ -171,13 +151,3 @@ Identifier::dump (ostream &o) o << get_string(); } -void -Identifier::destroy (void) -{ - if (this->pv_string) - { - ACE_OS::free (this->pv_string); - this->pv_string = 0; - } -} - |