Removing alloca compat include.

This commit is contained in:
Бранимир Караџић
2024-12-21 19:24:22 -08:00
parent 7dc7dfc380
commit 61cc316669
15 changed files with 16 additions and 655 deletions

View File

@@ -130,7 +130,7 @@ namespace bx
int32_t len = vsnprintf(out, sizeof(temp), _format, _argList);
if ( (int32_t)sizeof(temp) < len)
{
out = (char*)alloca(len+1);
out = (char*)BX_STACK_ALLOC(len+1);
len = vsnprintf(out, len, _format, _argList);
}
out[len] = '\0';
@@ -217,7 +217,7 @@ namespace bx
uint32_t getCallStack(uint32_t _skip, uint32_t _max, uintptr_t* _outStack)
{
const uint32_t max = _skip+_max+1;
void** tmp = (void**)alloca(sizeof(uintptr_t)*max);
void** tmp = (void**)BX_STACK_ALLOC(sizeof(uintptr_t)*max);
const uint32_t numFull = backtrace(tmp, max);
const uint32_t skip = min(_skip + 1 /* skip self */, numFull);

View File

@@ -201,7 +201,7 @@ namespace bx
void* dlsym(void* _handle, const StringView& _symbol)
{
const int32_t symbolMax = _symbol.getLength()+1;
char* symbol = (char*)alloca(symbolMax);
char* symbol = (char*)BX_STACK_ALLOC(symbolMax);
strCopy(symbol, symbolMax, _symbol);
#if BX_PLATFORM_WINDOWS
@@ -222,7 +222,7 @@ namespace bx
bool getEnv(char* _out, uint32_t* _inOutSize, const StringView& _name)
{
const int32_t nameMax = _name.getLength()+1;
char* name = (char*)alloca(nameMax);
char* name = (char*)BX_STACK_ALLOC(nameMax);
strCopy(name, nameMax, _name);
#if BX_PLATFORM_WINDOWS
@@ -261,14 +261,14 @@ namespace bx
void setEnv(const StringView& _name, const StringView& _value)
{
const int32_t nameMax = _name.getLength()+1;
char* name = (char*)alloca(nameMax);
char* name = (char*)BX_STACK_ALLOC(nameMax);
strCopy(name, nameMax, _name);
char* value = NULL;
if (!_value.isEmpty() )
{
int32_t valueMax = _value.getLength()+1;
value = (char*)alloca(valueMax);
value = (char*)BX_STACK_ALLOC(valueMax);
strCopy(value, valueMax, _value);
}
@@ -335,7 +335,7 @@ namespace bx
total += (int32_t)strLen(_argv[ii]) + 1;
}
char* temp = (char*)alloca(total);
char* temp = (char*)BX_STACK_ALLOC(total);
int32_t len = 0;
for(uint32_t ii = 0; NULL != _argv[ii]; ++ii)
{

View File

@@ -47,7 +47,7 @@ namespace bx
void quickSort(void* _data, uint32_t _num, uint32_t _stride, const ComparisonFn _fn)
{
uint8_t* pivot = (uint8_t*)alloca(_stride);
uint8_t* pivot = (uint8_t*)BX_STACK_ALLOC(_stride);
quickSortR(pivot, _data, _num, _stride, _fn);
}

View File

@@ -256,7 +256,7 @@ namespace bx
{
uint32_t length = (uint32_t)strLen(_name)+1;
uint32_t size = length*sizeof(wchar_t);
wchar_t* name = (wchar_t*)alloca(size);
wchar_t* name = (wchar_t*)BX_STACK_ALLOC(size);
mbstowcs(name, _name, size-2);
SetThreadDescription(ti->m_handle, name);
}