From: Takashi Sakamoto Date: Mon, 15 Jun 2020 02:11:59 +0000 (+0900) Subject: seq: use (inout) annotation to retrieve the status of queue X-Git-Tag: v0.1.0~37 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=5c9fc2dcbd3e8aca748c581cd3fbe07db8b0a880;p=alsa-gobject.git seq: use (inout) annotation to retrieve the status of queue Signed-off-by: Takashi Sakamoto --- diff --git a/src/seq/query.c b/src/seq/query.c index f81ae04..8a076b9 100644 --- a/src/seq/query.c +++ b/src/seq/query.c @@ -727,7 +727,7 @@ void alsaseq_get_queue_info_by_name(const gchar *name, * alsaseq_get_queue_status: * @queue_id: The numerical ID of queue, except for entries in * ALSASeqSpecificQueueId. - * @queue_status: (out): The current status of queue. + * @queue_status: (inout): The current status of queue. * @error: A #GError. * * Get current status of queue. @@ -736,7 +736,8 @@ void alsaseq_get_queue_info_by_name(const gchar *name, * with SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS command for ALSA sequencer character * device. */ -void alsaseq_get_queue_status(guint queue_id, ALSASeqQueueStatus **queue_status, +void alsaseq_get_queue_status(guint queue_id, + ALSASeqQueueStatus *const *queue_status, GError **error) { struct snd_seq_queue_status *status; @@ -754,16 +755,12 @@ void alsaseq_get_queue_status(guint queue_id, ALSASeqQueueStatus **queue_status, return; } - *queue_status = g_object_new(ALSASEQ_TYPE_QUEUE_STATUS, NULL); + g_return_if_fail(ALSASEQ_IS_QUEUE_STATUS(*queue_status)); seq_queue_status_refer_private(*queue_status, &status); status->queue = (int)queue_id; - if (ioctl(fd, SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS, status) < 0) { + if (ioctl(fd, SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS, status) < 0) generate_error(error, errno); - close(fd); - g_object_unref(*queue_status); - return; - } close(fd); } diff --git a/src/seq/query.h b/src/seq/query.h index 08aa68d..eb4ce0d 100644 --- a/src/seq/query.h +++ b/src/seq/query.h @@ -49,7 +49,8 @@ void alsaseq_get_queue_info_by_name(const gchar *name, ALSASeqQueueInfo **queue_info, GError **error); -void alsaseq_get_queue_status(guint queue_id, ALSASeqQueueStatus **queue_status, +void alsaseq_get_queue_status(guint queue_id, + ALSASeqQueueStatus *const *queue_status, GError **error); G_END_DECLS