Assertions in _alloca() and _alloca16() for too big stack allocations

not on Windows though, for some reason MSVC doesn't like my ugly
hack to add an assert() to the _alloca16() macro :-/
This commit is contained in:
Daniel Gibson 2020-01-11 15:40:40 +01:00
parent bcf647cf71
commit aca8c24c3a
2 changed files with 3 additions and 3 deletions

View file

@ -1197,7 +1197,7 @@ void R_ListImages_f( const idCmdArgs &args ) {
totalSize = 0;
sortedImage_t *sortedArray = (sortedImage_t *)alloca( sizeof( sortedImage_t ) * globalImages->images.Num() );
sortedImage_t *sortedArray = (sortedImage_t *)_alloca( sizeof( sortedImage_t ) * globalImages->images.Num() );
for ( i = 0 ; i < globalImages->images.Num() ; i++ ) {
image = globalImages->images[ i ];

View file

@ -136,8 +136,8 @@ If you have questions concerning this license or the applicable additional terms
// Unix
#ifdef __unix__
#define _alloca alloca
#define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))
#define _alloca( x ) (({assert( (x)<600000 );}), alloca( (x) ))
#define _alloca16( x ) (({assert( (x)<600000 );}),((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15)))
#ifdef GAME_DLL
#define ID_GAME_API __attribute__((visibility ("default")))