rules: allow wildcard match against "" layout/varaint
authorRan Benita <ran234@gmail.com>
Sat, 19 May 2012 09:50:47 +0000 (12:50 +0300)
committerRan Benita <ran234@gmail.com>
Sun, 20 May 2012 17:31:49 +0000 (20:31 +0300)
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>
src/xkbcomp/rules.c

index 90e70b6..16cb085 100644 (file)
@@ -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) {