[vala/staging] codegen: Use ArrayType.length_type in type specific wrappers
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegen: Use ArrayType.length_type in type specific wrappers
- Date: Thu, 15 Apr 2021 14:50:32 +0000 (UTC)
commit 46986e416b7161ea5124fbbc8ed4ca08467967e0
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Apr 15 16:49:14 2021 +0200
codegen: Use ArrayType.length_type in type specific wrappers
codegen/valaccodearraymodule.vala | 6 +++---
codegen/valaccodemethodcallmodule.vala | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala
index 7d23b8143..d59538e4d 100644
--- a/codegen/valaccodearraymodule.vala
+++ b/codegen/valaccodearraymodule.vala
@@ -685,7 +685,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
push_function (function);
if (requires_copy (array_type.element_type)) {
- ccode.add_declaration (get_ccode_name (int_type), new CCodeVariableDeclarator ("i"));
+ ccode.add_declaration (get_ccode_name (array_type.length_type), new
CCodeVariableDeclarator ("i"));
ccode.open_for (new CCodeAssignment (new CCodeIdentifier ("i"), new CCodeConstant
("0")),
new CCodeBinaryExpression (CCodeBinaryOperator.LESS_THAN, new
CCodeIdentifier ("i"), get_ccodenode (array_type.length)),
@@ -729,8 +729,8 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
function.modifiers = CCodeModifiers.STATIC;
function.add_parameter (new CCodeParameter ("array", "%s *".printf (get_ccode_name
(array_type))));
- function.add_parameter (new CCodeParameter ("length", "%s*".printf (get_ccode_name
(int_type))));
- function.add_parameter (new CCodeParameter ("size", "%s*".printf (get_ccode_name
(int_type))));
+ function.add_parameter (new CCodeParameter ("length", "%s*".printf (get_ccode_name
(array_type.length_type))));
+ function.add_parameter (new CCodeParameter ("size", "%s*".printf (get_ccode_name
(array_type.length_type))));
push_function (function);
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index c1ef29677..4d6a9ff5a 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -852,7 +852,8 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
arg_it.next ();
var new_size = get_cvalue (arg_it.get ());
- var temp_decl = get_temp_variable (int_type);
+ var array_type = (ArrayType) ma.inner.value_type;
+ var temp_decl = get_temp_variable (array_type.length_type);
var temp_ref = get_variable_cexpression (temp_decl.name);
emit_temp_var (temp_decl);
@@ -862,7 +863,6 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
var clen = get_array_length_cexpression (ma.inner, 1);
var celems = get_cvalue (ma.inner);
- var array_type = (ArrayType) ma.inner.value_type;
var csizeof = new CCodeIdentifier ("sizeof (%s)".printf (get_ccode_name
(array_type.element_type)));
var cdelta = new CCodeBinaryExpression (CCodeBinaryOperator.MINUS, temp_ref, clen);
var ccheck = new CCodeBinaryExpression (CCodeBinaryOperator.GREATER_THAN, temp_ref,
clen);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]