From: Takashi Sakamoto Date: Mon, 11 Apr 2022 08:42:26 +0000 (+0900) Subject: rawmidi; substream_params: use an utility macro to declare GObject-derived object X-Git-Tag: v0.3.0~216 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=783d15673ce3e682500c456d357bb75d06dc62f5;p=alsa-gobject.git 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 --- 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