]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Some simplifications
authorRico Tzschichholz <ricotz@ubuntu.com>
Fri, 21 Oct 2016 13:47:30 +0000 (15:47 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 30 Oct 2016 14:12:03 +0000 (15:12 +0100)
codegen/valaccodebasemodule.vala

index b0bd6eb8ff562965dc892fd4a3b3c0e55523e75f..803b9cefad054f5ac53cb07fa626801c0b006c3b 100644 (file)
@@ -1510,14 +1510,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                if (acc.value_type is ArrayType) {
                        var array_type = (ArrayType) acc.value_type;
-
-                       var length_ctype = "int";
-                       if (acc.readable) {
-                               length_ctype = "int*";
-                       }
-
                        for (int dim = 1; dim <= array_type.rank; dim++) {
-                               function.add_parameter (new CCodeParameter (get_array_length_cname (acc.readable ? "result" : "value", dim), length_ctype));
+                               function.add_parameter (new CCodeParameter (get_array_length_cname (acc.readable ? "result" : "value", dim), acc.readable ? "int*" : "int"));
                        }
                } else if ((acc.value_type is DelegateType) && ((DelegateType) acc.value_type).delegate_symbol.has_target) {
                        function.add_parameter (new CCodeParameter (get_delegate_target_cname (acc.readable ? "result" : "value"), acc.readable ? "gpointer*" : "gpointer"));
@@ -1617,14 +1611,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        if (acc.value_type is ArrayType) {
                                var array_type = (ArrayType) acc.value_type;
-
-                               var length_ctype = "int";
-                               if (acc.readable) {
-                                       length_ctype = "int*";
-                               }
-
                                for (int dim = 1; dim <= array_type.rank; dim++) {
-                                       function.add_parameter (new CCodeParameter (get_array_length_cname (acc.readable ? "result" : "value", dim), length_ctype));
+                                       function.add_parameter (new CCodeParameter (get_array_length_cname (acc.readable ? "result" : "value", dim), acc.readable ? "int*" : "int"));
                                }
                        } else if ((acc.value_type is DelegateType) && ((DelegateType) acc.value_type).delegate_symbol.has_target) {
                                function.add_parameter (new CCodeParameter (get_delegate_target_cname (acc.readable ? "result" : "value"), acc.readable ? "gpointer*" : "gpointer"));
@@ -1741,14 +1729,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        if (acc.value_type is ArrayType) {
                                var array_type = (ArrayType) acc.value_type;
-
-                               var length_ctype = "int";
-                               if (acc.readable) {
-                                       length_ctype = "int*";
-                               }
-
                                for (int dim = 1; dim <= array_type.rank; dim++) {
-                                       function.add_parameter (new CCodeParameter (get_array_length_cname (acc.readable ? "result" : "value", dim), length_ctype));
+                                       function.add_parameter (new CCodeParameter (get_array_length_cname (acc.readable ? "result" : "value", dim), acc.readable ? "int*" : "int"));
                                }
                        } else if ((acc.value_type is DelegateType) && ((DelegateType) acc.value_type).delegate_symbol.has_target) {
                                function.add_parameter (new CCodeParameter (get_delegate_target_cname (acc.readable ? "result" : "value"), acc.readable ? "gpointer*" : "gpointer"));