mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-04-04 23:50:38 +02:00
libei: use a #define for cleaning up a device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
fd9035dfe6
commit
14d6c87974
1 changed files with 7 additions and 5 deletions
|
|
@ -42,6 +42,8 @@ _public_
|
|||
OBJECT_IMPLEMENT_REF(ei_device);
|
||||
_public_
|
||||
OBJECT_IMPLEMENT_UNREF(ei_device);
|
||||
#define _cleanup_ei_device_ _cleanup_(ei_device_cleanup)
|
||||
|
||||
OBJECT_IMPLEMENT_CREATE(ei_device);
|
||||
static
|
||||
OBJECT_IMPLEMENT_PARENT(ei_device, ei);
|
||||
|
|
@ -208,9 +210,9 @@ static MunitResult
|
|||
test_device_ids(const MunitParameter params[], void *user_data)
|
||||
{
|
||||
struct ei ei = {0};
|
||||
_cleanup_(ei_device_cleanup) struct ei_device *d1 = ei_device_new(&ei);
|
||||
_cleanup_(ei_device_cleanup) struct ei_device *d2 = ei_device_new(&ei);
|
||||
_cleanup_(ei_device_cleanup) struct ei_device *d3 = ei_device_new(&ei);
|
||||
_cleanup_ei_device_ struct ei_device *d1 = ei_device_new(&ei);
|
||||
_cleanup_ei_device_ struct ei_device *d2 = ei_device_new(&ei);
|
||||
_cleanup_ei_device_ struct ei_device *d3 = ei_device_new(&ei);
|
||||
|
||||
munit_assert_int(d1->id, <, d2->id);
|
||||
munit_assert_int(d1->id, <, d3->id);
|
||||
|
|
@ -245,7 +247,7 @@ static MunitResult
|
|||
test_device_cap(const MunitParameter params[], void *user_data)
|
||||
{
|
||||
struct ei ei = {0};
|
||||
_cleanup_(ei_device_cleanup) struct ei_device *d = ei_device_new(&ei);
|
||||
_cleanup_ei_device_ struct ei_device *d = ei_device_new(&ei);
|
||||
|
||||
munit_assert(ei_device_configure_capability(d, EI_DEVICE_CAP_POINTER));
|
||||
/* twice is fine */
|
||||
|
|
@ -274,7 +276,7 @@ static MunitResult
|
|||
test_device_context(const MunitParameter params[], void *user_data)
|
||||
{
|
||||
struct ei ei = {0};
|
||||
_cleanup_(ei_device_cleanup) struct ei_device *d = ei_device_new(&ei);
|
||||
_cleanup_ei_device_ struct ei_device *d = ei_device_new(&ei);
|
||||
|
||||
munit_assert_ptr_equal(d->object.parent, &ei);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue