mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-05 17:08:02 +02:00
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:
parent
22930d0d2b
commit
5d85ea4c8f
1 changed files with 5 additions and 3 deletions
|
|
@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue