[vala/wip/housekeeping: 3/4] codegen: Simplify get_enum_value_canonical_cconstant()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/housekeeping: 3/4] codegen: Simplify get_enum_value_canonical_cconstant()
- Date: Thu, 3 Nov 2016 18:38:17 +0000 (UTC)
commit 1145e7ff4d9c7d6d26951a16a0df0b8b2bf347f0
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Nov 2 20:47:27 2016 +0100
codegen: Simplify get_enum_value_canonical_cconstant()
codegen/valaccodebasemodule.vala | 19 +------------------
1 files changed, 1 insertions(+), 18 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index ab2e496..d375637 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -6423,24 +6423,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
}
public static CCodeConstant get_enum_value_canonical_cconstant (EnumValue ev) {
- var str = new StringBuilder ("\"");
-
- string i = ev.name;
-
- while (i.length > 0) {
- unichar c = i.get_char ();
- if (c == '_') {
- str.append_c ('-');
- } else {
- str.append_unichar (c.tolower ());
- }
-
- i = i.next_char ();
- }
-
- str.append_c ('"');
-
- return new CCodeConstant (str.str);
+ return new CCodeConstant ("\"%s\"".printf (ev.name.down ().replace ("_", "-")));
}
public bool get_signal_has_emitter (Signal sig) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]