[vala/0.50] codegen: Always use CCodeConstant for NULL
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.50] codegen: Always use CCodeConstant for NULL
- Date: Thu, 8 Apr 2021 07:33:00 +0000 (UTC)
commit 5f54211da4c51908ab019b918c0bd1e2b70bcfaf
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Apr 6 13:00:16 2021 +0200
codegen: Always use CCodeConstant for NULL
codegen/valaccodearraymodule.vala | 4 ++--
codegen/valaccodebasemodule.vala | 4 ++--
codegen/valaccodemethodcallmodule.vala | 2 +-
codegen/valagtypemodule.vala | 8 ++++----
codegen/valagvariantmodule.vala | 6 +++---
5 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala
index 851778171..9bfe9db59 100644
--- a/codegen/valaccodearraymodule.vala
+++ b/codegen/valaccodearraymodule.vala
@@ -606,7 +606,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
ccode.add_return (new CCodeIdentifier ("result"));
ccode.close ();
- ccode.add_return (new CCodeIdentifier ("NULL"));
+ ccode.add_return (new CCodeConstant ("NULL"));
} else {
// only dup if length > 0, this deals with negative lengths and returns NULL
var length_check = new CCodeBinaryExpression (CCodeBinaryOperator.GREATER_THAN, new
CCodeIdentifier ("length"), new CCodeConstant ("0"));
@@ -644,7 +644,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
}
ccode.close ();
- ccode.add_return (new CCodeIdentifier ("NULL"));
+ ccode.add_return (new CCodeConstant ("NULL"));
}
// append to file
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 4d44d0a7e..c9874ee7d 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -1233,7 +1233,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
ccode.add_assignment (get_delegate_target_cvalue
(field_value), new CCodeIdentifier ("self"));
if (delegate_type.is_disposable ()) {
- ccode.add_assignment
(get_delegate_target_destroy_notify_cvalue (field_value), new CCodeIdentifier ("NULL"));
+ ccode.add_assignment
(get_delegate_target_destroy_notify_cvalue (field_value), new CCodeConstant ("NULL"));
}
}
}
@@ -6011,7 +6011,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
if (sink_func != "") {
if (type.nullable) {
- var is_not_null = new CCodeBinaryExpression
(CCodeBinaryOperator.INEQUALITY, result.cvalue, new CCodeIdentifier ("NULL"));
+ var is_not_null = new CCodeBinaryExpression
(CCodeBinaryOperator.INEQUALITY, result.cvalue, new CCodeConstant ("NULL"));
ccode.open_if (is_not_null);
}
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 66f2d8818..2d47f3ee4 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -432,7 +432,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
closure_new.add_argument (new
CCodeCastExpression (cexpr, "GCallback"));
closure_new.add_argument
(delegate_target);
closure_new.add_argument (new
CCodeCastExpression (delegate_target_destroy_notify, "GClosureNotify"));
- cexpr = new
CCodeConditionalExpression (new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, cexpr, new
CCodeIdentifier ("NULL")), new CCodeIdentifier ("NULL"), closure_new);
+ cexpr = new
CCodeConditionalExpression (new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, cexpr, new CCodeConstant
("NULL")), new CCodeConstant ("NULL"), closure_new);
} else {
carg_map.set (get_param_pos
(get_ccode_delegate_target_pos (param)), delegate_target);
if (deleg_type.is_disposable ()) {
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 699aca8df..ca9d63e7c 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -1007,7 +1007,7 @@ public class Vala.GTypeModule : GErrorModule {
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_return_val_if_fail"));
ccall.add_argument (subccall);
- ccall.add_argument (new CCodeIdentifier ("NULL"));
+ ccall.add_argument (new CCodeConstant ("NULL"));
ccode.add_expression (ccall);
ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_param_spec_internal"));
@@ -1186,7 +1186,7 @@ public class Vala.GTypeModule : GErrorModule {
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_return_val_if_fail"));
ccall.add_argument (ccall_typecheck);
- ccall.add_argument (new CCodeIdentifier ("NULL"));
+ ccall.add_argument (new CCodeConstant ("NULL"));
ccode.add_expression (ccall);
ccode.add_return (vpointer);
@@ -2343,8 +2343,8 @@ public class Vala.GTypeModule : GErrorModule {
get_value.add_argument ((CCodeExpression) get_ccodenode (((MemberAccess)
expr.call).inner));
ccode.add_assignment (get_variable_cexpression (temp_var.name), get_value);
- var is_null_value = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY,
get_variable_cexpression (temp_var.name), new CCodeIdentifier ("NULL"));
- set_cvalue (expr, new CCodeConditionalExpression (is_null_value, new
CCodeMemberAccess.pointer (get_variable_cexpression (temp_var.name), "value_name"), new CCodeIdentifier
("NULL")));
+ var is_null_value = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY,
get_variable_cexpression (temp_var.name), new CCodeConstant ("NULL"));
+ set_cvalue (expr, new CCodeConditionalExpression (is_null_value, new
CCodeMemberAccess.pointer (get_variable_cexpression (temp_var.name), "value_name"), new CCodeConstant
("NULL")));
}
pop_line ();
}
diff --git a/codegen/valagvariantmodule.vala b/codegen/valagvariantmodule.vala
index d4719b906..fb28aa762 100644
--- a/codegen/valagvariantmodule.vala
+++ b/codegen/valagvariantmodule.vala
@@ -345,7 +345,7 @@ public class Vala.GVariantModule : GValueModule {
// NULL terminate array
var length = new CCodeIdentifier (temp_name + "_length");
var element_access = new CCodeElementAccess (new CCodeIdentifier (temp_name), length);
- ccode.add_assignment (element_access, new CCodeIdentifier ("NULL"));
+ ccode.add_assignment (element_access, new CCodeConstant ("NULL"));
}
return new CCodeIdentifier (temp_name);
@@ -499,7 +499,7 @@ public class Vala.GVariantModule : GValueModule {
} else if (key_type.type_symbol.get_full_name () == "GLib.HashTable") {
hash_table_new.add_argument (new CCodeCastExpression (new CCodeIdentifier
("g_hash_table_unref"), "GDestroyNotify"));
} else {
- hash_table_new.add_argument (new CCodeIdentifier ("NULL"));
+ hash_table_new.add_argument (new CCodeConstant ("NULL"));
}
if (value_type.type_symbol.is_subtype_of (string_type.type_symbol)) {
@@ -509,7 +509,7 @@ public class Vala.GVariantModule : GValueModule {
} else if (value_type.type_symbol.get_full_name () == "GLib.HashTable") {
hash_table_new.add_argument (new CCodeCastExpression (new CCodeIdentifier
("g_hash_table_unref"), "GDestroyNotify"));
} else {
- hash_table_new.add_argument (new CCodeIdentifier ("NULL"));
+ hash_table_new.add_argument (new CCodeConstant ("NULL"));
}
ccode.add_assignment (new CCodeIdentifier (temp_name), hash_table_new);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]