mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
sq_newarrayex utility which reserves space only instead of creating elements.
This commit is contained in:
parent
17733c9b5f
commit
b3febf0017
1
vendor/Squirrel/include/squirrelex.h
vendored
1
vendor/Squirrel/include/squirrelex.h
vendored
@ -16,6 +16,7 @@ SQUIRREL_API SQRESULT sq_pushstringf(HSQUIRRELVM v,const SQChar *s,...);
|
||||
SQUIRREL_API SQRESULT sq_vpushstringf(HSQUIRRELVM v,const SQChar *s,va_list l);
|
||||
SQUIRREL_API SQRESULT sq_getnativeclosurepointer(HSQUIRRELVM v,SQInteger idx,SQFUNCTION *f);
|
||||
SQUIRREL_API SQRESULT sq_arrayreserve(HSQUIRRELVM v,SQInteger idx,SQInteger newcap);
|
||||
SQUIRREL_API void sq_newarrayex(HSQUIRRELVM v,SQInteger capacity);
|
||||
SQUIRREL_API SQInteger sq_cmpr(HSQUIRRELVM v);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
7
vendor/Squirrel/sqapiex.cpp
vendored
7
vendor/Squirrel/sqapiex.cpp
vendored
@ -120,6 +120,13 @@ SQRESULT sq_arrayreserve(HSQUIRRELVM v,SQInteger idx,SQInteger newcap)
|
||||
return sq_throwerror(v,_SC("negative capacity"));
|
||||
}
|
||||
|
||||
void sq_newarrayex(HSQUIRRELVM v,SQInteger capacity)
|
||||
{
|
||||
SQArray* a = SQArray::Create(_ss(v), 0);
|
||||
a->Reserve(capacity);
|
||||
v->Push(a);
|
||||
}
|
||||
|
||||
SQInteger sq_cmpr(HSQUIRRELVM v)
|
||||
{
|
||||
SQInteger res;
|
||||
|
Loading…
Reference in New Issue
Block a user