mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-10 15:01:40 +00:00
Use alloca()/_alloca() on C89/C90 compilers without VLA
This commit is contained in:
parent
f9ca336a2d
commit
b8766aef67
3 changed files with 24 additions and 0 deletions
|
@ -133,6 +133,18 @@ include ( TestVLA )
|
|||
include ( TestBigEndian )
|
||||
test_big_endian ( WORDS_BIGENDIAN )
|
||||
|
||||
unset ( HAVE_ALLOCA CACHE )
|
||||
CHECK_FUNCTION_EXISTS ( "alloca" HAVE_ALLOCA )
|
||||
if ( HAVE_ALLOCA )
|
||||
set ( HAVE_ALLOCA 1 )
|
||||
endif ( HAVE_ALLOCA )
|
||||
|
||||
unset ( HAVE__ALLOCA CACHE )
|
||||
CHECK_FUNCTION_EXISTS ( "_alloca" HAVE__ALLOCA )
|
||||
if ( HAVE__ALLOCA )
|
||||
set ( HAVE__ALLOCA 1 )
|
||||
endif ( HAVE__ALLOCA )
|
||||
|
||||
unset ( LIBFLUID_CPPFLAGS CACHE )
|
||||
unset ( LIBFLUID_LIBS CACHE )
|
||||
unset ( FLUID_CPPFLAGS CACHE )
|
||||
|
|
|
@ -133,6 +133,12 @@
|
|||
/* Define to 1 if you have the inet_ntop() function. */
|
||||
#cmakedefine HAVE_INETNTOP @HAVE_INETNTOP@
|
||||
|
||||
/* Define to 1 if you have the alloca() function. */
|
||||
#cmakedefine HAVE_ALLOCA @HAVE_ALLOCA@
|
||||
|
||||
/* Define to 1 if you have the _alloca() function. */
|
||||
#cmakedefine HAVE__ALLOCA @HAVE__ALLOCA@
|
||||
|
||||
/* Define to enable JACK driver */
|
||||
#cmakedefine JACK_SUPPORT @JACK_SUPPORT@
|
||||
|
||||
|
|
|
@ -180,6 +180,12 @@ typedef int fluid_socket_t;
|
|||
#if defined(SUPPORTS_VLA)
|
||||
# define FLUID_DECLARE_VLA(_type, _name, _len) \
|
||||
_type _name[_len]
|
||||
#elif defined HAVE_ALLOCA
|
||||
# define FLUID_DECLARE_VLA(_type, _name, _len) \
|
||||
_type * _name = (_type *)alloca(_len * sizeof(_type))
|
||||
#elif defined HAVE__ALLOCA
|
||||
# define FLUID_DECLARE_VLA(_type, _name, _len) \
|
||||
_type * _name = (_type *)_alloca(_len * sizeof(_type))
|
||||
#else
|
||||
# define FLUID_DECLARE_VLA(_type, _name, _len) \
|
||||
_type* _name = g_newa(_type, (_len))
|
||||
|
|
Loading…
Reference in a new issue