module/label: use module common constructor/destructor

This commit is contained in:
Daniel Eklöf 2018-12-19 18:58:10 +01:00
parent 536db672b4
commit 20cb0f0de7

View file

@ -15,7 +15,7 @@ destroy(struct module *mod)
struct private *m = mod->private; struct private *m = mod->private;
m->label->destroy(m->label); m->label->destroy(m->label);
free(m); free(m);
free(mod); module_default_destroy(mod);
} }
static struct exposable * static struct exposable *
@ -37,15 +37,10 @@ module_label(struct particle *label)
struct private *m = malloc(sizeof(*m)); struct private *m = malloc(sizeof(*m));
m->label = label; m->label = label;
struct module *mod = malloc(sizeof(*mod)); struct module *mod = module_common_new();
mod->bar = NULL;
mod->private = m; mod->private = m;
mod->run = &run; mod->run = &run;
mod->destroy = &destroy; mod->destroy = &destroy;
mod->content = &content; mod->content = &content;
mod->begin_expose = &module_default_begin_expose;
mod->expose = &module_default_expose;
mod->end_expose = &module_default_end_expose;
return mod; return mod;
} }