common: Add znew/znew_n() macros

This commit is contained in:
John Lindgren 2022-09-18 15:22:26 -04:00
parent da57483961
commit a54d378e6c
26 changed files with 47 additions and 47 deletions

View file

@ -105,7 +105,7 @@ action_create(const char *action_name)
wlr_log(WLR_ERROR, "action name not specified");
return NULL;
}
struct action *action = xzalloc(sizeof(struct action));
struct action *action = znew(*action);
action->type = action_type_from_str(action_name);
wl_list_init(&action->args);
return action;
@ -372,7 +372,7 @@ void
action_arg_add_str(struct action *action, char *key, const char *value)
{
assert(value && "Tried to add NULL action string argument");
struct action_arg_str *arg = xzalloc(sizeof(*arg));
struct action_arg_str *arg = znew(*arg);
arg->base.type = LAB_ACTION_ARG_STR;
if (key) {
arg->base.key = xstrdup(key);