summaryrefslogtreecommitdiffstats
path: root/Alc/pulseaudio.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-08-27 18:55:18 -0700
committerChris Robinson <[email protected]>2009-08-27 18:55:18 -0700
commit832dc8a5857ff492502f23f9604d1b3e27718e24 (patch)
tree67d528eb5933372ce10b6c7e11df7b5fe48839dc /Alc/pulseaudio.c
parentbb121e68a618d1881a6e35c47938ce0650d07afb (diff)
Remove unnecessary vars and rework device name checks
Diffstat (limited to 'Alc/pulseaudio.c')
-rw-r--r--Alc/pulseaudio.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c
index 8275033b..3b358a01 100644
--- a/Alc/pulseaudio.c
+++ b/Alc/pulseaudio.c
@@ -325,13 +325,12 @@ static ALCboolean pulse_open_playback(ALCdevice *device, const ALCchar *device_n
if(!pa_handle)
return ALC_FALSE;
- if(device_name)
- {
- if(strcmp(device_name, pulse_device) != 0)
- return ALC_FALSE;
- }
+ if(!device_name)
+ device_name = pulse_device;
+ else if(strcmp(device_name, pulse_device) != 0)
+ return ALC_FALSE;
- return pulse_open(device, pulse_device);
+ return pulse_open(device, device_name);
} //}}}
static void pulse_close_playback(ALCdevice *device) //{{{
@@ -458,13 +457,12 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na
if(!pa_handle)
return ALC_FALSE;
- if(device_name)
- {
- if(strcmp(device_name, pulse_capture_device) != 0)
- return ALC_FALSE;
- }
+ if(!device_name)
+ device_name = pulse_capture_device;
+ else if(strcmp(device_name, pulse_capture_device) != 0)
+ return ALC_FALSE;
- if(pulse_open(device, pulse_capture_device) == ALC_FALSE)
+ if(pulse_open(device, device_name) == ALC_FALSE)
return ALC_FALSE;
data = device->ExtraData;
@@ -478,6 +476,8 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na
{
ppa_threaded_mainloop_unlock(data->loop);
pulse_close(device);
+ free(device->szDeviceName);
+ device->szDeviceName = NULL;
return ALC_FALSE;
}
@@ -503,6 +503,8 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na
AL_PRINT("Unknown format: %x\n", device->Format);
ppa_threaded_mainloop_unlock(data->loop);
pulse_close(device);
+ free(device->szDeviceName);
+ device->szDeviceName = NULL;
return ALC_FALSE;
}
@@ -511,6 +513,8 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na
AL_PRINT("Invalid sample format\n");
ppa_threaded_mainloop_unlock(data->loop);
pulse_close(device);
+ free(device->szDeviceName);
+ device->szDeviceName = NULL;
return ALC_FALSE;
}
@@ -522,6 +526,8 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na
ppa_threaded_mainloop_unlock(data->loop);
pulse_close(device);
+ free(device->szDeviceName);
+ device->szDeviceName = NULL;
return ALC_FALSE;
}
@@ -537,6 +543,8 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na
data->stream = NULL;
pulse_close(device);
+ free(device->szDeviceName);
+ device->szDeviceName = NULL;
return ALC_FALSE;
}
@@ -552,6 +560,8 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na
data->stream = NULL;
pulse_close(device);
+ free(device->szDeviceName);
+ device->szDeviceName = NULL;
return ALC_FALSE;
}