[PATCH weston 2/2] Don't protect xkb_*_unref from NULL
Ran Benita
ran234 at gmail.com
Tue Aug 19 13:59:52 PDT 2014
Since xkbcommon-0.3.0, which is required by weston, a NULL argument
doesn't do anything.
Signed-off-by: Ran Benita <ran234 at gmail.com>
---
src/compositor-wayland.c | 3 +--
src/compositor-x11.c | 3 +--
src/input.c | 9 +++------
src/screen-share.c | 3 +--
4 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 57e850f..5f73c78 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -1464,8 +1464,7 @@ input_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format,
else
weston_seat_init_keyboard(&input->base, keymap);
- if (keymap)
- xkb_keymap_unref(keymap);
+ xkb_keymap_unref(keymap);
return;
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 984d799..3494e34 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -322,8 +322,7 @@ x11_input_create(struct x11_compositor *c, int no_input)
keymap = x11_compositor_get_keymap(c);
if (weston_seat_init_keyboard(&c->core_seat, keymap) < 0)
return -1;
- if (keymap)
- xkb_keymap_unref(keymap);
+ xkb_keymap_unref(keymap);
x11_compositor_setup_xkb(c);
diff --git a/src/input.c b/src/input.c
index 2130789..975cd77 100644
--- a/src/input.c
+++ b/src/input.c
@@ -544,12 +544,10 @@ weston_keyboard_destroy(struct weston_keyboard *keyboard)
#ifdef ENABLE_XKBCOMMON
if (keyboard->seat->compositor->use_xkbcommon) {
- if (keyboard->xkb_state.state != NULL)
- xkb_state_unref(keyboard->xkb_state.state);
+ xkb_state_unref(keyboard->xkb_state.state);
if (keyboard->xkb_info)
weston_xkb_info_destroy(keyboard->xkb_info);
- if (keyboard->pending_keymap)
- xkb_keymap_unref(keyboard->pending_keymap);
+ xkb_keymap_unref(keyboard->pending_keymap);
}
#endif
@@ -1869,8 +1867,7 @@ weston_xkb_info_destroy(struct weston_xkb_info *xkb_info)
if (--xkb_info->ref_count > 0)
return;
- if (xkb_info->keymap)
- xkb_keymap_unref(xkb_info->keymap);
+ xkb_keymap_unref(xkb_info->keymap);
if (xkb_info->keymap_area)
munmap(xkb_info->keymap_area, xkb_info->keymap_size);
diff --git a/src/screen-share.c b/src/screen-share.c
index 9e81ef9..524a0ca 100644
--- a/src/screen-share.c
+++ b/src/screen-share.c
@@ -214,8 +214,7 @@ ss_seat_handle_keymap(void *data, struct wl_keyboard *keyboard,
else
weston_seat_init_keyboard(&seat->base, keymap);
- if (keymap)
- xkb_keymap_unref(keymap);
+ xkb_keymap_unref(keymap);
return;
--
2.0.4
More information about the wayland-devel
mailing list