Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tim-Philipp Müller
Opus
Commits
d25dd2bf
Commit
d25dd2bf
authored
Mar 29, 2011
by
Jean-Marc Valin
Browse files
Fixes a declaration-after-statement error when using ALLOC_STACK
parent
403485d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
libcelt/celt.c
View file @
d25dd2bf
...
...
@@ -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
;
...
...
libcelt/stack_alloc.h
View file @
d25dd2bf
...
...
@@ -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*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment