From: Takashi Sakamoto Date: Mon, 11 Apr 2022 08:42:26 +0000 (+0900) Subject: timer: device_params: use an utility macro to declare GObject-derived object X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=d043f125fee7f9004a640b1dc8845b8deb2688e8;p=alsa-gobject.git timer: device_params: 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/device-params.c b/src/timer/device-params.c index 36dcc99..4aaaf9f 100644 --- a/src/timer/device-params.c +++ b/src/timer/device-params.c @@ -13,9 +13,9 @@ * * The object wraps 'struct snd_timer_gparams' in UAPI of Linux sound subsystem. */ -struct _ALSATimerDeviceParamsPrivate { +typedef struct { struct snd_timer_gparams params; -}; +} ALSATimerDeviceParamsPrivate; G_DEFINE_TYPE_WITH_PRIVATE(ALSATimerDeviceParams, alsatimer_device_params, G_TYPE_OBJECT) enum timer_device_params_prop_type { diff --git a/src/timer/device-params.h b/src/timer/device-params.h index aebf186..efbb099 100644 --- a/src/timer/device-params.h +++ b/src/timer/device-params.h @@ -8,42 +8,13 @@ G_BEGIN_DECLS #define ALSATIMER_TYPE_DEVICE_PARAMS (alsatimer_device_params_get_type()) -#define ALSATIMER_DEVICE_PARAMS(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - ALSATIMER_TYPE_DEVICE_PARAMS, \ - ALSATimerDeviceParams)) -#define ALSATIMER_IS_DEVICE_PARAMS(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - ALSATIMER_TYPE_DEVICE_PARAMS)) - -#define ALSATIMER_DEVICE_PARAMS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - ALSATIMER_TYPE_DEVICE_PARAMS, \ - ALSATimerDeviceParamsClass)) -#define ALSATIMER_IS_DEVICE_PARAMS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - ALSATIMER_TYPE_DEVICE_PARAMS)) -#define ALSATIMER_DEVICE_PARAMS_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - ALSATIMER_TYPE_DEVICE_PARAMS, \ - ALSATimerDeviceParamsClass)) - -typedef struct _ALSATimerDeviceParams ALSATimerDeviceParams; -typedef struct _ALSATimerDeviceParamsClass ALSATimerDeviceParamsClass; -typedef struct _ALSATimerDeviceParamsPrivate ALSATimerDeviceParamsPrivate; - -struct _ALSATimerDeviceParams { - GObject parent_instance; - - ALSATimerDeviceParamsPrivate *priv; -}; +G_DECLARE_DERIVABLE_TYPE(ALSATimerDeviceParams, alsatimer_device_params, ALSATIMER, DEVICE_PARAMS, + GObject); struct _ALSATimerDeviceParamsClass { GObjectClass parent_class; }; -GType alsatimer_device_params_get_type() G_GNUC_CONST; - ALSATimerDeviceParams *alsatimer_device_params_new(); G_END_DECLS