From 65b8e52d802fa42fcdd95457cfc2ecc8ecbc3793 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 14 Dec 2013 22:17:19 +0100 Subject: output/alsa: use new[] instead of g_malloc() --- src/output/AlsaOutputPlugin.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/output/AlsaOutputPlugin.cxx b/src/output/AlsaOutputPlugin.cxx index 4877d3a46..b5ca511b2 100644 --- a/src/output/AlsaOutputPlugin.cxx +++ b/src/output/AlsaOutputPlugin.cxx @@ -27,7 +27,6 @@ #include "util/Domain.hxx" #include "Log.hxx" -#include #include #include @@ -118,7 +117,7 @@ struct AlsaOutput { * It contains silence samples, enough to fill one period (see * #period_frames). */ - void *silence; + uint8_t *silence; AlsaOutput():mode(0), writei(snd_pcm_writei) { } @@ -593,8 +592,8 @@ configure_hw: ad->period_frames = alsa_period_size; ad->period_position = 0; - ad->silence = g_malloc(snd_pcm_frames_to_bytes(ad->pcm, - alsa_period_size)); + ad->silence = new uint8_t[snd_pcm_frames_to_bytes(ad->pcm, + alsa_period_size)]; snd_pcm_format_set_silence(format, ad->silence, alsa_period_size * channels); @@ -641,7 +640,7 @@ alsa_setup_dsd(AlsaOutput *ad, const AudioFormat audio_format, error.Format(alsa_output_domain, "Failed to configure DSD-over-USB on ALSA device \"%s\"", alsa_device(ad)); - g_free(ad->silence); + delete[] ad->silence; return false; } @@ -811,7 +810,7 @@ alsa_close(struct audio_output *ao) AlsaOutput *ad = (AlsaOutput *)ao; snd_pcm_close(ad->pcm); - g_free(ad->silence); + delete[] ad->silence; } static size_t -- cgit v1.2.3