]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix handling of empty cprefix in CCode attribute of a namespace
authorJürg Billeter <j@bitron.ch>
Sat, 9 May 2009 15:08:45 +0000 (17:08 +0200)
committerJürg Billeter <j@bitron.ch>
Sat, 9 May 2009 15:08:45 +0000 (17:08 +0200)
vala/valanamespace.vala

index 285910b61172bd714a0fb51e1ff081aee41b3af5..14f93c45191d4c28c9b83de5dfa56c46ea70eca4 100644 (file)
@@ -441,7 +441,6 @@ public class Vala.Namespace : Symbol {
         * @param cprefixes the camel case prefixes used in C code
         */
        public void add_cprefix (string cprefix) {
-               return_if_fail (cprefix.len() >= 1);
                cprefixes.add (cprefix);
        }
 
@@ -504,8 +503,15 @@ public class Vala.Namespace : Symbol {
 
        private void process_ccode_attribute (Attribute a) {
                if (a.has_argument ("cprefix")) {
-                       foreach (string name in a.get_string ("cprefix").split (","))
-                               add_cprefix (name);
+                       string value = a.get_string ("cprefix");
+                       if (value == "") {
+                               // split of an empty string returns an empty array
+                               add_cprefix ("");
+                       } else {
+                               foreach (string name in value.split (",")) {
+                                       add_cprefix (name);
+                               }
+                       }
                }
                if (a.has_argument ("lower_case_cprefix")) {
                        set_lower_case_cprefix (a.get_string ("lower_case_cprefix"));