From 045959e9c00979128679ca77b10b929182fe3397 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 25 Mar 2014 18:16:03 -0700 Subject: Use C99 VLA instead of alloca when available --- OpenAL32/sample_cvt.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'OpenAL32/sample_cvt.c') diff --git a/OpenAL32/sample_cvt.c b/OpenAL32/sample_cvt.c index a4c59d9d..903ec8ca 100644 --- a/OpenAL32/sample_cvt.c +++ b/OpenAL32/sample_cvt.c @@ -917,10 +917,9 @@ static void Convert_##T##_ALima4(T *dst, const ALima4 *src, ALuint numchans, \ ALuint len, ALuint align) \ { \ ALsizei byte_align = ((align-1)/2 + 4) * numchans; \ + DECL_VLA(ALshort, tmp, align*numchans); \ ALuint i, j, k; \ - ALshort *tmp; \ \ - tmp = alloca(align*numchans*sizeof(*tmp)); \ for(i = 0;i < len;i += align) \ { \ DecodeIMA4Block(tmp, src, numchans, align); \ @@ -968,10 +967,9 @@ static void Convert_ALima4_##T(ALima4 *dst, const T *src, ALuint numchans, \ ALint sample[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; \ ALint index[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; \ ALsizei byte_align = ((align-1)/2 + 4) * numchans; \ + DECL_VLA(ALshort, tmp, align*numchans); \ ALuint i, j, k; \ - ALshort *tmp; \ \ - tmp = alloca(align*numchans*sizeof(*tmp)); \ for(i = 0;i < len;i += align) \ { \ for(j = 0;j < align;j++) \ @@ -1020,10 +1018,9 @@ static void Convert_##T##_ALmsadpcm(T *dst, const ALmsadpcm *src, \ ALuint align) \ { \ ALsizei byte_align = ((align-2)/2 + 7) * numchans; \ + DECL_VLA(ALshort, tmp, align*numchans); \ ALuint i, j, k; \ - ALshort *tmp; \ \ - tmp = alloca(align*numchans*sizeof(*tmp)); \ for(i = 0;i < len;i += align) \ { \ DecodeMSADPCMBlock(tmp, src, numchans, align); \ @@ -1071,10 +1068,9 @@ static void Convert_ALmsadpcm_##T(ALmsadpcm *dst, const T *src, \ { \ ALint sample[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; \ ALsizei byte_align = ((align-2)/2 + 7) * numchans; \ + DECL_VLA(ALshort, tmp, align*numchans); \ ALuint i, j, k; \ - ALshort *tmp; \ \ - tmp = alloca(align*numchans*sizeof(*tmp)); \ for(i = 0;i < len;i += align) \ { \ for(j = 0;j < align;j++) \ -- cgit v1.2.3