mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
Add free functions for allocated resources
This commit is contained in:
parent
1e8970b4a9
commit
1aed987301
10 changed files with 96 additions and 10 deletions
16
wayland/types/wlr_wl_output.c
Normal file
16
wayland/types/wlr_wl_output.c
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#include <stdlib.h>
|
||||
#include <wayland-client.h>
|
||||
#include "wlr/wayland.h"
|
||||
#include "wlr/common/list.h"
|
||||
|
||||
void wlr_wl_output_free(struct wlr_wl_output *output) {
|
||||
if (!output) return;
|
||||
if (output->wl_output) wl_output_destroy(output->wl_output);
|
||||
if (output->make) free(output->make);
|
||||
if (output->model) free(output->model);
|
||||
for (size_t i = 0; output->modes && i < output->modes->length; ++i) {
|
||||
free(output->modes->items[i]);
|
||||
}
|
||||
list_free(output->modes);
|
||||
free(output);
|
||||
}
|
||||
19
wayland/types/wlr_wl_seat.c
Normal file
19
wayland/types/wlr_wl_seat.c
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include <stdlib.h>
|
||||
#include <wayland-client.h>
|
||||
#include "wlr/wayland.h"
|
||||
#include "wlr/common/list.h"
|
||||
|
||||
void wlr_wl_seat_free(struct wlr_wl_seat *seat) {
|
||||
if (!seat) return;
|
||||
if (seat->wl_seat) wl_seat_destroy(seat->wl_seat);
|
||||
if (seat->name) free(seat->name);
|
||||
if (seat->keyboards) {
|
||||
// TODO: free children
|
||||
list_free(seat->keyboards);
|
||||
}
|
||||
if (seat->pointers) {
|
||||
// TODO: free children
|
||||
list_free(seat->keyboards);
|
||||
}
|
||||
free(seat);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue