summaryrefslogtreecommitdiff
path: root/test/common.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2013-03-01 23:47:59 -0800
committerDaniel Stone <daniel@fooishbar.org>2013-03-19 10:54:23 +0000
commit40c46ecd5b3fdb1d92c7b1745b374184509311cd (patch)
tree89fbaaba5d91402d58cc3ce2c4ece88fee13b90f /test/common.c
parent22ba1fa1a63ba230a8435c50571e7b759d7426ed (diff)
downloadxorg-lib-libxkbcommon-40c46ecd5b3fdb1d92c7b1745b374184509311cd.tar.gz
Allow NULL rmlvo for xkb_keymap_new_from_names
Previously we allowed you to pass a names struct with five NULL members, but not just pass NULL for the struct itself. This was pretty dumb. :( Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'test/common.c')
-rw-r--r--test/common.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/common.c b/test/common.c
index 2ed23cf..2ea2e5b 100644
--- a/test/common.c
+++ b/test/common.c
@@ -259,14 +259,18 @@ test_compile_rules(struct xkb_context *context, const char *rules,
{
struct xkb_keymap *keymap;
struct xkb_rule_names rmlvo = {
- .rules = rules,
- .model = model,
- .layout = layout,
- .variant = variant,
- .options = options
+ .rules = isempty(rules) ? NULL : rules,
+ .model = isempty(model) ? NULL : model,
+ .layout = isempty(layout) ? NULL : layout,
+ .variant = isempty(variant) ? NULL : variant,
+ .options = isempty(options) ? NULL : options
};
- keymap = xkb_keymap_new_from_names(context, &rmlvo, 0);
+ if (!rules && !model && !layout && !variant && !options)
+ keymap = xkb_keymap_new_from_names(context, NULL, 0);
+ else
+ keymap = xkb_keymap_new_from_names(context, &rmlvo, 0);
+
if (!keymap) {
fprintf(stderr,
"Failed to compile RMLVO: '%s', '%s', '%s', '%s', '%s'\n",