summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-01-25 08:47:20 +0100
committerMax Kellermann <max@musicpd.org>2017-01-25 08:47:20 +0100
commit68bb738af21c7deb46f798c44a3d75cafc4dffe8 (patch)
tree70f66bcced77d7797330339d165e9bdc71e0e64a
parent6b968beede4e80975283e7eb8e08c71ac5d7a1a8 (diff)
input/alsa: use snd_pcm_?w_params_alloca()
-rw-r--r--src/input/plugins/AlsaInputPlugin.cxx15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/input/plugins/AlsaInputPlugin.cxx b/src/input/plugins/AlsaInputPlugin.cxx
index 8a5c11759..4b3fd38de 100644
--- a/src/input/plugins/AlsaInputPlugin.cxx
+++ b/src/input/plugins/AlsaInputPlugin.cxx
@@ -33,7 +33,6 @@
#include "util/RuntimeError.hxx"
#include "util/StringCompare.hxx"
#include "util/ReusableArray.hxx"
-#include "util/ScopeExit.hxx"
#include "Log.hxx"
#include "event/MultiSocketMonitor.hxx"
@@ -287,13 +286,7 @@ ConfigureCapture(snd_pcm_t *capture_handle,
int err;
snd_pcm_hw_params_t *hw_params;
- if ((err = snd_pcm_hw_params_malloc(&hw_params)) < 0)
- throw FormatRuntimeError("Cannot allocate hardware parameter structure (%s)",
- snd_strerror(err));
-
- AtScopeExit(hw_params) {
- snd_pcm_hw_params_free(hw_params);
- };
+ snd_pcm_hw_params_alloca(&hw_params);
if ((err = snd_pcm_hw_params_any(capture_handle, hw_params)) < 0)
throw FormatRuntimeError("Cannot initialize hardware parameter structure (%s)",
@@ -373,14 +366,10 @@ ConfigureCapture(snd_pcm_t *capture_handle,
(unsigned)alsa_buffer_size, (unsigned)alsa_period_size);
snd_pcm_sw_params_t *sw_params;
+ snd_pcm_sw_params_alloca(&sw_params);
- snd_pcm_sw_params_malloc(&sw_params);
snd_pcm_sw_params_current(capture_handle, sw_params);
- AtScopeExit(sw_params) {
- snd_pcm_sw_params_free(sw_params);
- };
-
if ((err = snd_pcm_sw_params(capture_handle, sw_params)) < 0)
throw FormatRuntimeError("unable to install sw params (%s)",
snd_strerror(err));