summaryrefslogtreecommitdiff
path: root/backends/alsa/alsa-backend.c
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2014-10-31 14:33:16 +0100
committerMichal Ratajsky <[email protected]>2014-10-31 14:33:16 +0100
commitb839e8ca0c73f9715654497e241d4aa3e3042125 (patch)
treee7fad3a59d028ba407c4af4ef3b27b1e74085527 /backends/alsa/alsa-backend.c
parent9d928d858194db5bb65535f521e4f9e169f1b2d9 (diff)
downloadlibmatemixer-b839e8ca0c73f9715654497e241d4aa3e3042125.tar.bz2
libmatemixer-b839e8ca0c73f9715654497e241d4aa3e3042125.tar.xz
alsa: Improve *_list_streams functions
Avoids including useless streams in the list and optimizes GList construction.
Diffstat (limited to 'backends/alsa/alsa-backend.c')
-rw-r--r--backends/alsa/alsa-backend.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/backends/alsa/alsa-backend.c b/backends/alsa/alsa-backend.c
index 0b7895e..8c4913a 100644
--- a/backends/alsa/alsa-backend.c
+++ b/backends/alsa/alsa-backend.c
@@ -248,23 +248,23 @@ alsa_backend_list_streams (MateMixerBackend *backend)
/* Walk through the list of devices and create the stream list, each
* device has at most one input and one output stream */
- list = alsa->priv->devices;
+ list = g_list_last (alsa->priv->devices);
while (list != NULL) {
AlsaDevice *device = ALSA_DEVICE (list->data);
AlsaStream *stream;
- stream = alsa_device_get_input_stream (device);
- if (stream != NULL) {
- alsa->priv->streams =
- g_list_append (alsa->priv->streams, g_object_ref (stream));
- }
stream = alsa_device_get_output_stream (device);
- if (stream != NULL) {
+ if (stream != NULL)
+ alsa->priv->streams =
+ g_list_prepend (alsa->priv->streams, g_object_ref (stream));
+
+ stream = alsa_device_get_input_stream (device);
+ if (stream != NULL)
alsa->priv->streams =
- g_list_append (alsa->priv->streams, g_object_ref (stream));
- }
- list = list->next;
+ g_list_prepend (alsa->priv->streams, g_object_ref (stream));
+
+ list = list->prev;
}
}
return alsa->priv->streams;