mirror of
https://github.com/albertodemichelis/squirrel.git
synced 2026-01-15 16:08:00 +01:00
Improve const-correctness.
This avoids some pedantic compiler warnings and also removes any
non-shared data from the squirrel core.
Before:
size --totals sqstdlib/*.o squirrel/*.o
text data bss dec hex filename
261270 3776 0 265046 40b56 (TOTALS)
After:
size --totals sqstdlib/*.o squirrel/*.o
text data bss dec hex filename
265046 0 0 265046 40b56 (TOTALS)
This commit is contained in:
@ -162,7 +162,7 @@ static SQInteger _blob__cloned(HSQUIRRELVM v)
|
||||
}
|
||||
|
||||
#define _DECL_BLOB_FUNC(name,nparams,typecheck) {_SC(#name),_blob_##name,nparams,typecheck}
|
||||
static SQRegFunction _blob_methods[] = {
|
||||
static const SQRegFunction _blob_methods[] = {
|
||||
_DECL_BLOB_FUNC(constructor,-1,_SC("xn")),
|
||||
_DECL_BLOB_FUNC(resize,2,_SC("xn")),
|
||||
_DECL_BLOB_FUNC(swap2,1,_SC("x")),
|
||||
@ -183,7 +183,7 @@ static SQInteger _g_blob_casti2f(HSQUIRRELVM v)
|
||||
{
|
||||
SQInteger i;
|
||||
sq_getinteger(v,2,&i);
|
||||
sq_pushfloat(v,*((SQFloat *)&i));
|
||||
sq_pushfloat(v,*((const SQFloat *)&i));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ static SQInteger _g_blob_castf2i(HSQUIRRELVM v)
|
||||
{
|
||||
SQFloat f;
|
||||
sq_getfloat(v,2,&f);
|
||||
sq_pushinteger(v,*((SQInteger *)&f));
|
||||
sq_pushinteger(v,*((const SQInteger *)&f));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ static SQInteger _g_blob_swapfloat(HSQUIRRELVM v)
|
||||
}
|
||||
|
||||
#define _DECL_GLOBALBLOB_FUNC(name,nparams,typecheck) {_SC(#name),_g_blob_##name,nparams,typecheck}
|
||||
static SQRegFunction bloblib_funcs[]={
|
||||
static const SQRegFunction bloblib_funcs[]={
|
||||
_DECL_GLOBALBLOB_FUNC(casti2f,2,_SC(".n")),
|
||||
_DECL_GLOBALBLOB_FUNC(castf2i,2,_SC(".n")),
|
||||
_DECL_GLOBALBLOB_FUNC(swap2,2,_SC(".n")),
|
||||
|
||||
Reference in New Issue
Block a user