[vala/0.48] codegen: Apply gconstpointer to gpointer cast to GenericType only
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.48] codegen: Apply gconstpointer to gpointer cast to GenericType only
- Date: Wed, 28 Apr 2021 07:46:50 +0000 (UTC)
commit 7b523277a4bc66d3f0b6ddf12a0c7b8aa03afa0d
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Apr 18 21:02:21 2021 +0200
codegen: Apply gconstpointer to gpointer cast to GenericType only
codegen/valaccodebasemodule.vala | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 7d06fde1f..4be1d2135 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4708,15 +4708,17 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
}
CCodeExpression cifnull;
- if (type.type_symbol != null) {
- cifnull = new CCodeConstant ("NULL");
- } else {
+ if (type is GenericType) {
// the value might be non-null even when the dup function is null,
// so we may not just use NULL for type parameters
// cast from gconstpointer to gpointer as methods in
// generic classes may not return gconstpointer
cifnull = new CCodeCastExpression (cexpr, get_ccode_name (pointer_type));
+ } else if (type.type_symbol != null) {
+ cifnull = new CCodeConstant ("NULL");
+ } else {
+ cifnull = cexpr;
}
if (is_ref_function_void (type)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]