提交 5f4bd809 编写于 作者: M Marc-André Lureau 提交者: Markus Armbruster

qlit: Replace open-coded qnum_get_int() by call

Bonus: rids us of a side effect in an assertion.
Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
Message-Id: <20170825105913.4060-10-marcandre.lureau@redhat.com>
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
上级 6c6084c1
......@@ -43,8 +43,6 @@ static void compare_helper(QObject *obj, void *opaque)
bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs)
{
int64_t val;
if (!rhs || lhs->type != qobject_type(rhs)) {
return false;
}
......@@ -53,8 +51,7 @@ bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs)
case QTYPE_QBOOL:
return lhs->value.qbool == qbool_get_bool(qobject_to_qbool(rhs));
case QTYPE_QNUM:
g_assert(qnum_get_try_int(qobject_to_qnum(rhs), &val));
return lhs->value.qnum == val;
return lhs->value.qnum == qnum_get_int(qobject_to_qnum(rhs));
case QTYPE_QSTRING:
return (strcmp(lhs->value.qstr,
qstring_get_str(qobject_to_qstring(rhs))) == 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册