From: Takashi Sakamoto Date: Mon, 15 Jun 2020 02:41:48 +0000 (+0900) Subject: timer: user_instance: use (inout) annotation to retrieve the status of instance X-Git-Tag: v0.1.0~35 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=45c933d691f16df592167d718bd0ea6f3c7bf16b;p=alsa-gobject.git timer: user_instance: use (inout) annotation to retrieve the status of instance Signed-off-by: Takashi Sakamoto --- diff --git a/src/timer/user-instance.c b/src/timer/user-instance.c index 158d071..9c92ebc 100644 --- a/src/timer/user-instance.c +++ b/src/timer/user-instance.c @@ -301,7 +301,7 @@ void alsatimer_user_instance_set_params(ALSATimerUserInstance *self, /** * alsatimer_user_instance_get_status: * @self: A #ALSATimerUserInstance. - * @instance_status: (out): A #ALSATimerInstanceStatus. + * @instance_status: (inout): A #ALSATimerInstanceStatus. * @error: A #GError. * * Get the latest status of instance. @@ -310,8 +310,8 @@ void alsatimer_user_instance_set_params(ALSATimerUserInstance *self, * SNDRV_TIMER_IOCTL_STATUS command for ALSA timer character device. */ void alsatimer_user_instance_get_status(ALSATimerUserInstance *self, - ALSATimerInstanceStatus **instance_status, - GError **error) + ALSATimerInstanceStatus *const *instance_status, + GError **error) { ALSATimerUserInstancePrivate *priv; struct snd_timer_status *status; @@ -319,13 +319,11 @@ void alsatimer_user_instance_get_status(ALSATimerUserInstance *self, g_return_if_fail(ALSATIMER_IS_USER_INSTANCE(self)); priv = alsatimer_user_instance_get_instance_private(self); - *instance_status = g_object_new(ALSATIMER_TYPE_INSTANCE_STATUS, NULL); + g_return_if_fail(ALSATIMER_IS_INSTANCE_STATUS(*instance_status)); timer_instance_status_refer_private(*instance_status, &status); - if (ioctl(priv->fd, SNDRV_TIMER_IOCTL_STATUS, status) < 0) { + if (ioctl(priv->fd, SNDRV_TIMER_IOCTL_STATUS, status) < 0) generate_error(error, errno); - g_object_unref(*instance_status); - } } static gboolean timer_user_instance_check_src(GSource *gsrc) diff --git a/src/timer/user-instance.h b/src/timer/user-instance.h index 7ceab6f..1ea4478 100644 --- a/src/timer/user-instance.h +++ b/src/timer/user-instance.h @@ -99,8 +99,8 @@ void alsatimer_user_instance_set_params(ALSATimerUserInstance *self, GError **error); void alsatimer_user_instance_get_status(ALSATimerUserInstance *self, - ALSATimerInstanceStatus **instance_status, - GError **error); + ALSATimerInstanceStatus *const *instance_status, + GError **error); void alsatimer_user_instance_create_source(ALSATimerUserInstance *self, GSource **gsrc, GError **error);