]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Mark needle parameter of internal array-contains methods as const
authorTimm Bäder <mail@baedert.org>
Thu, 29 Oct 2015 21:09:57 +0000 (22:09 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 28 Nov 2018 15:18:14 +0000 (16:18 +0100)
This will avoid some -Wdiscarded-qualifiers warnings.

Fixes https://gitlab.gnome.org/GNOME/vala/issues/504

codegen/valaccodebasemodule.vala

index 522a6d1c5aed4b34947f64bd6e29c3d4e9447a57..d25c85f3a2f9404729873a1268cc36ea1b74b361 100644 (file)
@@ -5747,9 +5747,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                function.add_parameter (new CCodeParameter ("stack", "%s *".printf (get_ccode_name (array_type.element_type))));
                function.add_parameter (new CCodeParameter ("stack_length", "int"));
                if (array_type.element_type is StructValueType) {
-                       function.add_parameter (new CCodeParameter ("needle", "%s *".printf (get_ccode_name (array_type.element_type))));
+                       function.add_parameter (new CCodeParameter ("needle", "const %s *".printf (get_ccode_name (array_type.element_type))));
                } else {
-                       function.add_parameter (new CCodeParameter ("needle", get_ccode_name (array_type.element_type)));
+                       function.add_parameter (new CCodeParameter ("needle", "const %s".printf (get_ccode_name (array_type.element_type))));
                }
 
                push_function (function);