summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-09-16 22:19:51 +0000
committerjtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-09-16 22:19:51 +0000
commitb8c42414e165769354f8fdd19810072617b6e064 (patch)
tree0c5299e2cddf5219c4f8b026e423d151e3cdfce4
parentbe80a4c7f1c3e5a99973cf4f2c1e3f7093eb3dd2 (diff)
downloadATCD-b8c42414e165769354f8fdd19810072617b6e064.tar.gz
ChangeLogTag: Tue Sep 16 22:15:32 UTC 2008 J.T. Conklin <jtc@acorntoolworks.com>
-rw-r--r--TAO/ChangeLog35
-rw-r--r--TAO/orbsvcs/orbsvcs/CosTrading.mpc2
-rw-r--r--TAO/orbsvcs/orbsvcs/Makefile.am1
-rw-r--r--TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp95
-rw-r--r--TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h4
-rw-r--r--TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.inl22
-rw-r--r--TAO/tao/ETCL/TAO_ETCL_Constraint.cpp35
7 files changed, 84 insertions, 110 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index f442fd63e44..9317e91498d 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,38 @@
+Tue Sep 16 22:15:32 UTC 2008 J.T. Conklin <jtc@acorntoolworks.com>
+
+ * tao/ETCL/TAO_ETCL_Constraint.cpp:
+
+ Changed TAO_ETCL_Literal_Constraint::copy() so that the any
+ associated with a constraint object of type ACE_ETCL_COMPONENT
+ has it's reference count decremented before the constraint is
+ overwritten by the new value. Previously this was only done if
+ the new value was also of type ACE_ETCL_COMPONENT. This avoids
+ a memory leak.
+
+ * orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp:
+
+ Changed TAO_Literal_Constraint::copy(), so that the string
+ associated with a constraint object of type TAO_STRING is
+ freed before the constraint is overwritten by the new value.
+ This avoids a memory leak.
+
+ * orbsvcs/orbsvcs/Makefile.am:
+
+ Regenerated.
+
+ * orbsvcs/orbsvcs/CosTrading.mpc:
+
+ Add Constraint_Nodes.inl to Inline_Files section.
+
+ * orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp:
+ * orbsvcs/orbsvcs/Trader/Constraint_Nodes.h:
+ * orbsvcs/orbsvcs/Trader/Constraint_Nodes.inl:
+
+ Implement operator!=, operator<=, and operator>= for
+ TAO_Literal_Constraint operands in terms of operator==,
+ operator>, and operator< and make them inline. Removes a lot of
+ boilerplate code and reduces static footprint.
+
Tue Sep 16 13:12:00 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl>
* performance-tests/Cubit/TAO/IDL_Cubit/run_test.pl:
diff --git a/TAO/orbsvcs/orbsvcs/CosTrading.mpc b/TAO/orbsvcs/orbsvcs/CosTrading.mpc
index 9c22dd57207..5910e033009 100644
--- a/TAO/orbsvcs/orbsvcs/CosTrading.mpc
+++ b/TAO/orbsvcs/orbsvcs/CosTrading.mpc
@@ -110,9 +110,11 @@ project(CosTrading_Serv) : orbsvcslib, orbsvcs_output, install, trading_skel, dy
}
Inline_Files {
+ Trader
}
Template_Files {
+ Trader
}
Pkgconfig_Files {
diff --git a/TAO/orbsvcs/orbsvcs/Makefile.am b/TAO/orbsvcs/orbsvcs/Makefile.am
index d4cfa180478..0bf28dea9b4 100644
--- a/TAO/orbsvcs/orbsvcs/Makefile.am
+++ b/TAO/orbsvcs/orbsvcs/Makefile.am
@@ -2855,6 +2855,7 @@ libTAO_CosTrading_Serv_la_LIBADD = \
nobase_include_HEADERS += \
Trader/Constraint_Interpreter.h \
Trader/Constraint_Nodes.h \
+ Trader/Constraint_Nodes.inl \
Trader/Constraint_Visitors.h \
Trader/Interpreter.h \
Trader/Interpreter_Utils.h \
diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp
index 83302ccecb0..2238d1c238b 100644
--- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp
+++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp
@@ -297,7 +297,7 @@ TAO_Literal_Constraint::TAO_Literal_Constraint (void)
TAO_Literal_Constraint::
TAO_Literal_Constraint (const TAO_Literal_Constraint& lit)
- : TAO_Constraint (lit)
+ : type_ (TAO_UNKNOWN)
{
this->copy (lit);
}
@@ -606,37 +606,6 @@ operator== (const TAO_Literal_Constraint& left,
}
-bool
-operator!= (const TAO_Literal_Constraint& left,
- const TAO_Literal_Constraint& right)
-{
- bool return_value = false;
- TAO_Expression_Type widest_type =
- TAO_Literal_Constraint::widest_type (left, right);
-
- switch (widest_type)
- {
- case TAO_STRING:
- return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) != 0);
- break;
- case TAO_DOUBLE:
- return_value = (CORBA::Double) left != (CORBA::Double) right;
- break;
- case TAO_SIGNED:
- return_value = static_cast<CORBA::LongLong> (left) !=
- static_cast<CORBA::LongLong> (right);
- break;
- case TAO_UNSIGNED:
- return_value = static_cast<CORBA::ULongLong> (left) !=
- static_cast<CORBA::ULongLong> (right);
- break;
- case TAO_BOOLEAN:
- return_value = (CORBA::Boolean) left != (CORBA::Boolean) right;
- break;
- }
-
- return return_value;
-}
bool
operator< (const TAO_Literal_Constraint& left,
@@ -671,35 +640,6 @@ operator< (const TAO_Literal_Constraint& left,
}
bool
-operator<= (const TAO_Literal_Constraint& left,
- const TAO_Literal_Constraint& right)
-{
- bool return_value = false;
- TAO_Expression_Type widest_type =
- TAO_Literal_Constraint::widest_type (left, right);
-
- switch (widest_type)
- {
- case TAO_STRING:
- return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) <= 0);
- break;
- case TAO_DOUBLE:
- return_value = (CORBA::Double) left <= (CORBA::Double) right;
- break;
- case TAO_SIGNED:
- return_value = static_cast<CORBA::LongLong> (left) <=
- static_cast<CORBA::LongLong> (right);
- break;
- case TAO_UNSIGNED:
- return_value = static_cast<CORBA::ULongLong> (left) <=
- static_cast<CORBA::ULongLong> (right);
- break;
- }
-
- return return_value;
-}
-
-bool
operator> (const TAO_Literal_Constraint& left,
const TAO_Literal_Constraint& right)
{
@@ -729,36 +669,6 @@ operator> (const TAO_Literal_Constraint& left,
}
bool
-operator>= (const TAO_Literal_Constraint& left,
- const TAO_Literal_Constraint& right)
-{
- bool return_value = false;
- TAO_Expression_Type widest_type =
- TAO_Literal_Constraint::widest_type (left, right);
-
- switch (widest_type)
- {
- case TAO_STRING:
- return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) >= 0);
- break;
- case TAO_DOUBLE:
- return_value = (CORBA::Double) left >= (CORBA::Double) right;
- break;
- case TAO_SIGNED:
- return_value = static_cast<CORBA::LongLong> (left) >=
- static_cast<CORBA::LongLong> (right);
- break;
- case TAO_UNSIGNED:
- return_value = static_cast<CORBA::ULongLong> (left) >=
- static_cast<CORBA::ULongLong> (right);
- break;
- }
-
- return return_value;
-}
-
-
-bool
operator== (CORBA::Double left, const TAO_Literal_Constraint& right)
{
return (left == (CORBA::Double) right);
@@ -949,6 +859,9 @@ TAO_Literal_Constraint::widest_type (const TAO_Literal_Constraint& left,
void
TAO_Literal_Constraint::copy (const TAO_Literal_Constraint& lit)
{
+ if (this->type_ == TAO_STRING)
+ CORBA::string_free (this->op_.str_);
+
this->type_ = lit.type_;
if (this->type_ == TAO_STRING)
this->op_.str_ = CORBA::string_dup (lit.op_.str_);
diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h
index 5df82ffdd7e..184ecf5a0bb 100644
--- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h
+++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h
@@ -346,6 +346,10 @@ class TAO_Trading_Serv_Export TAO_Literal_Constraint : public TAO_Constraint
TAO_END_VERSIONED_NAMESPACE_DECL
+#if defined (__ACE_INLINE__)
+#include "Constraint_Nodes.inl"
+#endif /* __ACE_INLINE */
+
#if defined(_MSC_VER)
#pragma warning(pop)
#endif /* _MSC_VER */
diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.inl b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.inl
new file mode 100644
index 00000000000..f5484c24666
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.inl
@@ -0,0 +1,22 @@
+// $Id$
+
+ACE_INLINE bool
+operator!= (const TAO_Literal_Constraint& left,
+ const TAO_Literal_Constraint& right)
+{
+ return !(left == right);
+}
+
+ACE_INLINE bool
+operator<= (const TAO_Literal_Constraint& left,
+ const TAO_Literal_Constraint& right)
+{
+ return !(left > right);
+}
+
+ACE_INLINE bool
+operator>= (const TAO_Literal_Constraint& left,
+ const TAO_Literal_Constraint& right)
+{
+ return !(left < right);
+}
diff --git a/TAO/tao/ETCL/TAO_ETCL_Constraint.cpp b/TAO/tao/ETCL/TAO_ETCL_Constraint.cpp
index 305c048c41f..e9586f8e6a9 100644
--- a/TAO/tao/ETCL/TAO_ETCL_Constraint.cpp
+++ b/TAO/tao/ETCL/TAO_ETCL_Constraint.cpp
@@ -442,26 +442,23 @@ TAO_ETCL_Literal_Constraint::widest_type (
void
TAO_ETCL_Literal_Constraint::copy (const TAO_ETCL_Literal_Constraint &lit)
{
- // Save the older type_ before assignment.
- unsigned long prev_type = this->type_;
-
- this->type_ = lit.type_;
+ if (this->type_ == ACE_ETCL_COMPONENT && this->any_ != 0)
+ {
+ this->any_->_remove_ref ();
+ this->any_ = 0;
+ }
- switch (this->type_)
- {
- case ACE_ETCL_COMPONENT:
- if (prev_type == ACE_ETCL_COMPONENT && this->any_ != 0)
- {
- this->any_->_remove_ref ();
- }
-
- this->any_ = lit.any_;
- this->any_->_add_ref ();
- break;
- default:
- this->ETCL_Literal_Constraint::copy (lit);
- break;
- }
+ switch (lit.type_)
+ {
+ case ACE_ETCL_COMPONENT:
+ this->type_ = ACE_ETCL_COMPONENT;
+ this->any_ = lit.any_;
+ this->any_->_add_ref ();
+ break;
+ default:
+ this->ETCL_Literal_Constraint::copy (lit);
+ break;
+ }
}
TAO_END_VERSIONED_NAMESPACE_DECL