Simplify input device destruction code

This commit is contained in:
nyorain 2017-08-14 18:23:20 +02:00
parent f998bb8299
commit aa20634309
3 changed files with 3 additions and 15 deletions

View File

@ -11,11 +11,7 @@ void wlr_keyboard_init(struct wlr_keyboard *kb,
} }
void wlr_keyboard_destroy(struct wlr_keyboard *kb) { void wlr_keyboard_destroy(struct wlr_keyboard *kb) {
if (!kb) { if (kb && kb->impl && kb->impl->destroy) {
return;
}
if (kb->impl && kb->impl->destroy) {
kb->impl->destroy(kb); kb->impl->destroy(kb);
} else { } else {
free(kb); free(kb);

View File

@ -14,11 +14,7 @@ void wlr_pointer_init(struct wlr_pointer *pointer,
} }
void wlr_pointer_destroy(struct wlr_pointer *pointer) { void wlr_pointer_destroy(struct wlr_pointer *pointer) {
if (!pointer) { if (pointer && pointer->impl && pointer->impl->destroy) {
return;
}
if (pointer->impl && pointer->impl->destroy) {
pointer->impl->destroy(pointer); pointer->impl->destroy(pointer);
} else { } else {
free(pointer); free(pointer);

View File

@ -14,11 +14,7 @@ void wlr_touch_init(struct wlr_touch *touch,
} }
void wlr_touch_destroy(struct wlr_touch *touch) { void wlr_touch_destroy(struct wlr_touch *touch) {
if (!touch) { if (touch && touch->impl && touch->impl->destroy) {
return;
}
if (touch->impl && touch->impl->destroy) {
touch->impl->destroy(touch); touch->impl->destroy(touch);
} else { } else {
free(touch); free(touch);