summaryrefslogtreecommitdiff
path: root/test/state.c
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-10-29 01:00:27 +0200
committerRan Benita <ran234@gmail.com>2012-10-29 01:20:04 +0200
commit7261f404d201b157dc0ce1ae0386fd74f3a128a7 (patch)
treefbd0cf78ce7ace10dc1f79042163be0ab0b3528a /test/state.c
parenta51ee70419cf492a46020123294c7f708c81070d (diff)
downloadlibxkbcommon-7261f404d201b157dc0ce1ae0386fd74f3a128a7.tar.gz
libxkbcommon-7261f404d201b157dc0ce1ae0386fd74f3a128a7.tar.bz2
libxkbcommon-7261f404d201b157dc0ce1ae0386fd74f3a128a7.zip
state, context: allow passing NULL to *_unref()
For error handling code, it's nice to be able to pass NULL to these function without worrying about segfaults ensuing. free() sets the precedent here. Also document this fact. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'test/state.c')
-rw-r--r--test/state.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/state.c b/test/state.c
index d23b94c..83a8f45 100644
--- a/test/state.c
+++ b/test/state.c
@@ -339,6 +339,11 @@ main(void)
assert(context);
+ /* Make sure these are allowed. */
+ xkb_context_unref(NULL);
+ xkb_keymap_unref(NULL);
+ xkb_state_unref(NULL);
+
keymap = test_compile_rules(context, "evdev", "pc104", "us,ru", NULL, "grp:menu_toggle");
assert(keymap);