]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Replace hardcoded "gint"/"int" references (POSIX)
authorRico Tzschichholz <ricotz@ubuntu.com>
Fri, 18 Oct 2019 22:12:26 +0000 (00:12 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 19 Oct 2019 08:20:48 +0000 (10:20 +0200)
Only applied up to CCodeDelegateModule

codegen/valaccodearraymodule.vala
codegen/valaccodebasemodule.vala
codegen/valaccodemethodmodule.vala

index 35274bf247acb67b98e2815543d3758812dd08c5..4a610e0aa33fa6869c587a7dc399fc3c2d0ee1d4 100644 (file)
@@ -231,14 +231,14 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                var fun = new CCodeFunction (cname, "void");
                fun.modifiers = CCodeModifiers.STATIC;
                fun.add_parameter (new CCodeParameter ("array", "%s *".printf (get_ccode_name (st))));
-               fun.add_parameter (new CCodeParameter ("array_length", "gint"));
+               fun.add_parameter (new CCodeParameter ("array_length", get_ccode_name (int_type)));
 
                push_function (fun);
 
                var ccondarr = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, new CCodeIdentifier ("array"), new CCodeConstant ("NULL"));
                ccode.open_if (ccondarr);
 
-               ccode.add_declaration ("int", new CCodeVariableDeclarator ("i"));
+               ccode.add_declaration (get_ccode_name (int_type), new CCodeVariableDeclarator ("i"));
                append_struct_array_free_loop (st);
 
                ccode.close ();
@@ -280,7 +280,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                var fun = new CCodeFunction ("_vala_array_destroy", "void");
                fun.modifiers = CCodeModifiers.STATIC;
                fun.add_parameter (new CCodeParameter ("array", "gpointer"));
-               fun.add_parameter (new CCodeParameter ("array_length", "gint"));
+               fun.add_parameter (new CCodeParameter ("array_length", get_ccode_name (int_type)));
                fun.add_parameter (new CCodeParameter ("destroy_func", "GDestroyNotify"));
 
                push_function (fun);
@@ -289,7 +289,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                var ccondfunc = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, new CCodeIdentifier ("destroy_func"), new CCodeConstant ("NULL"));
                ccode.open_if (new CCodeBinaryExpression (CCodeBinaryOperator.AND, ccondarr, ccondfunc));
 
-               ccode.add_declaration ("int", new CCodeVariableDeclarator ("i"));
+               ccode.add_declaration (get_ccode_name (int_type), new CCodeVariableDeclarator ("i"));
                append_vala_array_free_loop ();
 
                ccode.close ();
@@ -304,7 +304,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                fun = new CCodeFunction ("_vala_array_free", "void");
                fun.modifiers = CCodeModifiers.STATIC;
                fun.add_parameter (new CCodeParameter ("array", "gpointer"));
-               fun.add_parameter (new CCodeParameter ("array_length", "gint"));
+               fun.add_parameter (new CCodeParameter ("array_length", get_ccode_name (int_type)));
                fun.add_parameter (new CCodeParameter ("destroy_func", "GDestroyNotify"));
 
                push_function (fun);
@@ -335,9 +335,9 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                fun.modifiers = CCodeModifiers.STATIC;
                fun.add_parameter (new CCodeParameter ("array", "gpointer"));
                fun.add_parameter (new CCodeParameter ("element_size", "gsize"));
-               fun.add_parameter (new CCodeParameter ("src", "gint"));
-               fun.add_parameter (new CCodeParameter ("dest", "gint"));
-               fun.add_parameter (new CCodeParameter ("length", "gint"));
+               fun.add_parameter (new CCodeParameter ("src", get_ccode_name (int_type)));
+               fun.add_parameter (new CCodeParameter ("dest", get_ccode_name (int_type)));
+               fun.add_parameter (new CCodeParameter ("length", get_ccode_name (int_type)));
 
                push_function (fun);
 
@@ -391,13 +391,13 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
        }
 
        public override void append_vala_array_length () {
-               var fun = new CCodeFunction ("_vala_array_length", "gint");
+               var fun = new CCodeFunction ("_vala_array_length", get_ccode_name (int_type));
                fun.modifiers = CCodeModifiers.STATIC;
                fun.add_parameter (new CCodeParameter ("array", "gpointer"));
 
                push_function (fun);
 
-               ccode.add_declaration ("int", new CCodeVariableDeclarator ("length", new CCodeConstant ("0")));
+               ccode.add_declaration (get_ccode_name (int_type), new CCodeVariableDeclarator ("length", new CCodeConstant ("0")));
 
                // return 0 if the array is NULL
                // avoids an extra NULL check on the caller side
@@ -495,7 +495,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 
                function.add_parameter (new CCodeParameter ("self", get_ccode_name (array_type)));
                // total length over all dimensions
-               function.add_parameter (new CCodeParameter ("length", "int"));
+               function.add_parameter (new CCodeParameter ("length", get_ccode_name (int_type)));
                if (array_type.element_type is GenericType) {
                        // dup function array elements
                        string func_name = "%s_dup_func".printf (((GenericType) array_type.element_type).type_parameter.name.down ());
@@ -522,7 +522,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                        ccode.add_declaration (get_ccode_name (array_type), cvardecl);
                        ccode.add_assignment (new CCodeIdentifier ("result"), gnew);
 
-                       ccode.add_declaration ("int", new CCodeVariableDeclarator ("i"));
+                       ccode.add_declaration (get_ccode_name (int_type), new CCodeVariableDeclarator ("i"));
 
                        ccode.open_for (new CCodeAssignment (new CCodeIdentifier ("i"), new CCodeConstant ("0")),
                                           new CCodeBinaryExpression (CCodeBinaryOperator.LESS_THAN, new CCodeIdentifier ("i"), new CCodeIdentifier ("length")),
@@ -575,7 +575,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                push_function (function);
 
                if (requires_copy (array_type.element_type)) {
-                       ccode.add_declaration ("int", new CCodeVariableDeclarator ("i"));
+                       ccode.add_declaration (get_ccode_name (int_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)),
@@ -619,8 +619,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", "int*"));
-               function.add_parameter (new CCodeParameter ("size", "int*"));
+               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))));
 
                push_function (function);
 
index 7e0676e219d05f2252445b289190fd565be700c4..97bb84ce74ac2a5e0488901a42f8cf92c22ebba3 100644 (file)
@@ -5611,7 +5611,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                function.modifiers = CCodeModifiers.STATIC;
 
                function.add_parameter (new CCodeParameter ("stack", "%s *".printf (get_ccode_name (array_type.element_type))));
-               function.add_parameter (new CCodeParameter ("stack_length", "int"));
+               function.add_parameter (new CCodeParameter ("stack_length", get_ccode_name (int_type)));
                if (array_type.element_type is StructValueType) {
                        function.add_parameter (new CCodeParameter ("needle", "const %s *".printf (get_ccode_name (array_type.element_type))));
                } else {
@@ -5620,7 +5620,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                push_function (function);
 
-               ccode.add_declaration ("int", new CCodeVariableDeclarator ("i"));
+               ccode.add_declaration (get_ccode_name (int_type), new CCodeVariableDeclarator ("i"));
 
                var cloop_initializer = new CCodeAssignment (new CCodeIdentifier ("i"), new CCodeConstant ("0"));
                var cloop_condition = new CCodeBinaryExpression (CCodeBinaryOperator.LESS_THAN, new CCodeIdentifier ("i"), new CCodeIdentifier ("stack_length"));
@@ -5676,7 +5676,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                if (cmpid.name == "g_strcmp0") {
                        cmp0_func = cmpid.name;
                } else if (add_wrapper (cmp0_func)) {
-                       var cmp0_fun = new CCodeFunction (cmp0_func, "int");
+                       var cmp0_fun = new CCodeFunction (cmp0_func, get_ccode_name (int_type));
                        cmp0_fun.add_parameter (new CCodeParameter ("s1", "const void *"));
                        cmp0_fun.add_parameter (new CCodeParameter ("s2", "const void *"));
                        cmp0_fun.modifiers = CCodeModifiers.STATIC;
index acbc6ae653ad3c5d881eae276972891e3b92e88c..7a4b30394f3ee56ee1b9fad5c099d6eaac9828b2 100644 (file)
@@ -371,14 +371,14 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                        cfile.add_include ("stdio.h");
 
                        var counter = new CCodeIdentifier (prefix + "_counter");
-                       var counter_decl = new CCodeDeclaration ("gint");
+                       var counter_decl = new CCodeDeclaration (get_ccode_name (int_type));
                        counter_decl.add_declarator (new CCodeVariableDeclarator (counter.name));
                        counter_decl.modifiers = CCodeModifiers.STATIC;
                        cfile.add_type_member_declaration (counter_decl);
 
                        // nesting level for recursive functions
                        var level = new CCodeIdentifier (prefix + "_level");
-                       var level_decl = new CCodeDeclaration ("gint");
+                       var level_decl = new CCodeDeclaration (get_ccode_name (int_type));
                        level_decl.add_declarator (new CCodeVariableDeclarator (level.name));
                        level_decl.modifiers = CCodeModifiers.STATIC;
                        cfile.add_type_member_declaration (level_decl);