mirror of
https://github.com/bkaradzic/bx.git
synced 2026-06-08 03:03:48 +00:00
Removing alloca compat include.
This commit is contained in:
@@ -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);
|
||||
|
||||
10
src/os.cpp
10
src/os.cpp
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user