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
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;

View File

@ -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;
}

View File

@ -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,