From: Jürg Billeter Date: Sat, 9 May 2009 15:08:45 +0000 (+0200) Subject: Fix handling of empty cprefix in CCode attribute of a namespace X-Git-Tag: 0.7.3~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8cf48bdfcc72ee67adb44a64a89deef27b24fb0;p=thirdparty%2Fvala.git Fix handling of empty cprefix in CCode attribute of a namespace --- diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala index 285910b61..14f93c451 100644 --- a/vala/valanamespace.vala +++ b/vala/valanamespace.vala @@ -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"));