Non gcc fixes.
This commit is contained in:
@@ -107,13 +107,14 @@ static void initContext(struct Context* c)
|
||||
|
||||
static void initGlobals()
|
||||
{
|
||||
int i;
|
||||
struct Context* c;
|
||||
globals = (struct Globals*)naAlloc(sizeof(struct Globals));
|
||||
naBZero(globals, sizeof(struct Globals));
|
||||
|
||||
globals->sem = naNewSem();
|
||||
globals->lock = naNewLock();
|
||||
|
||||
int i;
|
||||
globals->allocCount = 256; // reasonable starting value
|
||||
for(i=0; i<NUM_NASAL_TYPES; i++)
|
||||
naGC_init(&(globals->pools[i]), i);
|
||||
@@ -124,7 +125,7 @@ static void initGlobals()
|
||||
// Initialize a single context
|
||||
globals->freeContexts = 0;
|
||||
globals->allContexts = 0;
|
||||
struct Context* c = naNewContext();
|
||||
c = naNewContext();
|
||||
|
||||
globals->symbols = naNewHash(c);
|
||||
globals->save = naNewVector(c);
|
||||
@@ -140,11 +141,12 @@ static void initGlobals()
|
||||
struct Context* naNewContext()
|
||||
{
|
||||
int dummy;
|
||||
struct Context* c;
|
||||
if(globals == 0)
|
||||
initGlobals();
|
||||
|
||||
LOCK();
|
||||
struct Context* c = globals->freeContexts;
|
||||
c = globals->freeContexts;
|
||||
if(c) {
|
||||
globals->freeContexts = c->nextFree;
|
||||
c->nextFree = 0;
|
||||
|
||||
@@ -33,7 +33,7 @@ enum { T_STR, T_VEC, T_HASH, T_CODE, T_FUNC, T_CCODE, T_GHOST,
|
||||
// implementing objects to pack in 16 bits worth of data "for free".
|
||||
#define GC_HEADER \
|
||||
unsigned char mark; \
|
||||
unsigned char type; \
|
||||
unsigned char type
|
||||
|
||||
struct naObj {
|
||||
GC_HEADER;
|
||||
|
||||
@@ -49,8 +49,9 @@ static naRef pop(naContext c, naRef me, int argc, naRef* args)
|
||||
|
||||
static naRef setsize(naContext c, naRef me, int argc, naRef* args)
|
||||
{
|
||||
int sz;
|
||||
if(argc < 2) return naNil();
|
||||
int sz = (int)naNumValue(args[1]).num;
|
||||
sz = (int)naNumValue(args[1]).num;
|
||||
if(!naIsVector(args[0])) return naNil();
|
||||
naVec_setsize(args[0], sz);
|
||||
return args[0];
|
||||
|
||||
@@ -49,10 +49,11 @@ naRef naStringValue(naContext c, naRef r)
|
||||
|
||||
naRef naNew(struct Context* c, int type)
|
||||
{
|
||||
naRef result;
|
||||
if(c->nfree[type] == 0)
|
||||
c->free[type] = naGC_get(&globals->pools[type],
|
||||
OBJ_CACHE_SZ, &c->nfree[type]);
|
||||
naRef result = naObj(type, c->free[type][--c->nfree[type]]);
|
||||
result = naObj(type, c->free[type][--c->nfree[type]]);
|
||||
naVec_append(c->temps, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user