impl->destroy cleanup:

- remove trivial destroy() function
 - make sure we check impl and impl->destroy before calling
 - always call free if not implemented
This commit is contained in:
Dominique Martinet 2017-08-14 16:16:20 +02:00
parent ba20d5b3ca
commit 4bbf718e7d
6 changed files with 11 additions and 10 deletions

View file

@ -32,8 +32,10 @@ bool wlr_backend_start(struct wlr_backend *backend) {
}
void wlr_backend_destroy(struct wlr_backend *backend) {
if (backend->impl->destroy) {
if (backend->impl && backend->impl->destroy) {
backend->impl->destroy(backend);
} else {
free(backend);
}
}