summaryrefslogtreecommitdiff
path: root/src/xkbcomp/rules.c
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2014-09-21 17:09:58 +0300
committerRan Benita <ran234@gmail.com>2014-09-21 17:09:58 +0300
commit0224283fdfb76c1d813dbdbb0dc5cb6347d7c29a (patch)
treead508b1f44c5d21c657c19aa1eb2e2f5609849b5 /src/xkbcomp/rules.c
parentf0cd7abcff5976a94aafdd7f47313b0d123ba586 (diff)
downloadlibxkbcommon-0224283fdfb76c1d813dbdbb0dc5cb6347d7c29a.tar.gz
libxkbcommon-0224283fdfb76c1d813dbdbb0dc5cb6347d7c29a.tar.bz2
libxkbcommon-0224283fdfb76c1d813dbdbb0dc5cb6347d7c29a.zip
rules: fix mlvo-not-used warning
An mlvo can also be used in an expansion, but we didn't mark them in this case in commit d8a4f52cb95d989b4. This caused wrongful warnings on something like -l ch -v fr -- the `fr` is only added via expansion. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/xkbcomp/rules.c')
-rw-r--r--src/xkbcomp/rules.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c
index 2d6792a..3a6f57c 100644
--- a/src/xkbcomp/rules.c
+++ b/src/xkbcomp/rules.c
@@ -635,7 +635,7 @@ append_expanded_kccgst_value(struct matcher *m, darray_char *to,
enum rules_mlvo mlv;
xkb_layout_index_t idx;
char pfx, sfx;
- struct sval expanded_value;
+ struct matched_sval *expanded_value;
/* Check if that's a start of an expansion. */
if (s[i] != '%') {
@@ -685,40 +685,42 @@ append_expanded_kccgst_value(struct matcher *m, darray_char *to,
}
/* Get the expanded value. */
- expanded_value.len = 0;
+ expanded_value = NULL;
if (mlv == MLVO_LAYOUT) {
if (idx != XKB_LAYOUT_INVALID &&
idx < darray_size(m->rmlvo.layouts) &&
darray_size(m->rmlvo.layouts) > 1)
- expanded_value = darray_item(m->rmlvo.layouts, idx).sval;
+ expanded_value = &darray_item(m->rmlvo.layouts, idx);
else if (idx == XKB_LAYOUT_INVALID &&
darray_size(m->rmlvo.layouts) == 1)
- expanded_value = darray_item(m->rmlvo.layouts, 0).sval;
+ expanded_value = &darray_item(m->rmlvo.layouts, 0);
}
else if (mlv == MLVO_VARIANT) {
if (idx != XKB_LAYOUT_INVALID &&
idx < darray_size(m->rmlvo.variants) &&
darray_size(m->rmlvo.variants) > 1)
- expanded_value = darray_item(m->rmlvo.variants, idx).sval;
+ expanded_value = &darray_item(m->rmlvo.variants, idx);
else if (idx == XKB_LAYOUT_INVALID &&
darray_size(m->rmlvo.variants) == 1)
- expanded_value = darray_item(m->rmlvo.variants, 0).sval;
+ expanded_value = &darray_item(m->rmlvo.variants, 0);
}
else if (mlv == MLVO_MODEL) {
- expanded_value = m->rmlvo.model.sval;
+ expanded_value = &m->rmlvo.model;
}
/* If we didn't get one, skip silently. */
- if (expanded_value.len <= 0)
+ if (!expanded_value || expanded_value->sval.len == 0)
continue;
if (pfx != 0)
darray_appends_nullterminate(expanded, &pfx, 1);
darray_appends_nullterminate(expanded,
- expanded_value.start, expanded_value.len);
+ expanded_value->sval.start,
+ expanded_value->sval.len);
if (sfx != 0)
darray_appends_nullterminate(expanded, &sfx, 1);
+ expanded_value->matched = true;
}
/*