summaryrefslogtreecommitdiff
path: root/idlc
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-07-16 22:45:01 +0200
committerJochen Nitschke <j.nitschke+logerrit@ok.de>2017-07-18 20:03:44 +0200
commitc49ed68c7e30f6963ecf56e542459f4fbd67a470 (patch)
treefc78c27e38fe230c8d2c7441c23d4f549854a233 /idlc
parent038063a352f59bad1ecdeeb63016e37f6945a420 (diff)
no copy needed
coerce_value(..) is a local static function without side effects Change-Id: Id153ad26973b5724b33f144ae9eba49562b15067 Reviewed-on: https://gerrit.libreoffice.org/40040 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Diffstat (limited to 'idlc')
-rw-r--r--idlc/source/astexpression.cxx54
1 files changed, 2 insertions, 52 deletions
diff --git a/idlc/source/astexpression.cxx b/idlc/source/astexpression.cxx
index c2da1ae717ea..c1563a3dfb14 100644
--- a/idlc/source/astexpression.cxx
+++ b/idlc/source/astexpression.cxx
@@ -686,8 +686,6 @@ coerce_value(AstExprValue *ev, ExprType t)
bool AstExpression::coerce(ExprType t)
{
- AstExprValue *copy;
-
/*
* Is it already of the right type?
*/
@@ -703,56 +701,8 @@ bool AstExpression::coerce(ExprType t)
if (m_exprValue == nullptr)
return false;
- /*
- * Create a copy to contain coercion result
- */
- copy = new AstExprValue;
-
- copy->et = m_exprValue->et;
- switch (m_exprValue->et)
- {
- case ET_short:
- copy->u.sval = m_exprValue->u.sval;
- break;
- case ET_ushort:
- copy->u.usval = m_exprValue->u.usval;
- break;
- case ET_long:
- copy->u.lval = m_exprValue->u.lval;
- break;
- case ET_ulong:
- copy->u.ulval = m_exprValue->u.ulval;
- break;
- case ET_hyper:
- copy->u.hval = m_exprValue->u.hval;
- break;
- case ET_uhyper:
- copy->u.uhval = m_exprValue->u.uhval;
- break;
- case ET_boolean:
- copy->u.bval = m_exprValue->u.bval;
- break;
- case ET_float:
- copy->u.fval = m_exprValue->u.fval;
- break;
- case ET_double:
- copy->u.dval = m_exprValue->u.dval;
- break;
- case ET_byte:
- copy->u.byval = m_exprValue->u.byval;
- break;
- default:
- OSL_ASSERT(false);
- break;
- }
-
- if (!coerce_value(copy, t))
- {
- delete copy;
- copy = nullptr;
- }
-
- m_exprValue.reset( copy );
+ if (!coerce_value(m_exprValue.get(), t))
+ m_exprValue.reset();
return m_exprValue != nullptr;
}