rules: simplify a bit of code 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
diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c
index 5c42f50..de8822b 100644
--- a/src/xkbcomp/rules.c
+++ b/src/xkbcomp/rules.c
@@ -767,24 +767,19 @@ append_expanded_kccgst_value(struct matcher *m, darray_char *to,
/* Check for index. */
idx = XKB_LAYOUT_INVALID;
- if (i < value.len) {
- if (s[i] == '[') {
- int consumed;
-
- if (mlv != MLVO_LAYOUT && mlv != MLVO_VARIANT) {
- matcher_error1(m,
- "invalid index in %%-expansion; "
- "may only index layout or variant");
- goto error;
- }
-
- consumed = extract_layout_index(s + i, value.len - i, &idx);
- if (consumed == -1) goto error;
- i += consumed;
- }
- else {
- idx = XKB_LAYOUT_INVALID;
+ if (i < value.len && s[i] == '[') {
+ int consumed;
+
+ if (mlv != MLVO_LAYOUT && mlv != MLVO_VARIANT) {
+ matcher_error1(m,
+ "invalid index in %%-expansion; "
+ "may only index layout or variant");
+ goto error;
}
+
+ consumed = extract_layout_index(s + i, value.len - i, &idx);
+ if (consumed == -1) goto error;
+ i += consumed;
}
/* Check for suffix, if there supposed to be one. */