[vala/staging] codegen: Always use CCodeConstant for NULL
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegen: Always use CCodeConstant for NULL
- Date: Tue, 6 Apr 2021 11:18:45 +0000 (UTC)
commit e2edf1f3d4b4fa88b3cabf591b95cd077b5ce18c
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 | 6 +++---
codegen/valaccodemethodcallmodule.vala | 2 +-
codegen/valagtypemodule.vala | 8 ++++----
codegen/valagvariantmodule.vala | 6 +++---
5 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala
index 8eb995f20..7d23b8143 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"));
@@ -650,7 +650,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 2df631adc..fc25b327f 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -785,7 +785,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
ccode.add_else ();
- ccode.add_assignment (new CCodeIdentifier ("new_mem"), new CCodeIdentifier ("NULL"));
+ ccode.add_assignment (new CCodeIdentifier ("new_mem"), new CCodeConstant ("NULL"));
ccode.close ();
@@ -1283,7 +1283,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"));
}
}
}
@@ -6061,7 +6061,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 dd8e149ae..d60fcf0a3 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -443,7 +443,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 daab41f5d..1a0e0d1b3 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -1011,7 +1011,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"));
@@ -1190,7 +1190,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);
@@ -2347,8 +2347,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 91a66881a..2e4c4956e 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);
@@ -505,7 +505,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)) {
@@ -515,7 +515,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]