rules: allow wildcard match against "" layout/varaint Currently, if you pass in an rmlvo with an empty string for layout or variant, it would not match layout and variant rules even with wildcards. But if the rules file had set an appropriate default, and someone passes in the empty string, than he should get the default. NULL in this case signifies not wanting to match against the layout or variant at all, and so the rule should still fail to match NULLs. Signed-off-by: Ran Benita <ran234@gmail.com>
diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c
index 90e70b6..16cb085 100644
--- a/src/xkbcomp/rules.c
+++ b/src/xkbcomp/rules.c
@@ -788,8 +788,7 @@ apply_rule_if_matches(struct rules *rules, struct rule *rule,
}
if (rule->layout) {
- if (mdefs->layout[rule->layout_num] == NULL ||
- *mdefs->layout[rule->layout_num] == '\0')
+ if (mdefs->layout[rule->layout_num] == NULL)
return 0;
if (strcmp(rule->layout, "*") == 0) {
@@ -807,8 +806,7 @@ apply_rule_if_matches(struct rules *rules, struct rule *rule,
}
if (rule->variant) {
- if (mdefs->variant[rule->variant_num] == NULL ||
- *mdefs->variant[rule->variant_num] == '\0')
+ if (mdefs->variant[rule->variant_num] == NULL)
return 0;
if (strcmp(rule->variant, "*") == 0) {