Use struct initializers instead of memset()

This is a bit more type-safe.
This commit is contained in:
Simon Ser 2023-07-07 14:34:56 +02:00
parent 4966857f21
commit 7a9f8d8d6b
34 changed files with 134 additions and 113 deletions

View file

@ -34,9 +34,10 @@ void xwm_selection_transfer_destroy_property_reply(
void xwm_selection_transfer_init(struct wlr_xwm_selection_transfer *transfer,
struct wlr_xwm_selection *selection) {
memset(transfer, 0, sizeof(*transfer));
transfer->selection = selection;
transfer->wl_client_fd = -1;
*transfer = (struct wlr_xwm_selection_transfer){
.selection = selection,
.wl_client_fd = -1,
};
}
void xwm_selection_transfer_destroy(
@ -175,14 +176,14 @@ int xwm_handle_selection_event(struct wlr_xwm *xwm,
void xwm_selection_init(struct wlr_xwm_selection *selection,
struct wlr_xwm *xwm, xcb_atom_t atom) {
memset(selection, 0, sizeof(*selection));
*selection = (struct wlr_xwm_selection){
.xwm = xwm,
.atom = atom,
.window = xcb_generate_id(xwm->xcb_conn),
};
wl_list_init(&selection->incoming);
wl_list_init(&selection->outgoing);
selection->xwm = xwm;
selection->atom = atom;
selection->window = xcb_generate_id(xwm->xcb_conn);
if (atom == xwm->atoms[DND_SELECTION]) {
xcb_create_window(
xwm->xcb_conn,