[vala/0.36] codegen: Don't check boolean values for (in)equality in GTask API
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.36] codegen: Don't check boolean values for (in)equality in GTask API
- Date: Thu, 28 Feb 2019 17:39:18 +0000 (UTC)
commit 82508f38ec5db064556ba0b8f2c7251344d06296
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Jan 5 18:11:30 2019 +0100
codegen: Don't check boolean values for (in)equality in GTask API
This resolves any value but 0 to true as it is suppose to be.
/* invalid */
if (condition == TRUE)
do_foo ();
/* valid */
if (another_condition)
do_bar ();
See https://gitlab.gnome.org/GNOME/glib/issues/1636
codegen/valaccodemethodmodule.vala | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 4d35f3c8f..a7fa959d9 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -140,15 +140,15 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
var state_is_not_zero = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY,
state, zero);
ccode.open_if (state_is_not_zero);
- CCodeBinaryExpression task_is_complete;
+ CCodeExpression task_is_complete;
if (context.require_glib_version (2, 44)) {
var task_complete = new CCodeFunctionCall (new CCodeIdentifier
("g_task_get_completed"));
task_complete.add_argument (async_result_expr);
- task_is_complete = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY,
task_complete, new CCodeConstant ("TRUE"));
+ task_is_complete = new CCodeUnaryExpression
(CCodeUnaryOperator.LOGICAL_NEGATION, task_complete);
} else {
var task_complete = new CCodeMemberAccess.pointer (data_var,
"_task_complete_");
- task_is_complete = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY,
task_complete, new CCodeConstant ("TRUE"));
+ task_is_complete = new CCodeUnaryExpression
(CCodeUnaryOperator.LOGICAL_NEGATION, task_complete);
}
ccode.open_while (task_is_complete);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]