From cf86daf3ce43d03450658b068a1fb115218401e0 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Mon, 11 Apr 2022 17:42:26 +0900 Subject: [PATCH] timer: instance_info: use an utility macro to declare GObject-derived object Since gobject v2.44, an utility macro is available to declare GObject-derived objects. This commit replaces existent boireplates with it. Signed-off-by: Takashi Sakamoto --- src/timer/instance-info.c | 4 ++-- src/timer/instance-info.h | 33 ++------------------------------- 2 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/timer/instance-info.c b/src/timer/instance-info.c index 9679578..0513799 100644 --- a/src/timer/instance-info.c +++ b/src/timer/instance-info.c @@ -13,9 +13,9 @@ * * The object wraps 'struct snd_timer_info' in UAPI of Linux sound subsystem. */ -struct _ALSATimerInstanceInfoPrivate { +typedef struct { struct snd_timer_info info; -}; +} ALSATimerInstanceInfoPrivate; G_DEFINE_TYPE_WITH_PRIVATE(ALSATimerInstanceInfo, alsatimer_instance_info, G_TYPE_OBJECT) enum timer_instance_info_props { diff --git a/src/timer/instance-info.h b/src/timer/instance-info.h index fac227f..0884e40 100644 --- a/src/timer/instance-info.h +++ b/src/timer/instance-info.h @@ -8,42 +8,13 @@ G_BEGIN_DECLS #define ALSATIMER_TYPE_INSTANCE_INFO (alsatimer_instance_info_get_type()) -#define ALSATIMER_INSTANCE_INFO(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - ALSATIMER_TYPE_INSTANCE_INFO, \ - ALSATimerInstanceInfo)) -#define ALSATIMER_IS_INSTANCE_INFO(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - ALSATIMER_TYPE_INSTANCE_INFO)) - -#define ALSATIMER_INSTANCE_INFO_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - ALSATIMER_TYPE_INSTANCE_INFO, \ - ALSATimerInstanceInfoClass)) -#define ALSATIMER_IS_INSTANCE_INFO_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - ALSATIMER_TYPE_INSTANCE_INFO)) -#define ALSATIMER_INSTANCE_INFO_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - ALSATIMER_TYPE_INSTANCE_INFO, \ - ALSATimerInstanceInfoClass)) - -typedef struct _ALSATimerInstanceInfo ALSATimerInstanceInfo; -typedef struct _ALSATimerInstanceInfoClass ALSATimerInstanceInfoClass; -typedef struct _ALSATimerInstanceInfoPrivate ALSATimerInstanceInfoPrivate; - -struct _ALSATimerInstanceInfo { - GObject parent_instance; - - ALSATimerInstanceInfoPrivate *priv; -}; +G_DECLARE_DERIVABLE_TYPE(ALSATimerInstanceInfo, alsatimer_instance_info, ALSATIMER, INSTANCE_INFO, + GObject); struct _ALSATimerInstanceInfoClass { GObjectClass parent_class; }; -GType alsatimer_instance_info_get_type() G_GNUC_CONST; - G_END_DECLS #endif -- 2.47.3