From bc3f1527b38bee53aa37bef7ca3d6baa6f98bb1a Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Mon, 11 Apr 2022 17:42:26 +0900 Subject: [PATCH] rawmidi; substream_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 --- src/rawmidi/substream-params.c | 4 ++-- src/rawmidi/substream-params.h | 34 ++-------------------------------- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/src/rawmidi/substream-params.c b/src/rawmidi/substream-params.c index 04f900b..eb5e7ce 100644 --- a/src/rawmidi/substream-params.c +++ b/src/rawmidi/substream-params.c @@ -16,9 +16,9 @@ * * The object wraps 'struct snd_rawmidi_params' in UAPI of Linux sound subsystem. */ -struct _ALSARawmidiSubstreamParamsPrivate { +typedef struct { struct snd_rawmidi_params params; -}; +} ALSARawmidiSubstreamParamsPrivate; G_DEFINE_TYPE_WITH_PRIVATE(ALSARawmidiSubstreamParams, alsarawmidi_substream_params, G_TYPE_OBJECT) enum rawmidi_substream_params_prop_type { diff --git a/src/rawmidi/substream-params.h b/src/rawmidi/substream-params.h index af73800..0761057 100644 --- a/src/rawmidi/substream-params.h +++ b/src/rawmidi/substream-params.h @@ -8,42 +8,12 @@ G_BEGIN_DECLS #define ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS (alsarawmidi_substream_params_get_type()) -#define ALSARAWMIDI_SUBSTREAM_PARAMS(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS, \ - ALSARawmidiSubstreamParams)) -#define ALSARAWMIDI_IS_SUBSTREAM_PARAMS(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS)) - -#define ALSARAWMIDI_SUBSTREAM_PARAMS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS, \ - ALSARawmidiSubstreamParamsClass)) -#define ALSARAWMIDI_IS_SUBSTREAM_PARAMS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS)) -#define ALSARAWMIDI_SUBSTREAM_PARAMS_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS, \ - ALSARawmidiSubstreamParamsClass)) - -typedef struct _ALSARawmidiSubstreamParams ALSARawmidiSubstreamParams; -typedef struct _ALSARawmidiSubstreamParamsClass ALSARawmidiSubstreamParamsClass; -typedef struct _ALSARawmidiSubstreamParamsPrivate ALSARawmidiSubstreamParamsPrivate; - -struct _ALSARawmidiSubstreamParams { - GObject parent_instance; - - ALSARawmidiSubstreamParamsPrivate *priv; -}; - +G_DECLARE_DERIVABLE_TYPE(ALSARawmidiSubstreamParams, alsarawmidi_substream_params, ALSARAWMIDI, + SUBSTREAM_PARAMS, GObject); struct _ALSARawmidiSubstreamParamsClass { GObjectClass parent_class; }; -GType alsarawmidi_substream_params_get_type(void) G_GNUC_CONST; - ALSARawmidiSubstreamParams *alsarawmidi_substream_params_new(); G_END_DECLS -- 2.47.3