common: Add additional memory utilities (xzalloc() etc.)

This commit is contained in:
John Lindgren 2022-09-16 18:41:02 -04:00
parent b89f7bfc0d
commit cb40cdc36c
35 changed files with 193 additions and 167 deletions

View file

@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "common/mem.h"
#include "labwc.h"
struct xdg_deco {
@ -43,10 +44,7 @@ xdg_toplevel_decoration(struct wl_listener *listener, void *data)
struct server *server =
wl_container_of(listener, server, xdg_toplevel_decoration);
struct wlr_xdg_toplevel_decoration_v1 *wlr_decoration = data;
struct xdg_deco *xdg_deco = calloc(1, sizeof(struct xdg_deco));
if (!xdg_deco) {
return;
}
struct xdg_deco *xdg_deco = xzalloc(sizeof(struct xdg_deco));
xdg_deco->wlr_decoration = wlr_decoration;
xdg_deco->server = server;
xdg_deco->view = wlr_decoration->surface->data;