From: Takashi Sakamoto Date: Mon, 11 Apr 2022 08:42:26 +0000 (+0900) Subject: timer: instance_status: use an utility macro to declare GObject-derived object X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=5b50489b2514191a5c8066f9a7ed8774c1608a8d;p=alsa-gobject.git timer: instance_status: 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/instance-status.c b/src/timer/instance-status.c index ca6f22b..f12f284 100644 --- a/src/timer/instance-status.c +++ b/src/timer/instance-status.c @@ -14,10 +14,10 @@ * * The object wraps 'struct snd_timer_status' in UAPI of Linux sound subsystem. */ -struct _ALSATimerInstanceStatusPrivate { +typedef struct { struct snd_timer_status status; gint64 tstamp[2]; -}; +} ALSATimerInstanceStatusPrivate; G_DEFINE_TYPE_WITH_PRIVATE(ALSATimerInstanceStatus, alsatimer_instance_status, G_TYPE_OBJECT) enum timer_instance_status_props { diff --git a/src/timer/instance-status.h b/src/timer/instance-status.h index b839976..6eef60c 100644 --- a/src/timer/instance-status.h +++ b/src/timer/instance-status.h @@ -8,42 +8,13 @@ G_BEGIN_DECLS #define ALSATIMER_TYPE_INSTANCE_STATUS (alsatimer_instance_status_get_type()) -#define ALSATIMER_INSTANCE_STATUS(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - ALSATIMER_TYPE_INSTANCE_STATUS, \ - ALSATimerInstanceStatus)) -#define ALSATIMER_IS_INSTANCE_STATUS(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - ALSATIMER_TYPE_INSTANCE_STATUS)) - -#define ALSATIMER_INSTANCE_STATUS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - ALSATIMER_TYPE_INSTANCE_STATUS, \ - ALSATimerInstanceStatusClass)) -#define ALSATIMER_IS_INSTANCE_STATUS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - ALSATIMER_TYPE_INSTANCE_STATUS)) -#define ALSATIMER_INSTANCE_STATUS_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - ALSATIMER_TYPE_INSTANCE_STATUS, \ - ALSATimerInstanceStatusClass)) - -typedef struct _ALSATimerInstanceStatus ALSATimerInstanceStatus; -typedef struct _ALSATimerInstanceStatusClass ALSATimerInstanceStatusClass; -typedef struct _ALSATimerInstanceStatusPrivate ALSATimerInstanceStatusPrivate; - -struct _ALSATimerInstanceStatus { - GObject parent_instance; - - ALSATimerInstanceStatusPrivate *priv; -}; +G_DECLARE_DERIVABLE_TYPE(ALSATimerInstanceStatus, alsatimer_instance_status, ALSATIMER, + INSTANCE_STATUS, GObject); struct _ALSATimerInstanceStatusClass { GObjectClass parent_class; }; -GType alsatimer_instance_status_get_type() G_GNUC_CONST; - ALSATimerInstanceStatus *alsatimer_instance_status_new(); void alsatimer_instance_status_get_tstamp(ALSATimerInstanceStatus *self,