47 |
|
sprintf(errmsg, "cannot open scene file \"%s\"", inpspec); |
48 |
|
error(SYSTEM, errmsg); |
49 |
|
} |
50 |
+ |
#ifdef getc_unlocked /* avoid stupid semaphores */ |
51 |
+ |
flockfile(infp); |
52 |
+ |
#endif |
53 |
|
while ((c = getc(infp)) != EOF) { |
54 |
|
if (isspace(c)) |
55 |
|
continue; |
68 |
|
pclose(infp); |
69 |
|
else if (infp != stdin) |
70 |
|
fclose(infp); |
71 |
+ |
#ifdef getc_unlocked |
72 |
+ |
else |
73 |
+ |
funlockfile(infp); |
74 |
+ |
#endif |
75 |
|
if (nobjects == lastobj) { |
76 |
|
sprintf(errmsg, "(%s): empty file", inpspec); |
77 |
|
error(WARNING, errmsg); |
205 |
|
freefargs(&o->oargs); |
206 |
|
memset((void *)o, '\0', sizeof(OBJREC)); |
207 |
|
} |
201 |
– |
clearobjndx(); |
208 |
|
/* free objects off end */ |
209 |
|
for (obj = nobjects; obj-- > 0; ) |
210 |
|
if (objptr(obj)->oname != NULL) |
211 |
|
break; |
212 |
< |
++obj; |
212 |
> |
if (++obj >= nobjects) |
213 |
> |
return; |
214 |
|
while (nobjects > obj) /* free empty end blocks */ |
215 |
|
if ((--nobjects & (OBJBLKSIZ-1)) == 0) { |
216 |
|
int i = nobjects >> OBJBLKSHFT; |
217 |
|
free((void *)objblock[i]); |
218 |
|
objblock[i] = NULL; |
219 |
|
} |
220 |
+ |
truncobjndx(); /* truncate modifier look-up */ |
221 |
|
} |