Tiny reformatting Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index f041f70..49f7d4c 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -34,7 +34,7 @@ unsigned int warningLevel = 0;
#define ISEMPTY(str) (!(str) || (strlen(str) == 0))
static XkbFile *
-XkbKeymapFileFromComponents(struct xkb_context *ctx,
+keymap_file_from_components(struct xkb_context *ctx,
const struct xkb_component_names *ktcsg)
{
XkbFile *keycodes, *types, *compat, *symbols;
@@ -63,37 +63,6 @@ XkbKeymapFileFromComponents(struct xkb_context *ctx,
&keycodes->common, 0);
}
-_X_EXPORT struct xkb_keymap *
-xkb_map_new_from_names(struct xkb_context *ctx,
- const struct xkb_rule_names *rmlvo,
- enum xkb_map_compile_flags flags)
-{
- struct xkb_component_names *kkctgs;
- struct xkb_keymap *keymap;
-
- if (!rmlvo || ISEMPTY(rmlvo->rules) || ISEMPTY(rmlvo->layout)) {
- ERROR("rules and layout required to generate XKB keymap\n");
- return NULL;
- }
-
- kkctgs = xkb_components_from_rules(ctx, rmlvo);
- if (!kkctgs) {
- ERROR("failed to generate XKB components from rules \"%s\"\n",
- rmlvo->rules);
- return NULL;
- }
-
- keymap = xkb_map_new_from_kccgst(ctx, kkctgs, 0);
-
- free(kkctgs->keycodes);
- free(kkctgs->types);
- free(kkctgs->compat);
- free(kkctgs->symbols);
- free(kkctgs);
-
- return keymap;
-}
-
static struct xkb_keymap *
compile_keymap(struct xkb_context *ctx, XkbFile *file)
{
@@ -137,7 +106,8 @@ xkb_map_new_from_kccgst(struct xkb_context *ctx,
return NULL;
}
- if (!(file = XkbKeymapFileFromComponents(ctx, kccgst))) {
+ file = keymap_file_from_components(ctx, kccgst);
+ if (!file) {
ERROR("failed to generate parsed XKB file from components\n");
return NULL;
}
@@ -146,6 +116,37 @@ xkb_map_new_from_kccgst(struct xkb_context *ctx,
}
_X_EXPORT struct xkb_keymap *
+xkb_map_new_from_names(struct xkb_context *ctx,
+ const struct xkb_rule_names *rmlvo,
+ enum xkb_map_compile_flags flags)
+{
+ struct xkb_component_names *kkctgs;
+ struct xkb_keymap *keymap;
+
+ if (!rmlvo || ISEMPTY(rmlvo->rules) || ISEMPTY(rmlvo->layout)) {
+ ERROR("rules and layout required to generate XKB keymap\n");
+ return NULL;
+ }
+
+ kkctgs = xkb_components_from_rules(ctx, rmlvo);
+ if (!kkctgs) {
+ ERROR("failed to generate XKB components from rules \"%s\"\n",
+ rmlvo->rules);
+ return NULL;
+ }
+
+ keymap = xkb_map_new_from_kccgst(ctx, kkctgs, 0);
+
+ free(kkctgs->keycodes);
+ free(kkctgs->types);
+ free(kkctgs->compat);
+ free(kkctgs->symbols);
+ free(kkctgs);
+
+ return keymap;
+}
+
+_X_EXPORT struct xkb_keymap *
xkb_map_new_from_string(struct xkb_context *ctx,
const char *string,
enum xkb_keymap_format format,