tools/demo-server: use _cleanup_foo_ functions for eis and eis_event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-08-27 10:10:40 +10:00
parent 22930d0d2b
commit 5d85ea4c8f

View file

@ -59,6 +59,9 @@ static void sighandler(int signal) {
} }
DEFINE_TRIVIAL_CLEANUP_FUNC(struct eis *, eis_unref); DEFINE_TRIVIAL_CLEANUP_FUNC(struct eis *, eis_unref);
#define _cleanup_eis_ _cleanup_(eis_unrefp)
DEFINE_TRIVIAL_CLEANUP_FUNC(struct eis_event *, eis_event_unref);
#define _cleanup_eis_event_ _cleanup_(eis_event_unrefp)
static void unlink_free(char **path) { static void unlink_free(char **path) {
if (*path) { if (*path) {
@ -252,7 +255,7 @@ int main(int argc, char **argv)
.layout = layout, .layout = layout,
}; };
_cleanup_(eis_unrefp) struct eis *eis = eis_new(NULL); _cleanup_eis_ struct eis *eis = eis_new(NULL);
assert(eis); assert(eis);
if (verbose) if (verbose)
@ -278,7 +281,7 @@ int main(int argc, char **argv)
eis_dispatch(eis); eis_dispatch(eis);
while (true) { while (true) {
struct eis_event *e = eis_get_event(eis); _cleanup_eis_event_ struct eis_event *e = eis_get_event(eis);
if (!e) if (!e)
break; break;
@ -342,7 +345,6 @@ int main(int argc, char **argv)
default: default:
abort(); abort();
} }
eis_event_unref(e);
} }
} }