]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
rawmidi: substream_info: 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/rawmidi/substream-info.c
src/rawmidi/substream-info.h

index 0c4e47b78093ba0d2e9bcd3caed27b5adcf97c06..32deeb51561887f6e4458f022c5b74482dc342c6 100644 (file)
@@ -14,9 +14,9 @@
  *
  * The object wraps 'struct snd_rawmidi_info' in UAPI of Linux sound subsystem.
  */
-struct _ALSARawmidiSubstreamInfoPrivate {
+typedef struct {
     struct snd_rawmidi_info info;
-};
+} ALSARawmidiSubstreamInfoPrivate;
 G_DEFINE_TYPE_WITH_PRIVATE(ALSARawmidiSubstreamInfo, alsarawmidi_substream_info, G_TYPE_OBJECT)
 
 enum rawmidi_substream_info_prop_type {
index 45ea11491256ab9c4cc5ced0c9a36439bff9469a..6dd83b776d5acd1d08a24a932fc2ea18dbdbbed4 100644 (file)
@@ -8,42 +8,12 @@ G_BEGIN_DECLS
 
 #define ALSARAWMIDI_TYPE_SUBSTREAM_INFO (alsarawmidi_substream_info_get_type())
 
-#define ALSARAWMIDI_SUBSTREAM_INFO(obj)                             \
-    (G_TYPE_CHECK_INSTANCE_CAST((obj),                              \
-                                ALSARAWMIDI_TYPE_SUBSTREAM_INFO,    \
-                                ALSARawmidiSubstreamInfo))
-#define ALSARAWMIDI_IS_SUBSTREAM_INFO(obj)                          \
-    (G_TYPE_CHECK_INSTANCE_TYPE((obj),                              \
-                                ALSARAWMIDI_TYPE_SUBSTREAM_INFO))
-
-#define ALSARAWMIDI_SUBSTREAM_INFO_CLASS(klass)                     \
-    (G_TYPE_CHECK_CLASS_CAST((klass),                               \
-                             ALSARAWMIDI_TYPE_SUBSTREAM_INFO,       \
-                             ALSARawmidiSubstreamInfoClass))
-#define ALSARAWMIDI_IS_SUBSTREAM_INFO_CLASS(klass)                  \
-    (G_TYPE_CHECK_CLASS_TYPE((klass),                               \
-                             ALSARAWMIDI_TYPE_SUBSTREAM_INFO))
-#define ALSARAWMIDI_SUBSTREAM_INFO_GET_CLASS(obj)                   \
-    (G_TYPE_INSTANCE_GET_CLASS((obj),                               \
-                               ALSARAWMIDI_TYPE_SUBSTREAM_INFO,     \
-                               ALSARawmidiSubstreamInfoClass))
-
-typedef struct _ALSARawmidiSubstreamInfo        ALSARawmidiSubstreamInfo;
-typedef struct _ALSARawmidiSubstreamInfoClass   ALSARawmidiSubstreamInfoClass;
-typedef struct _ALSARawmidiSubstreamInfoPrivate ALSARawmidiSubstreamInfoPrivate;
-
-struct _ALSARawmidiSubstreamInfo {
-    GObject parent_instance;
-
-    ALSARawmidiSubstreamInfoPrivate *priv;
-};
-
+G_DECLARE_DERIVABLE_TYPE(ALSARawmidiSubstreamInfo, alsarawmidi_substream_info, ALSARAWMIDI,
+                         SUBSTREAM_INFO, GObject);
 struct _ALSARawmidiSubstreamInfoClass {
     GObjectClass parent_class;
 };
 
-GType alsarawmidi_substream_info_get_type() G_GNUC_CONST;
-
 G_END_DECLS
 
 #endif