diff options
author | nyorain <nyorain@gmail.com> | 2017-08-14 18:23:20 +0200 |
---|---|---|
committer | nyorain <nyorain@gmail.com> | 2017-08-14 18:23:20 +0200 |
commit | aa20634309669c967c53a1aae8aaab7ee0553a8a (patch) | |
tree | 563ff6848695671ae426e15a5ac12b1f777b44be | |
parent | f998bb82995c2086e05b0949bef76506740407f4 (diff) |
Simplify input device destruction code
-rw-r--r-- | types/wlr_keyboard.c | 6 | ||||
-rw-r--r-- | types/wlr_pointer.c | 6 | ||||
-rw-r--r-- | types/wlr_touch.c | 6 |
3 files changed, 3 insertions, 15 deletions
diff --git a/types/wlr_keyboard.c b/types/wlr_keyboard.c index faa2e669..02b3842d 100644 --- a/types/wlr_keyboard.c +++ b/types/wlr_keyboard.c @@ -11,11 +11,7 @@ void wlr_keyboard_init(struct wlr_keyboard *kb, } void wlr_keyboard_destroy(struct wlr_keyboard *kb) { - if (!kb) { - return; - } - - if (kb->impl && kb->impl->destroy) { + if (kb && kb->impl && kb->impl->destroy) { kb->impl->destroy(kb); } else { free(kb); diff --git a/types/wlr_pointer.c b/types/wlr_pointer.c index 5cbc8cdf..74856762 100644 --- a/types/wlr_pointer.c +++ b/types/wlr_pointer.c @@ -14,11 +14,7 @@ void wlr_pointer_init(struct wlr_pointer *pointer, } void wlr_pointer_destroy(struct wlr_pointer *pointer) { - if (!pointer) { - return; - } - - if (pointer->impl && pointer->impl->destroy) { + if (pointer && pointer->impl && pointer->impl->destroy) { pointer->impl->destroy(pointer); } else { free(pointer); diff --git a/types/wlr_touch.c b/types/wlr_touch.c index ae3beed0..5db653e7 100644 --- a/types/wlr_touch.c +++ b/types/wlr_touch.c @@ -14,11 +14,7 @@ void wlr_touch_init(struct wlr_touch *touch, } void wlr_touch_destroy(struct wlr_touch *touch) { - if (!touch) { - return; - } - - if (touch->impl && touch->impl->destroy) { + if (touch && touch->impl && touch->impl->destroy) { touch->impl->destroy(touch); } else { free(touch); |