Commit 39082082f6716e7ffca78566db506edbd6822b53

Ran Benita 2016-02-28T00:33:19

keymap: share LevelsSameSyms() The function is generic enough. Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/src/keymap-priv.c b/src/keymap-priv.c
index d21dda7..08945ca 100644
--- a/src/keymap-priv.c
+++ b/src/keymap-priv.c
@@ -137,3 +137,13 @@ XkbModNameToIndex(const struct xkb_mod_set *mods, xkb_atom_t name,
 
     return XKB_MOD_INVALID;
 }
+
+bool
+XkbLevelsSameSyms(const struct xkb_level *a, const struct xkb_level *b)
+{
+    if (a->num_syms != b->num_syms)
+        return false;
+    if (a->num_syms <= 1)
+        return a->u.sym == b->u.sym;
+    return memcmp(a->u.syms, b->u.syms, sizeof(*a->u.syms) * a->num_syms) == 0;
+}
diff --git a/src/keymap.h b/src/keymap.h
index d20442f..1093e47 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -455,6 +455,9 @@ xkb_mod_index_t
 XkbModNameToIndex(const struct xkb_mod_set *mods, xkb_atom_t name,
                   enum mod_type type);
 
+bool
+XkbLevelsSameSyms(const struct xkb_level *a, const struct xkb_level *b);
+
 xkb_layout_index_t
 XkbWrapGroupIntoRange(int32_t group,
                       xkb_layout_index_t num_groups,
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index cda93b0..9b05ec9 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -218,19 +218,6 @@ KeyInfoText(SymbolsInfo *info, KeyInfo *keyi)
 }
 
 static bool
-LevelsSameSyms(const struct xkb_level *a, const struct xkb_level *b)
-{
-    if (a->num_syms != b->num_syms)
-        return false;
-    if (a->num_syms <= 1)
-        return a->u.sym == b->u.sym;
-    else
-        return memcmp(a->u.syms, b->u.syms,
-                      sizeof(*a->u.syms) * a->num_syms) == 0;
-
-}
-
-static bool
 MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber,
             bool report, xkb_layout_index_t group, xkb_atom_t key_name)
 {
@@ -312,7 +299,7 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber,
                 intoLevel->u.sym = fromLevel->u.sym;
             fromLevel->num_syms = 0;
         }
-        else if (!LevelsSameSyms(fromLevel, intoLevel)) {
+        else if (!XkbLevelsSameSyms(fromLevel, intoLevel)) {
             if (report)
                 log_warn(info->ctx,
                          "Multiple symbols for level %d/group %u on key %s; "