Skip to content

Commit

Permalink
style: ANSIfication
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed Nov 5, 2024
1 parent 9a8e2e3 commit 5c04989
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions src/common/instance.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: instance.c,v 2.12 2016/03/22 03:56:17 greg Exp $";
static const char RCSid[] = "$Id: instance.c,v 2.13 2024/11/05 00:03:10 greg Exp $";
#endif
/*
* instance.c - routines for octree objects.
Expand All @@ -22,12 +22,13 @@ static SCENE *slist = NULL; /* list of loaded octrees */


SCENE *
getscene(sname, flags) /* get new octree reference */
char *sname;
int flags;
getscene( /* get new octree reference */
char *sname,
int flags
)
{
char *pathname;
register SCENE *sc;
SCENE *sc;

flags &= ~IO_ILLEGAL; /* not allowed */
for (sc = slist; sc != NULL; sc = sc->next)
Expand Down Expand Up @@ -66,11 +67,12 @@ int flags;


INSTANCE *
getinstance(o, flags) /* get instance structure */
register OBJREC *o;
int flags;
getinstance( /* get instance structure */
OBJREC *o,
int flags
)
{
register INSTANCE *ins;
INSTANCE *ins;

flags &= ~IO_ILLEGAL; /* not allowed */
if ((ins = (INSTANCE *)o->os) == NULL) {
Expand All @@ -88,9 +90,9 @@ int flags;
ins->obj = NULL;
o->os = (char *)ins;
}
if (ins->obj == NULL)
if (ins->obj == NULL) {
ins->obj = getscene(o->oargs.sarg[0], flags);
else if ((flags &= ~ins->obj->ldflags)) {
} else if ((flags &= ~ins->obj->ldflags)) {
if (flags & IO_SCENE)
ins->obj->firstobj = nobjects;
if (flags)
Expand All @@ -105,18 +107,18 @@ int flags;


void
freescene(sc) /* release a scene reference */
SCENE *sc;
freescene( /* release a scene reference */
SCENE *sc
)
{
SCENE shead;
register SCENE *scp;
SCENE *scp;

if (sc == NULL)
return;
if (sc->nref <= 0)
error(CONSISTENCY, "unreferenced scene in freescene");
sc->nref--;
if (sc->nref) /* still in use? */
if (--sc->nref) /* still in use? */
return;
shead.next = slist; /* else remove from our list */
for (scp = &shead; scp->next != NULL; scp = scp->next)
Expand All @@ -131,17 +133,18 @@ SCENE *sc;
freestr(sc->name); /* free memory */
octfree(sc->scube.cutree);
freeobjects(sc->firstobj, sc->nobjs);
free((void *)sc);
free(sc);
}


void
freeinstance(o) /* free memory associated with instance */
OBJREC *o;
freeinstance( /* free memory associated with instance */
OBJREC *o
)
{
if (o->os == NULL)
return;
freescene((*(INSTANCE *)o->os).obj);
free((void *)o->os);
free(o->os);
o->os = NULL;
}

0 comments on commit 5c04989

Please sign in to comment.