From 03390d8be1cb8983778faf6eedb9bcfd26a6dbce Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Wed, 29 Oct 2008 20:39:56 +0100
Subject: audio: call closeAudioDevice() on error

Instead of implementing another loop which calls audio_output_close()
on all configured devices, simply call closeAudioDevice().
---
 src/audio.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

(limited to 'src')

diff --git a/src/audio.c b/src/audio.c
index cd029c09b..0eff63f8f 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -313,12 +313,9 @@ int openAudioDevice(const struct audio_format *audioFormat)
 			ret = 0;
 	}
 
-	if (ret != 0) {
+	if (ret != 0)
 		/* close all devices if there was an error */
-		for (i = 0; i < audioOutputArraySize; ++i) {
-			audio_output_close(&audioOutputArray[i]);
-		}
-	}
+		closeAudioDevice();
 
 	return ret;
 }
-- 
cgit v1.2.3