From: ehofman Date: Tue, 19 Apr 2005 12:30:12 +0000 (+0000) Subject: Non gcc fixes. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ec4fc265e0be826be7d6250e615d8e70c6c97c5f;p=simgear.git Non gcc fixes. --- diff --git a/simgear/nasal/code.c b/simgear/nasal/code.c index 7e1f9fd5..342374d8 100644 --- a/simgear/nasal/code.c +++ b/simgear/nasal/code.c @@ -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; ipools[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; diff --git a/simgear/nasal/data.h b/simgear/nasal/data.h index 28fc4bfd..efa66742 100644 --- a/simgear/nasal/data.h +++ b/simgear/nasal/data.h @@ -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; diff --git a/simgear/nasal/lib.c b/simgear/nasal/lib.c index f424438d..5b8ace7e 100644 --- a/simgear/nasal/lib.c +++ b/simgear/nasal/lib.c @@ -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]; diff --git a/simgear/nasal/misc.c b/simgear/nasal/misc.c index f74ca95e..25302e4b 100644 --- a/simgear/nasal/misc.c +++ b/simgear/nasal/misc.c @@ -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; }