Commit ca0d388f99b90fd2e35c8cebd39cce9c741299bc

Ran Benita 2013-10-08T23:09:01

rules: simplify a bit of code Signed-off-by: Ran Benita <ran234@gmail.com>

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. */