summaryrefslogtreecommitdiff
path: root/backends/oss
diff options
context:
space:
mode:
Diffstat (limited to 'backends/oss')
-rw-r--r--backends/oss/oss-backend.c20
-rw-r--r--backends/oss/oss-device.c3
-rw-r--r--backends/oss/oss-stream-control.c6
-rw-r--r--backends/oss/oss-stream.c15
-rw-r--r--backends/oss/oss-switch.c11
5 files changed, 13 insertions, 42 deletions
diff --git a/backends/oss/oss-backend.c b/backends/oss/oss-backend.c
index 5795e7c..bf5af37 100644
--- a/backends/oss/oss-backend.c
+++ b/backends/oss/oss-backend.c
@@ -267,12 +267,8 @@ oss_backend_close (MateMixerBackend *backend)
if (oss->priv->timeout_source_default != NULL)
g_source_destroy (oss->priv->timeout_source_default);
- if (oss->priv->devices != NULL) {
- g_list_free_full (oss->priv->devices, g_object_unref);
- oss->priv->devices = NULL;
- }
-
- free_stream_list (oss);
+ _mate_mixer_clear_object_list (&oss->priv->devices);
+ _mate_mixer_clear_object_list (&oss->priv->streams);
g_clear_object (&oss->priv->default_device);
g_hash_table_remove_all (oss->priv->devices_paths);
@@ -388,7 +384,7 @@ read_device (OssBackend *oss, const gchar *path)
* device's polling facility should handle this by itself.
*/
if (g_hash_table_contains (oss->priv->devices_paths, path) == TRUE) {
- close (fd);
+ g_close (fd, NULL);
return TRUE;
}
@@ -398,8 +394,7 @@ read_device (OssBackend *oss, const gchar *path)
device = oss_device_new (bname, label, path, fd);
g_free (bname);
g_free (label);
-
- close (fd);
+ g_close (fd, NULL);
if G_LIKELY (device != NULL) {
if (oss_device_open (device) == TRUE) {
@@ -717,12 +712,7 @@ set_default_device_index (OssBackend *oss, guint index, gboolean fallback)
static void
free_stream_list (OssBackend *oss)
{
- if (oss->priv->streams == NULL)
- return;
-
- g_list_free_full (oss->priv->streams, g_object_unref);
-
- oss->priv->streams = NULL;
+ _mate_mixer_clear_object_list (&oss->priv->streams);
}
static gint
diff --git a/backends/oss/oss-device.c b/backends/oss/oss-device.c
index 582c837..d11555d 100644
--- a/backends/oss/oss-device.c
+++ b/backends/oss/oss-device.c
@@ -368,8 +368,7 @@ oss_device_close (OssDevice *device)
if (device->priv->poll_tag_restore != 0)
g_source_remove (device->priv->poll_tag_restore);
- close (device->priv->fd);
- device->priv->fd = -1;
+ _mate_mixer_clear_fd (&device->priv->fd);
g_signal_emit (G_OBJECT (device), signals[CLOSED], 0);
}
diff --git a/backends/oss/oss-stream-control.c b/backends/oss/oss-stream-control.c
index bcb73fe..f826f62 100644
--- a/backends/oss/oss-stream-control.c
+++ b/backends/oss/oss-stream-control.c
@@ -206,11 +206,7 @@ oss_stream_control_close (OssStreamControl *control)
{
g_return_if_fail (OSS_IS_STREAM_CONTROL (control));
- if (control->priv->fd == -1)
- return;
-
- close (control->priv->fd);
- control->priv->fd = -1;
+ _mate_mixer_clear_fd (&control->priv->fd);
}
static guint
diff --git a/backends/oss/oss-stream.c b/backends/oss/oss-stream.c
index 7727dad..63c8481 100644
--- a/backends/oss/oss-stream.c
+++ b/backends/oss/oss-stream.c
@@ -18,6 +18,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <glib-object.h>
+
#include <libmatemixer/matemixer.h>
#include <libmatemixer/matemixer-private.h>
@@ -75,14 +76,8 @@ oss_stream_dispose (GObject *object)
stream = OSS_STREAM (object);
- if (stream->priv->controls != NULL) {
- g_list_free_full (stream->priv->controls, g_object_unref);
- stream->priv->controls = NULL;
- }
- if (stream->priv->switches != NULL) {
- g_list_free_full (stream->priv->switches, g_object_unref);
- stream->priv->switches = NULL;
- }
+ _mate_mixer_clear_object_list (&stream->priv->controls);
+ _mate_mixer_clear_object_list (&stream->priv->switches);
g_clear_object (&stream->priv->swtch);
@@ -250,9 +245,7 @@ oss_stream_remove_all (OssStream *stream)
if (stream->priv->swtch != NULL) {
oss_switch_close (stream->priv->swtch);
-
- g_list_free_full (stream->priv->switches, g_object_unref);
- stream->priv->switches = NULL;
+ _mate_mixer_clear_object_list (&stream->priv->switches);
g_signal_emit_by_name (G_OBJECT (stream),
"switch-removed",
diff --git a/backends/oss/oss-switch.c b/backends/oss/oss-switch.c
index 87ffb90..5ce3012 100644
--- a/backends/oss/oss-switch.c
+++ b/backends/oss/oss-switch.c
@@ -78,10 +78,7 @@ oss_switch_dispose (GObject *object)
swtch = OSS_SWITCH (object);
- if (swtch->priv->options != NULL) {
- g_list_free_full (swtch->priv->options, g_object_unref);
- swtch->priv->options = NULL;
- }
+ _mate_mixer_clear_object_list (&swtch->priv->options);
G_OBJECT_CLASS (oss_switch_parent_class)->dispose (object);
}
@@ -206,11 +203,7 @@ oss_switch_close (OssSwitch *swtch)
{
g_return_if_fail (OSS_IS_SWITCH (swtch));
- if (swtch->priv->fd == -1)
- return;
-
- close (swtch->priv->fd);
- swtch->priv->fd = -1;
+ _mate_mixer_clear_fd (&swtch->priv->fd);
}
static gboolean