From: Takashi Sakamoto Date: Mon, 11 Apr 2022 08:42:26 +0000 (+0900) Subject: timer: user_instance: use an utility macro to declare GObject-derived object X-Git-Tag: v0.3.0~214 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=2858edca7c5df78af4f3c6de0e2557fb51bf0686;p=alsa-gobject.git timer: user_instance: 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 --- diff --git a/src/timer/user-instance.c b/src/timer/user-instance.c index 98d7971..68b7cec 100644 --- a/src/timer/user-instance.c +++ b/src/timer/user-instance.c @@ -23,11 +23,11 @@ * the user instance is attached to any timer device or the other instance as * slave. */ -struct _ALSATimerUserInstancePrivate { +typedef struct { int fd; ALSATimerEventDataType event_data_type; guint16 proto_ver_triplet[3]; -}; +} ALSATimerUserInstancePrivate; G_DEFINE_TYPE_WITH_PRIVATE(ALSATimerUserInstance, alsatimer_user_instance, G_TYPE_OBJECT) /** diff --git a/src/timer/user-instance.h b/src/timer/user-instance.h index a2694d3..8502326 100644 --- a/src/timer/user-instance.h +++ b/src/timer/user-instance.h @@ -8,40 +8,13 @@ G_BEGIN_DECLS #define ALSATIMER_TYPE_USER_INSTANCE (alsatimer_user_instance_get_type()) -#define ALSATIMER_USER_INSTANCE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - ALSATIMER_TYPE_USER_INSTANCE, \ - ALSATimerUserInstance)) -#define ALSATIMER_IS_USER_INSTANCE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - ALSATIMER_TYPE_USER_INSTANCE)) - -#define ALSATIMER_USER_INSTANCE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - ALSATIMER_TYPE_USER_INSTANCE, \ - ALSATimerUserInstanceClass)) -#define ALSATIMER_IS_USER_INSTANCE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - ALSATIMER_TYPE_USER_INSTANCE)) -#define ALSATIMER_USER_INSTANCE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - ALSATIMER_TYPE_USER_INSTANCE, \ - ALSATimerUserInstanceClass)) +G_DECLARE_DERIVABLE_TYPE(ALSATimerUserInstance, alsatimer_user_instance, ALSATIMER, USER_INSTANCE, + GObject); #define ALSATIMER_USER_INSTANCE_ERROR alsatimer_user_instance_error_quark() GQuark alsatimer_user_instance_error_quark(); -typedef struct _ALSATimerUserInstance ALSATimerUserInstance; -typedef struct _ALSATimerUserInstanceClass ALSATimerUserInstanceClass; -typedef struct _ALSATimerUserInstancePrivate ALSATimerUserInstancePrivate; - -struct _ALSATimerUserInstance { - GObject parent_instance; - - ALSATimerUserInstancePrivate *priv; -}; - struct _ALSATimerUserInstanceClass { GObjectClass parent_class; @@ -67,8 +40,6 @@ struct _ALSATimerUserInstanceClass { void (*handle_disconnection)(ALSATimerUserInstance *self); }; -GType alsatimer_user_instance_get_type() G_GNUC_CONST; - ALSATimerUserInstance *alsatimer_user_instance_new(); void alsatimer_user_instance_open(ALSATimerUserInstance *self, gint open_flag,