]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: device_params: use an utility macro to declare GObject-derived object
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 11 Apr 2022 08:42:26 +0000 (17:42 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Tue, 12 Apr 2022 03:42:19 +0000 (12:42 +0900)
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 <o-takashi@sakamocchi.jp>
src/timer/device-params.c
src/timer/device-params.h

index 36dcc9910529326f838c5dc8b56981bc867e63d4..4aaaf9faecac7f0841bae9c51785e21176195284 100644 (file)
@@ -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 {
index aebf186b8372cd938ed386c57e8bc947cdbc14d9..efbb09929f94013e76392c9898bd2bdf28cd6276 100644 (file)
@@ -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