Commit d25dd2bf authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Fixes a declaration-after-statement error when using ALLOC_STACK

parent 403485d0
......@@ -953,7 +953,6 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i
int anti_collapse_on=0;
int silence=0;
ALLOC_STACK;
SAVE_STACK;
if (nbCompressedBytes<2 || pcm==NULL)
return CELT_BAD_ARG;
......@@ -1681,7 +1680,6 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const float * pcm, int
int j, ret, C, N;
VARDECL(celt_int16, in);
ALLOC_STACK;
SAVE_STACK;
if (pcm==NULL)
return CELT_BAD_ARG;
......@@ -1710,7 +1708,6 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const celt_int16 * pcm, int f
int j, ret, C, N;
VARDECL(celt_sig, in);
ALLOC_STACK;
SAVE_STACK;
if (pcm==NULL)
return CELT_BAD_ARG;
......@@ -2299,7 +2296,6 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da
int silence;
int C = CHANNELS(st->stream_channels);
ALLOC_STACK;
SAVE_STACK;
frame_size *= st->downsample;
......@@ -2640,7 +2636,6 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da
int j, ret, C, N;
VARDECL(celt_int16, out);
ALLOC_STACK;
SAVE_STACK;
if (pcm==NULL)
return CELT_BAD_ARG;
......@@ -2665,7 +2660,6 @@ int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, in
int j, ret, C, N;
VARDECL(celt_sig, out);
ALLOC_STACK;
SAVE_STACK;
if (pcm==NULL)
return CELT_BAD_ARG;
......
......@@ -125,14 +125,14 @@ extern char *global_stack_top;
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
#define PUSH(stack, size, type) (VALGRIND_MAKE_MEM_NOACCESS(stack, global_stack_top-stack),ALIGN((stack),sizeof(type)/sizeof(char)),VALGRIND_MAKE_MEM_UNDEFINED(stack, ((size)*sizeof(type)/sizeof(char))),(stack)+=(2*(size)*sizeof(type)/sizeof(char)),(type*)((stack)-(2*(size)*sizeof(type)/sizeof(char))))
#define RESTORE_STACK ((global_stack = _saved_stack),VALGRIND_MAKE_MEM_NOACCESS(global_stack, global_stack_top-global_stack))
#define ALLOC_STACK ((global_stack = (global_stack==0) ? ((global_stack_top=celt_alloc_scratch(GLOBAL_STACK_SIZE*2)+(GLOBAL_STACK_SIZE*2))-(GLOBAL_STACK_SIZE*2)) : global_stack),VALGRIND_MAKE_MEM_NOACCESS(global_stack, global_stack_top-global_stack))
#define ALLOC_STACK char *_saved_stack; ((global_stack = (global_stack==0) ? ((global_stack_top=celt_alloc_scratch(GLOBAL_STACK_SIZE*2)+(GLOBAL_STACK_SIZE*2))-(GLOBAL_STACK_SIZE*2)) : global_stack),VALGRIND_MAKE_MEM_NOACCESS(global_stack, global_stack_top-global_stack)); _saved_stack = global_stack;
#else
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)/sizeof(char)),(stack)+=(size)*(sizeof(type)/sizeof(char)),(type*)((stack)-(size)*(sizeof(type)/sizeof(char))))
#define RESTORE_STACK (global_stack = _saved_stack)
#define ALLOC_STACK (global_stack = (global_stack==0) ? celt_alloc_scratch(GLOBAL_STACK_SIZE) : global_stack)
#define ALLOC_STACK char *_saved_stack; (global_stack = (global_stack==0) ? celt_alloc_scratch(GLOBAL_STACK_SIZE) : global_stack); _saved_stack = global_stack;
#endif /*ENABLE_VALGRIND*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment