[vala] Fix handling of empty cprefix in CCode attribute of a namespace
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [vala] Fix handling of empty cprefix in CCode attribute of a namespace
- Date: Sat, 9 May 2009 11:10:33 -0400 (EDT)
commit c8cf48bdfcc72ee67adb44a64a89deef27b24fb0
Author: Jürg Billeter <j bitron ch>
Date: Sat May 9 17:08:45 2009 +0200
Fix handling of empty cprefix in CCode attribute of a namespace
---
vala/valanamespace.vala | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index 285910b..14f93c4 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"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]