Commit 7d9f031341672f0df4fcc12a3066400326a5395f

Ran Benita 2012-07-15T13:00:04

Get rid of struct xkb_key_name Just embed it directly. Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/src/keymap-dump.c b/src/keymap-dump.c
index fbe0c9b..1d99e35 100644
--- a/src/keymap-dump.c
+++ b/src/keymap-dump.c
@@ -327,11 +327,11 @@ write_keycodes(struct xkb_keymap *keymap, char **buf, size_t *size,
 
     for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
         key = XkbKey(keymap, kc);
-        if (key->name.name[0] == '\0')
+        if (key->name[0] == '\0')
             continue;
 
         write_buf(keymap, buf, size, offset, "\t\t%6s = %d;\n",
-                  XkbcKeyNameText(key->name.name), kc);
+                  XkbcKeyNameText(key->name), kc);
     }
 
     for (i = 0; i < XkbNumIndicators; i++) {
@@ -811,7 +811,7 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
             continue;
 
         write_buf(keymap, buf, size, offset, "\t\tkey %6s {",
-                  XkbcKeyNameText(key->name.name));
+                  XkbcKeyNameText(key->name));
 
         if (key->explicit & XkbExplicitKeyTypesMask) {
             bool multi_type = false;
@@ -935,7 +935,7 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
             write_buf(keymap, buf, size, offset,
                       "\t\tmodifier_map %s { %s };\n",
                       get_mod_index_text(mod),
-                      XkbcKeyNameText(key->name.name));
+                      XkbcKeyNameText(key->name));
         }
     }
 
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index 3c0ecab..4b0fcc2 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -284,10 +284,6 @@ struct xkb_indicator_map {
     unsigned int ctrls;
 };
 
-struct xkb_key_name {
-    char name[XkbKeyNameLength];
-};
-
 struct xkb_key_alias {
     char real[XkbKeyNameLength];
     char alias[XkbKeyNameLength];
@@ -310,7 +306,7 @@ struct xkb_controls {
 };
 
 struct xkb_key {
-    struct xkb_key_name name;
+    char name[XkbKeyNameLength];
     unsigned char explicit;
     struct xkb_sym_map sym_map;
     unsigned char modmap;
diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c
index 7a48cd4..964b777 100644
--- a/src/xkbcomp/action.c
+++ b/src/xkbcomp/action.c
@@ -812,11 +812,11 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action,
     case F_Keycode:
         if (!ExprResolveKeyName(keymap->ctx, value, &rtrn))
             return ReportMismatch(action->type, field, "key name");
-        tmp = KeyNameToLong(rtrn.keyName.name);
+        tmp = KeyNameToLong(rtrn.name);
         if (!FindNamedKey(keymap, tmp, &kc, true, CreateKeyNames(keymap),
                           0)) {
             return ReportNotFound(action->type, field, "Key",
-                                  XkbcKeyNameText(rtrn.keyName.name));
+                                  XkbcKeyNameText(rtrn.name));
         }
         act->new_kc = kc;
         return true;
diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c
index f44acb2..2dcc74c 100644
--- a/src/xkbcomp/expr.c
+++ b/src/xkbcomp/expr.c
@@ -779,7 +779,7 @@ ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
                   exprTypeText(expr->type));
             return false;
         }
-        memcpy(val_rtrn->keyName.name, expr->value.keyName, XkbKeyNameLength);
+        memcpy(val_rtrn->name, expr->value.keyName, XkbKeyNameLength);
         return true;
 
     case ExprIdent:
diff --git a/src/xkbcomp/expr.h b/src/xkbcomp/expr.h
index c4371b4..7b48c95 100644
--- a/src/xkbcomp/expr.h
+++ b/src/xkbcomp/expr.h
@@ -33,7 +33,7 @@ typedef union _ExprResult {
     char *str;
     int ival;
     unsigned uval;
-    struct xkb_key_name keyName;
+    char name[XkbKeyNameLength];
 } ExprResult;
 
 extern int
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index 9ff9f37..e77e047 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -757,7 +757,7 @@ CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
     darray_resize0(keymap->keys, keymap->max_key_code + 1);
     for (kc = info.computedMin; kc <= info.computedMax; kc++)
         LongToKeyName(darray_item(info.names, kc),
-                      XkbKey(keymap, kc)->name.name);
+                      XkbKey(keymap, kc)->name);
 
     if (info.name)
         keymap->keycodes_section_name = strdup(info.name);
diff --git a/src/xkbcomp/misc.c b/src/xkbcomp/misc.c
index e10a23e..bc1ab42 100644
--- a/src/xkbcomp/misc.c
+++ b/src/xkbcomp/misc.c
@@ -231,7 +231,7 @@ FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
         unsigned long tmp;
         key = XkbKey(keymap, kc);
 
-        tmp = KeyNameToLong(key->name.name);
+        tmp = KeyNameToLong(key->name);
         if (tmp == name) {
             *kc_rtrn = kc;
             return true;
@@ -252,10 +252,10 @@ FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
         for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
             key = XkbKey(keymap, kc);
 
-            if (key->name.name[0] == '\0') {
+            if (key->name[0] == '\0') {
                 char buf[XkbKeyNameLength + 1];
                 LongToKeyName(name, buf);
-                memcpy(key->name.name, buf, XkbKeyNameLength);
+                memcpy(key->name, buf, XkbKeyNameLength);
                 *kc_rtrn = kc;
                 return true;
             }
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 0adc819..eede0c5 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -1966,12 +1966,12 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap,
     if (warningLevel > 3) {
         for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
             key = XkbKey(keymap, kc);
-            if (key->name.name[0] == '\0')
+            if (key->name[0] == '\0')
                 continue;
 
             if (XkbKeyNumGroups(keymap, kc) < 1)
                 WARN("No symbols defined for <%.4s> (keycode %d)\n",
-                     key->name.name, kc);
+                     key->name, kc);
         }
     }