]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: instance_status: 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)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 11 Apr 2022 08:42:26 +0000 (17: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/instance-status.c
src/timer/instance-status.h

index ca6f22ba686b0e810ed5b1376e91306f4bb3c3bb..f12f2847f7fadce28036826af853a330de924c2d 100644 (file)
  *
  * 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 {
index b839976982cced4f30800366c02e2836ec1d9e9b..6eef60c02989d9a5026973997a8b25a6690cdd38 100644 (file)
@@ -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,