From 76995ddcd5ddb3115966cd92ad585a21017024fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 18 Dec 2018 20:22:30 +0100 Subject: [PATCH] module/battery: use module common constructor and default destructor --- modules/battery/battery.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/battery/battery.c b/modules/battery/battery.c index 1179c52..27db267 100644 --- a/modules/battery/battery.c +++ b/modules/battery/battery.c @@ -45,7 +45,7 @@ destroy(struct module *mod) m->label->destroy(m->label); free(m); - free(mod); + module_default_destroy(mod); } static struct exposable * @@ -266,14 +266,10 @@ module_battery(const char *battery, struct particle *label, m->manufacturer = NULL; m->model = NULL; - struct module *mod = malloc(sizeof(*mod)); - mod->bar = NULL; + struct module *mod = module_common_new(); mod->private = m; mod->run = &run; mod->destroy = &destroy; mod->content = &content; - mod->begin_expose = &module_default_begin_expose; - mod->expose = &module_default_expose; - mod->end_expose = &module_default_end_expose; return mod; }