Remove 'force' argument from BindIndicators It was always true in the one callsite, so just remove the other branches. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index d309ccb..b88623f 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -825,7 +825,7 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge
info.leds = NULL;
}
- if (!BindIndicators(keymap, true, unbound, NULL)) {
+ if (!BindIndicators(keymap, unbound, NULL)) {
while (unbound) {
next = (LEDInfo *) unbound->defs.next;
free(unbound);
diff --git a/src/xkbcomp/indicators.c b/src/xkbcomp/indicators.c
index 328bf3f..7c0f9b6 100644
--- a/src/xkbcomp/indicators.c
+++ b/src/xkbcomp/indicators.c
@@ -433,8 +433,7 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds,
}
bool
-BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound,
- LEDInfo **unboundRtrn)
+BindIndicators(struct xkb_keymap *keymap, LEDInfo *unbound, LEDInfo **unboundRtrn)
{
int i;
LEDInfo *led, *next, *last;
@@ -457,31 +456,28 @@ BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound,
}
}
}
- if (force)
+ for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next)
{
- for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next)
+ if (led->indicator == _LED_NotBound)
{
- if (led->indicator == _LED_NotBound)
+ for (i = 0; i < XkbNumIndicators; i++)
{
- for (i = 0; i < XkbNumIndicators; i++)
+ if (keymap->names->indicators[i] == NULL)
{
- if (keymap->names->indicators[i] == NULL)
- {
- keymap->names->indicators[i] =
- xkb_atom_strdup(keymap->ctx, led->name);
- led->indicator = i + 1;
- break;
- }
- }
- if (led->indicator == _LED_NotBound)
- {
- ERROR("No unnamed indicators found\n");
- ACTION
- ("Virtual indicator map \"%s\" not bound\n",
- xkb_atom_text(keymap->ctx, led->name));
- continue;
+ keymap->names->indicators[i] =
+ xkb_atom_strdup(keymap->ctx, led->name);
+ led->indicator = i + 1;
+ break;
}
}
+ if (led->indicator == _LED_NotBound)
+ {
+ ERROR("No unnamed indicators found\n");
+ ACTION
+ ("Virtual indicator map \"%s\" not bound\n",
+ xkb_atom_text(keymap->ctx, led->name));
+ continue;
+ }
}
}
}
@@ -490,19 +486,8 @@ BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound,
next = (LEDInfo *) led->defs.next;
if (led->indicator == _LED_NotBound)
{
- if (force)
- {
- unbound = next;
- free(led);
- }
- else
- {
- if (last)
- last->defs.next = &led->defs;
- else
- unbound = led;
- last = led;
- }
+ unbound = next;
+ free(led);
}
else
{
@@ -516,19 +501,8 @@ BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound,
ACTION("Using %s, ignoring %s\n", old,
xkb_atom_text(keymap->ctx, led->name));
led->indicator = _LED_NotBound;
- if (force)
- {
- free(led);
- unbound = next;
- }
- else
- {
- if (last)
- last->defs.next = &led->defs;
- else
- unbound = led;
- last = led;
- }
+ unbound = next;
+ free(led);
}
else
{
diff --git a/src/xkbcomp/indicators.h b/src/xkbcomp/indicators.h
index 66d8b82..6d7f2b0 100644
--- a/src/xkbcomp/indicators.h
+++ b/src/xkbcomp/indicators.h
@@ -73,7 +73,7 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds,
LEDInfo **unboundRtrn);
extern bool
-BindIndicators(struct xkb_keymap *keymap, bool force, LEDInfo *unbound,
+BindIndicators(struct xkb_keymap *keymap, LEDInfo *unbound,
LEDInfo **unboundRtrn);
#endif /* INDICATORS_H */