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 <ran234@gmail.com>
master
Ran Benita 2012-06-29 17:45:47 +03:00
parent 213dcf686f
commit 7111eb8e8a
3 changed files with 15 additions and 17 deletions

View File

@ -779,12 +779,12 @@ CopyInterps(CompatInfo * info,
} }
bool bool
CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge, CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
LEDInfoPtr *unboundLEDs)
{ {
int i; int i;
CompatInfo info; CompatInfo info;
GroupCompatInfo *gcm; GroupCompatInfo *gcm;
LEDInfo *unbound = NULL, *next;
InitCompatInfo(&info, keymap); InitCompatInfo(&info, keymap);
info.dflt.defs.merge = merge; 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 (info.leds != NULL) {
if (!CopyIndicatorMapDefs(keymap, info.leds, unboundLEDs)) if (!CopyIndicatorMapDefs(keymap, info.leds, &unbound))
info.errorCount++; info.errorCount++;
info.leds = NULL; 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); ClearCompatInfo(&info, keymap);
return true; return true;

View File

@ -39,7 +39,6 @@ CompileKeymap(struct xkb_context *ctx, XkbFile *file)
bool ok; bool ok;
enum xkb_file_type mainType; enum xkb_file_type mainType;
const char *mainName; const char *mainName;
LEDInfo *unbound = NULL, *next;
struct xkb_keymap *keymap = XkbcAllocKeyboard(ctx); struct xkb_keymap *keymap = XkbcAllocKeyboard(ctx);
struct { struct {
XkbFile *keycodes; XkbFile *keycodes;
@ -144,7 +143,7 @@ CompileKeymap(struct xkb_context *ctx, XkbFile *file)
goto err; goto err;
} }
if (sections.compat == NULL || if (sections.compat == NULL ||
!CompileCompatMap(sections.compat, keymap, MERGE_OVERRIDE, &unbound)) !CompileCompatMap(sections.compat, keymap, MERGE_OVERRIDE))
{ {
ERROR("Failed to compile compat map\n"); ERROR("Failed to compile compat map\n");
goto err; goto err;
@ -156,10 +155,6 @@ CompileKeymap(struct xkb_context *ctx, XkbFile *file)
goto err; goto err;
} }
ok = BindIndicators(keymap, true, unbound, NULL);
if (!ok)
goto err;
ok = UpdateModifiersFromCompat(keymap); ok = UpdateModifiersFromCompat(keymap);
if (!ok) if (!ok)
goto err; goto err;
@ -169,10 +164,5 @@ CompileKeymap(struct xkb_context *ctx, XkbFile *file)
err: err:
ACTION("Failed to compile keymap\n"); ACTION("Failed to compile keymap\n");
xkb_map_unref(keymap); xkb_map_unref(keymap);
while (unbound) {
next = (LEDInfo *) unbound->defs.next;
free(unbound);
unbound = next;
}
return NULL; return NULL;
} }

View File

@ -258,11 +258,9 @@ extern bool
CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap,
enum merge_mode merge); enum merge_mode merge);
typedef struct _LEDInfo *LEDInfoPtr;
extern bool extern bool
CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap,
enum merge_mode merge, LEDInfoPtr *unboundLEDs); enum merge_mode merge);
extern bool extern bool
CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, CompileSymbols(XkbFile *file, struct xkb_keymap *keymap,