Fixes a declaration-after-statement error when using ALLOC_STACK

This commit is contained in:
Jean-Marc Valin 2011-03-29 07:54:27 +02:00
parent 403485d09b
commit d25dd2bff9
2 changed files with 2 additions and 8 deletions

View file

@ -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;

View file

@ -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*/