From 7111eb8e8a2a7b7d81ea1656e6f1572590da99aa Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 29 Jun 2012 17:45:47 +0300 Subject: [PATCH] compat: move some unclear code where it belongs It seems like at some point it was needed to break the abstraction and perform this piece of code in the context above CompileCompatMap. The extra argument and the typedef look strange now, and doesn't seem to be needed any more, so move them back. Signed-off-by: Ran Benita --- src/xkbcomp/compat.c | 16 +++++++++++++--- src/xkbcomp/keymap.c | 12 +----------- src/xkbcomp/xkbcomp.h | 4 +--- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index 14322c1..d309ccb 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -779,12 +779,12 @@ CopyInterps(CompatInfo * info, } bool -CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge, - LEDInfoPtr *unboundLEDs) +CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) { int i; CompatInfo info; GroupCompatInfo *gcm; + LEDInfo *unbound = NULL, *next; InitCompatInfo(&info, keymap); info.dflt.defs.merge = merge; @@ -820,11 +820,21 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge } if (info.leds != NULL) { - if (!CopyIndicatorMapDefs(keymap, info.leds, unboundLEDs)) + if (!CopyIndicatorMapDefs(keymap, info.leds, &unbound)) info.errorCount++; info.leds = NULL; } + if (!BindIndicators(keymap, true, unbound, NULL)) { + while (unbound) { + next = (LEDInfo *) unbound->defs.next; + free(unbound); + unbound = next; + } + + goto err_info; + } + ClearCompatInfo(&info, keymap); return true; diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c index c4a572f..9b84ab4 100644 --- a/src/xkbcomp/keymap.c +++ b/src/xkbcomp/keymap.c @@ -39,7 +39,6 @@ CompileKeymap(struct xkb_context *ctx, XkbFile *file) bool ok; enum xkb_file_type mainType; const char *mainName; - LEDInfo *unbound = NULL, *next; struct xkb_keymap *keymap = XkbcAllocKeyboard(ctx); struct { XkbFile *keycodes; @@ -144,7 +143,7 @@ CompileKeymap(struct xkb_context *ctx, XkbFile *file) goto err; } if (sections.compat == NULL || - !CompileCompatMap(sections.compat, keymap, MERGE_OVERRIDE, &unbound)) + !CompileCompatMap(sections.compat, keymap, MERGE_OVERRIDE)) { ERROR("Failed to compile compat map\n"); goto err; @@ -156,10 +155,6 @@ CompileKeymap(struct xkb_context *ctx, XkbFile *file) goto err; } - ok = BindIndicators(keymap, true, unbound, NULL); - if (!ok) - goto err; - ok = UpdateModifiersFromCompat(keymap); if (!ok) goto err; @@ -169,10 +164,5 @@ CompileKeymap(struct xkb_context *ctx, XkbFile *file) err: ACTION("Failed to compile keymap\n"); xkb_map_unref(keymap); - while (unbound) { - next = (LEDInfo *) unbound->defs.next; - free(unbound); - unbound = next; - } return NULL; } diff --git a/src/xkbcomp/xkbcomp.h b/src/xkbcomp/xkbcomp.h index 2bc46b5..cf6b5ee 100644 --- a/src/xkbcomp/xkbcomp.h +++ b/src/xkbcomp/xkbcomp.h @@ -258,11 +258,9 @@ extern bool CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge); -typedef struct _LEDInfo *LEDInfoPtr; - extern bool CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, - enum merge_mode merge, LEDInfoPtr *unboundLEDs); + enum merge_mode merge); extern bool CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, -- 2.7.4