Include alloca.h when needed, remove unused cruft

Fixes illumos compiler warning.
parent 53f5a06f
Pipeline #260 passed with stage
in 59 seconds
......@@ -26,7 +26,7 @@ AC_CANONICAL_HOST
AM_PROG_CC_C_O
AC_PROG_CC_C99
AC_CHECK_HEADERS([inttypes.h])
AC_CHECK_HEADERS([inttypes.h alloca.h])
AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE
......
......@@ -976,8 +976,7 @@ EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t cha
const spx_uint32_t xlen = st->mem_alloc_size - (st->filt_len - 1);
#ifdef VAR_ARRAYS
const unsigned int ylen = (olen < FIXED_STACK_ALLOC) ? olen : FIXED_STACK_ALLOC;
VARDECL(spx_word16_t *ystack);
ALLOC(ystack, ylen, spx_word16_t);
spx_word16_t ystack[ylen];
#else
const unsigned int ylen = FIXED_STACK_ALLOC;
spx_word16_t ystack[FIXED_STACK_ALLOC];
......
......@@ -35,10 +35,10 @@
#ifndef STACK_ALLOC_H
#define STACK_ALLOC_H
#ifdef WIN32
#if defined WIN32 || defined _WIN32
# include <malloc.h>
# ifndef alloca
# define alloca(_x) _alloca(_x);
# define alloca(n) _alloca(n)
# endif
#else
# ifdef HAVE_ALLOCA_H
......@@ -48,69 +48,4 @@
# endif
#endif
/**
* @def ALIGN(stack, size)
*
* Aligns the stack to a 'size' boundary
*
* @param stack Stack
* @param size New size boundary
*/
/**
* @def PUSH(stack, size, type)
*
* Allocates 'size' elements of type 'type' on the stack
*
* @param stack Stack
* @param size Number of elements
* @param type Type of element
*/
/**
* @def VARDECL(var)
*
* Declare variable on stack
*
* @param var Variable to declare
*/
/**
* @def ALLOC(var, size, type)
*
* Allocate 'size' elements of 'type' on stack
*
* @param var Name of variable to allocate
* @param size Number of elements
* @param type Type of element
*/
#ifdef ENABLE_VALGRIND
# include <valgrind/memcheck.h>
# define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
# define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
#else
# define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
# define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
#endif
#if defined(VAR_ARRAYS)
# define VARDECL(var)
# define ALLOC(var, size, type) type var[size]
#elif defined(USE_ALLOCA)
# define VARDECL(var) var
# define ALLOC(var, size, type) var = alloca(sizeof(type)*(size))
#else
# define VARDECL(var) var
# define ALLOC(var, size, type) var = PUSH(stack, size, type)
#endif
#endif
......@@ -12,8 +12,6 @@
#define OPUSTOOLS 1
#define inline __inline
#define alloca _alloca
#define USE_ALLOCA 1
#ifdef HAVE_LIBFLAC
#ifdef FLAC__NO_DLL
......
Markdown is supported
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