2 ** Splint - annotation-assisted static program checker
3 ** Copyright (C) 1994-2003 University of Virginia,
4 ** Massachusetts Institute of Technology
6 ** This program is free software; you can redistribute it and/or modify it
7 ** under the terms of the GNU General Public License as published by the
8 ** Free Software Foundation; either version 2 of the License, or (at your
9 ** option) any later version.
11 ** This program is distributed in the hope that it will be useful, but
12 ** WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ** General Public License for more details.
16 ** The GNU General Public License is available from http://www.gnu.org/ or
17 ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18 ** MA 02111-1307, USA.
20 ** For information on splint: info@splint.org
21 ** To report a bug: splint-bug@splint.org
22 ** For more information: http://www.splint.org
27 ** replaces filenamemap.c
28 ** based (loosely) on typeTable.c
30 ** entries in the fileTable are:
32 ** name - name of the file
33 ** type - kind of file (a temp file to be deleted?)
34 ** link - derived from this file
39 * - Added conditional stuff (macros OS2 and MSDOS) to make names of temporary
40 * files under Windows or OS/2 not larger than 8+3 characters to avoid
41 * trouble with FAT file systems or Novell Netware volumes.
42 * - Added include of new header file portab.h containing OS dependent stuff.
43 * - Changed occurance of '/' as path delimiter to a macro.
44 * - Added conditional stuff (#define and #include) for IBM's compiler.
47 # include <sys/types.h>
48 # include <sys/stat.h>
50 # include "splintMacros.nf"
56 # if defined(__IBMC__) && defined(OS2)
59 # define getpid _getpid
60 # define S_IRUSR S_IREAD
61 # define S_IWUSR S_IWRITE
62 # define S_IXUSR S_IEXEC
68 fileTable_addOpen (fileTable p_ft, /*@observer@*/ FILE *p_f, /*@only@*/ cstring p_fname)
71 static bool fileTable_inRange (fileTable ft, fileId fid) /*@*/
73 return (fileTable_isDefined (ft) && (fid >= 0) && (fid < ft->nentries));
76 static fileId fileTable_internAddEntry (fileTable p_ft, /*@only@*/ ftentry p_e)
78 static /*@only@*/ cstring makeTempName (cstring p_dir, cstring p_pre, cstring p_suf);
80 static /*@only@*/ cstring
81 fileType_unparse (fileType ft)
85 case FILE_NORMAL: return cstring_makeLiteral ("normal");
86 case FILE_NODELETE: return cstring_makeLiteral ("normal");
87 case FILE_LSLTEMP: return cstring_makeLiteral ("ltemp");
88 case FILE_HEADER: return cstring_makeLiteral ("header");
89 case FILE_XH: return cstring_makeLiteral ("xh");
90 case FILE_MACROS: return cstring_makeLiteral ("macros");
91 case FILE_METASTATE: return cstring_makeLiteral ("metastate");
98 fileTable_getIndex (fileTable ft, cstring s)
102 if (ft == NULL) return NOT_FOUND;
103 abspath = osd_absolutePath (cstring_undefined, s);
105 if (context_getFlag (FLG_CASEINSENSITIVEFILENAMES))
107 abspath = cstring_downcase (abspath);
110 DPRINTF (("Absolute path: %s: %s", s, abspath));
111 res = cstringTable_lookup (ft->htable, abspath);
112 cstring_free (abspath);
116 static cstring ftentry_unparse (fileTable ft, ftentry fte)
118 if (fileId_isValid (fte->fder))
120 llassert (fileTable_isDefined (ft));
122 return message ("%s %q %d (%s)",
124 fileType_unparse (fte->ftype),
126 ft->elements[fte->fder]->fname);
130 return message ("%s %q", fte->fname,
131 fileType_unparse (fte->ftype));
136 fileTable_unparse (fileTable ft)
138 cstring s = cstring_undefined;
141 if (fileTable_isUndefined (ft))
143 return (cstring_makeLiteral ("<fileTable undefined>"));
146 for (i = 0; i < ft->nentries; i++)
148 s = message ("%s\n[%d] %q", s, i, ftentry_unparse (ft, ft->elements[i]));
154 void fileTable_printTemps (fileTable ft)
156 if (fileTable_isDefined (ft))
160 for (i = 0; i < ft->nentries; i++)
162 if (ft->elements[i]->ftemp)
164 if (fileId_isValid (ft->elements[i]->fder))
166 fprintf (stderr, " %s:1\n\t%s:1\n",
167 cstring_toCharsSafe (ft->elements[ft->elements[i]->fder]->fname),
168 cstring_toCharsSafe (ft->elements[i]->fname));
172 fprintf (stderr, "[no file]\n\t%s:1\n",
173 cstring_toCharsSafe (ft->elements[i]->fname));
181 ** loads in fileTable from fileTable_dump
184 static /*@notnull@*/ ftentry
185 ftentry_create (/*@keep@*/ cstring tn, bool temp, fileType typ, fileId der)
187 ftentry t = (ftentry) dmalloc (sizeof (*t));
189 if (cstring_isUndefined (tn))
191 llbug (cstring_makeLiteral ("Undefined filename!"));
195 t->basename = cstring_undefined;
200 /* Don't set these until the basename is needed. */
208 ftentry_free (/*@only@*/ ftentry t)
210 cstring_free (t->fname);
211 cstring_free (t->basename);
215 /*@only@*/ /*@notnull@*/ fileTable
218 fileTable ft = (fileTable) dmalloc (sizeof (*ft));
221 ft->nspace = FTBASESIZE;
222 ft->elements = (ftentry *) dmalloc (FTBASESIZE * sizeof (*ft->elements));
223 ft->htable = cstringTable_create (FTHASHSIZE);
226 ft->nopenspace = FTBASESIZE;
227 ft->openelements = (foentry *) dmalloc (FTBASESIZE * sizeof (*ft->openelements));
234 fileTable_grow (fileTable ft)
239 llassert (fileTable_isDefined (ft));
241 ft->nspace = FTBASESIZE;
243 newent = (ftentry *) dmalloc ((ft->nentries + ft->nspace) * sizeof (*newent));
245 for (i = 0; i < ft->nentries; i++)
247 newent[i] = ft->elements[i];
250 sfree (ft->elements);
251 ft->elements = newent;
255 fileTable_growOpen (fileTable ft)
260 llassert (fileTable_isDefined (ft));
262 ft->nopenspace = FTBASESIZE;
264 newent = (foentry *) dmalloc ((ft->nopen + ft->nopenspace) * sizeof (*newent));
266 for (i = 0; i < ft->nopen; i++)
268 newent[i] = ft->openelements[i];
271 sfree (ft->openelements);
272 ft->openelements = newent;
276 fileTable_internAddEntry (fileTable ft, /*@only@*/ ftentry e)
278 llassert (fileTable_isDefined (ft));
285 DPRINTF (("Adding: %s", e->fname));
287 if (context_getFlag (FLG_CASEINSENSITIVEFILENAMES))
289 cstring sd = cstring_downcase (e->fname);
290 cstringTable_insert (ft->htable, sd, ft->nentries);
294 cstringTable_insert (ft->htable, cstring_copy (e->fname), ft->nentries);
298 Before, there was no cstring_copy above, and e->fname was free'd in the if branch.
299 Splint should have caught this, and produced a warning for this assignment.
302 ft->elements[ft->nentries] = e;
305 return (ft->nentries - 1);
308 void fileTable_noDelete (fileTable ft, cstring name)
310 fileId fid = fileTable_lookup (ft, name);
312 if (fileId_isValid (fid))
314 llassert (fileTable_isDefined (ft));
315 ft->elements[fid]->ftype = FILE_NODELETE;
319 DPRINTF (("Invalid no delete: %s", name));
324 fileTable_addFilePrim (fileTable ft, /*@temp@*/ cstring name,
325 bool temp, fileType typ, fileId der)
328 cstring absname = osd_absolutePath (NULL, name);
329 int tindex = fileTable_getIndex (ft, absname);
331 /*@i534 fprintf (stderr, "Got abs path: %s", absname); */
332 llassert (ft != fileTable_undefined);
334 if (tindex != NOT_FOUND)
336 llcontbug (message ("fileTable_addFilePrim: duplicate entry: %q", absname));
341 ftentry e = ftentry_create (absname, temp, typ, der);
343 if (der == fileId_invalid)
345 llassert (cstring_isUndefined (e->basename));
347 e->basename = fileLib_removePathFree (fileLib_removeAnyExtension (absname));
348 e->fsystem = context_isSystemDir (absname);
351 ** evans 2002-03-15: change suggested by Jim Zelenka
352 ** support relative paths for system directories
357 e->fsystem = context_isSystemDir (name);
360 e->fspecial = context_isSpecialFile (absname);
364 cstring srcname = cstring_concatFree1 (fileLib_removeAnyExtension (absname),
366 fileId fid = fileTable_lookup (ft, srcname);
367 cstring_free (srcname);
369 if (fileId_isValid (fid))
371 fileId derid = ft->elements[fid]->fder;
373 ft->elements[fid]->fspecial = TRUE;
375 if (fileId_isValid (derid))
377 ft->elements[derid]->fspecial = TRUE;
384 ftentry de = ft->elements[der];
386 llassert (cstring_isUndefined (e->basename));
387 e->basename = cstring_copy (de->basename);
388 e->fsystem = de->fsystem;
389 e->fspecial = de->fspecial;
392 return (fileTable_internAddEntry (ft, e));
397 fileTable_addFile (fileTable ft, cstring name)
399 return (fileTable_addFilePrim (ft, name, FALSE, FILE_NORMAL, fileId_invalid));
403 fileTable_addFileOnly (fileTable ft, /*@only@*/ cstring name)
405 fileId res = fileTable_addFilePrim (ft, name, FALSE, FILE_NORMAL, fileId_invalid);
411 fileTable_addHeaderFile (fileTable ft, cstring name)
414 res = fileTable_addFilePrim (ft, name, FALSE, FILE_HEADER, fileId_invalid);
420 fileTable_addStreamFile (fileTable ft, FILE *fstream, cstring name)
422 fileTable_addOpen (ft, fstream, cstring_copy (name));
426 fileTable_isHeader (fileTable ft, fileId fid)
428 if (fileId_isInvalid (fid))
433 llassert (fileTable_isDefined (ft) && fileTable_inRange (ft, fid));
434 return (ft->elements[fid]->ftype == FILE_HEADER);
438 fileTable_isSystemFile (fileTable ft, fileId fid)
440 if (fileId_isInvalid (fid))
445 llassert (fileTable_isDefined (ft) && fileTable_inRange (ft, fid));
446 return (ft->elements[fid]->fsystem);
450 fileTable_isXHFile (fileTable ft, fileId fid)
452 if (fileId_isInvalid (fid))
457 if (!(fileTable_isDefined (ft) && fileTable_inRange (ft, fid)))
459 llcontbug (message ("Bad file table or id: %s %d", bool_unparse (fileTable_isDefined (ft)), fid));
464 return (ft->elements[fid]->ftype == FILE_XH);
469 fileTable_isSpecialFile (fileTable ft, fileId fid)
471 if (fileId_isInvalid (fid))
476 llassert (fileTable_isDefined (ft) && fileTable_inRange (ft, fid));
477 return (ft->elements[fid]->fspecial);
481 fileTable_addLibraryFile (fileTable ft, cstring name)
483 return (fileTable_addFilePrim (ft, name, FALSE, FILE_HEADER, fileId_invalid));
487 fileTable_addXHFile (fileTable ft, cstring name)
489 return (fileTable_addFilePrim (ft, name, FALSE, FILE_XH, fileId_invalid));
493 fileTable_addImportFile (fileTable ft, cstring name)
495 return (fileTable_addFilePrim (ft, name, FALSE, FILE_HEADER, fileId_invalid));
499 fileTable_addLCLFile (fileTable ft, cstring name)
501 return (fileTable_addFilePrim (ft, name, FALSE, FILE_HEADER, fileId_invalid));
504 static int tmpcounter = 0;
507 fileTable_addMacrosFile (fileTable ft)
510 makeTempName (context_tmpdir (), cstring_makeLiteralTemp ("lmx"),
511 cstring_makeLiteralTemp (".llm"));
512 fileId res = fileTable_addFilePrim (ft, newname, TRUE, FILE_MACROS, fileId_invalid);
513 cstring_free (newname);
518 fileTable_addMetastateFile (fileTable ft, cstring name)
520 return (fileTable_addFilePrim (ft, name, FALSE, FILE_METASTATE, fileId_invalid));
524 fileTable_addCTempFile (fileTable ft, fileId fid)
527 makeTempName (context_tmpdir (), cstring_makeLiteralTemp ("cl"),
531 DPRINTF (("tmp dir: %s", context_tmpdir ()));
532 DPRINTF (("new name: %s", newname));
534 llassert (fileTable_isDefined (ft));
536 if (!fileId_isValid (ft->elements[fid]->fder))
538 if (fileTable_isXHFile (ft, fid))
540 res = fileTable_addFilePrim (ft, newname, TRUE, FILE_XH, fid);
544 res = fileTable_addFilePrim (ft, newname, TRUE, FILE_NORMAL, fid);
549 if (fileTable_isXHFile (ft, fid))
551 res = fileTable_addFilePrim (ft, newname, TRUE, FILE_XH,
552 ft->elements[fid]->fder);
556 res = fileTable_addFilePrim (ft, newname, TRUE, FILE_NORMAL,
557 ft->elements[fid]->fder);
561 DPRINTF (("Added file: %s", fileTable_fileName (res)));
562 cstring_free (newname);
567 fileTable_addltemp (fileTable ft)
569 cstring newname = makeTempName (context_tmpdir (),
570 cstring_makeLiteralTemp ("ls"),
571 cstring_makeLiteralTemp (".lsl"));
574 if (cstring_hasNonAlphaNumBar (newname))
576 char *lastpath = (char *)NULL;
582 ("Operating system generates tmp filename containing invalid charater: %s",
584 lldiagmsg (cstring_makeLiteral
585 ("Try cleaning up the tmp directory. Attempting to continue."));
589 llassert (cstring_isDefined (newname));
590 lastpath = strrchr (newname, CONNECTCHAR); /* get the directory */
591 llassert (lastpath != NULL);
594 newname = message ("%q%hlsl%d.lsl",
598 /*@noaccess cstring@*/
603 ** this is kind of yucky...need to make the result of cstring_fromChars
604 ** refer to the same storage as its argument. Of course, this loses,
605 ** since cstring is abstract. Should make it an only?
608 ret = fileTable_addFilePrim (ft, newname, TRUE, FILE_LSLTEMP, fileId_invalid);
609 cstring_free (newname);
614 fileTable_exists (fileTable ft, cstring s)
616 int tindex = fileTable_getIndex (ft, s);
618 if (tindex == NOT_FOUND)
620 DPRINTF (("Not found: %s", s));
630 fileTable_lookup (fileTable ft, cstring s)
632 int tindex = fileTable_getIndex (ft, s);
634 if (tindex == NOT_FOUND)
636 return fileId_invalid;
645 ** This is pretty awkward --- when we find the real path of
646 ** a .xh file, we may need to change the recorded name. [Sigh]
650 fileTable_setFilePath (fileTable ft, fileId fid, cstring path)
652 llassert (fileId_isValid (fid));
653 llassert (fileTable_isDefined (ft));
654 /* Need to put new string in hash table */
655 cstringTable_insert (ft->htable, cstring_copy (path), fid);
656 ft->elements[fid]->fname = cstring_copy (path);
660 fileTable_lookupBase (fileTable ft, cstring base)
664 if (context_getFlag (FLG_CASEINSENSITIVEFILENAMES))
666 cstring dbase = cstring_downcase (base);
667 tindex = fileTable_getIndex (ft, dbase);
668 cstring_free (dbase);
672 tindex = fileTable_getIndex (ft, base);
675 if (tindex == NOT_FOUND)
677 return fileId_invalid;
683 llassert (fileTable_isDefined (ft));
685 der = ft->elements[tindex]->fder;
687 if (!fileId_isValid (der))
697 fileTable_getName (fileTable ft, fileId fid)
699 if (!fileId_isValid (fid))
702 (message ("fileTable_getName: called with invalid type id: %d", fid));
703 return cstring_makeLiteralTemp ("<invalid>");
706 llassert (fileTable_isDefined (ft));
707 return (ft->elements[fid]->fname);
711 fileTable_getRootName (fileTable ft, fileId fid)
715 if (!fileId_isValid (fid))
717 llcontbug (message ("fileTable_getName: called with invalid id: %d", fid));
718 return cstring_makeLiteralTemp ("<invalid>");
721 if (!fileTable_isDefined (ft))
723 return cstring_makeLiteralTemp ("<no file table>");
726 fder = ft->elements[fid]->fder;
728 if (fileId_isValid (fder))
730 return (ft->elements[fder]->fname);
734 return (ft->elements[fid]->fname);
739 fileTable_getNameBase (fileTable ft, fileId fid)
741 if (!fileId_isValid (fid))
743 llcontbug (message ("fileTable_getName: called with invalid id: %d", fid));
744 return cstring_makeLiteralTemp ("<invalid>");
747 if (!fileTable_isDefined (ft))
749 return cstring_makeLiteralTemp ("<no file table>");
752 return (ft->elements[fid]->basename);
756 fileTable_sameBase (fileTable ft, fileId f1, fileId f2)
760 if (!fileId_isValid (f1))
765 if (!fileId_isValid (f2))
770 llassert (fileTable_isDefined (ft));
777 fd1 = ft->elements[f1]->fder;
779 if (!fileId_isValid (fd1))
784 fd2 = ft->elements[f2]->fder;
787 if (!fileId_isValid (fd2))
796 fileTable_cleanup (fileTable ft)
802 llassert (fileTable_isDefined (ft));
804 msg = ((ft->nentries > 40) && context_getFlag (FLG_SHOWSCAN));
805 skip = ft->nentries / 10;
809 (void) fflush (g_warningstream);
810 displayScanOpen (cstring_makeLiteral ("cleaning"));
813 for (i = 0; i < ft->nentries; i++)
815 ftentry fe = ft->elements[i];
819 /* let's be real careful now, hon! */
822 ** Make sure it is really a derived file
826 if (fe->ftype == FILE_LSLTEMP || fe->ftype == FILE_NODELETE)
828 ; /* already removed */
830 else if (fileId_isValid (fe->fder))
832 /*@i423 this should use close (fd) also... */
833 (void) osd_unlink (fe->fname);
835 else if (fe->ftype == FILE_MACROS)
837 (void) osd_unlink (fe->fname);
841 llbug (message ("Temporary file is not derivative: %s "
842 "(not deleted)", fe->fname));
850 if (msg && ((i % skip) == 0))
852 displayScanContinue (cstring_makeLiteral (i == 0 ? " " : "."));
863 fileTable_free (/*@only@*/ fileTable f)
867 if (f == (fileTable)NULL)
872 while ( i < f->nentries )
874 ftentry_free (f->elements[i]);
878 cstringTable_free (f->htable);
880 sfree (f->openelements); /*!! why didn't splint report this? */
885 ** unique temp filename are constructed from <dir><pre><pid><msg>.<suf>
886 ** requires: <dir> must end in '/'
889 static void nextMsg (char *msg)
919 llassertprint (FALSE, ("nextMsg: out of unique names!!!"));
927 static /*@only@*/ cstring makeTempName (cstring dir, cstring pre, cstring suf)
930 static /*@owned@*/ char *msg = NULL;
931 static /*@only@*/ cstring pidname = NULL;
935 llassert (cstring_length (pre) <= 3);
938 ** We limit the temp name to 8 characters:
946 msg = mstring_copy ("AAA"); /* there are 26^3 temp names */
951 /*@+matchanyintegral@*/
953 /*@=matchanyintegral@*/
956 if (cstring_isUndefined (pidname))
958 pidname = message ("%d", pid % 100);
961 maxlen = (cstring_length (dir) + cstring_length (pre) + mstring_length (msg)
962 + cstring_length (pidname) + cstring_length (suf) + 2);
964 DPRINTF (("Dir: %s / %s / %s / %s / %s",
965 dir, pre, pidname, msg, suf));
967 smsg = message ("%s%s%s%s%s", dir, pre, pidname, cstring_fromChars (msg), suf);
970 DPRINTF (("Trying: %s", smsg));
972 while (osd_fileExists (smsg))
975 smsg = message ("%s%s%s%s%s", dir, pre, pidname, cstring_fromChars (msg), suf);
983 foentry_create (/*@exposed@*/ FILE *f, /*@only@*/ cstring fname)
985 foentry t = (foentry) dmalloc (sizeof (*t));
992 foentry_free (/*@only@*/ foentry foe)
994 cstring_free (foe->fname);
999 fileTable_addOpen (fileTable ft, /*@observer@*/ FILE *f, /*@only@*/ cstring fname)
1001 llassert (fileTable_isDefined (ft));
1003 if (ft->nopenspace <= 0)
1005 fileTable_growOpen (ft);
1009 ft->openelements[ft->nopen] = foentry_create (f, fname);
1013 FILE *fileTable_createFile (fileTable ft, cstring fname)
1016 int fdesc = open (cstring_toCharsSafe (fname), O_WRONLY | O_CREAT | O_TRUNC | O_EXCL); /* not supported by VS.net: , S_IRUSR | S_IWUSR); */
1018 int fdesc = open (cstring_toCharsSafe (fname), O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, S_IRUSR | S_IWUSR);
1023 osd_setTempError ();
1024 llfatalerror (message ("Temporary file for "
1025 "pre-processor output already exists. Trying to "
1029 /*@notreached@*/ return NULL;
1033 FILE *res = fdopen (fdesc, "w");
1037 fileTable_addOpen (ft, res, cstring_copy (fname));
1038 DPRINTF (("Opening file: %s / %p", fname, res));
1042 DPRINTF (("Error opening: %s", fname));
1049 FILE *fileTable_createMacrosFile (fileTable ft, cstring fname)
1051 int fdesc = open (cstring_toCharsSafe (fname), O_RDWR | O_CREAT | O_TRUNC | O_EXCL, S_IRUSR | S_IWUSR);
1055 osd_setTempError ();
1056 llfatalerror (message ("Temporary file for "
1057 "pre-processor output already exists. Trying to "
1061 /*@notreached@*/ return NULL;
1065 FILE *res = fdopen (fdesc, "w+");
1069 fileTable_addOpen (ft, res, cstring_copy (fname));
1070 DPRINTF (("Opening file: %s / %p", fname, res));
1074 DPRINTF (("Error opening: %s", fname));
1081 FILE *fileTable_openReadFile (fileTable ft, cstring fname)
1083 FILE *res = fopen (cstring_toCharsSafe (fname), "r");
1087 fileTable_addOpen (ft, res, cstring_copy (fname));
1088 DPRINTF (("Opening read file: %s / %p", fname, res));
1092 DPRINTF (("Cannot open read file: %s", fname));
1099 ** Allows overwriting
1102 FILE *fileTable_openWriteFile (fileTable ft, cstring fname)
1104 FILE *res = fopen (cstring_toCharsSafe (fname), "w");
1107 fileTable_addOpen (ft, res, cstring_copy (fname));
1108 DPRINTF (("Opening file: %s / %p", fname, res));
1114 FILE *fileTable_openWriteUpdateFile (fileTable ft, cstring fname)
1116 FILE *res = fopen (cstring_toCharsSafe (fname), "w+");
1119 fileTable_addOpen (ft, res, cstring_copy (fname));
1120 DPRINTF (("Opening file: %s / %p", fname, res));
1126 bool fileTable_closeFile (fileTable ft, FILE *f)
1128 bool foundit = FALSE;
1131 llassert (fileTable_isDefined (ft));
1133 DPRINTF (("Closing file: %p", f));
1135 for (i = 0; i < ft->nopen; i++)
1137 if (ft->openelements[i]->f == f)
1139 DPRINTF (("Closing file: %p = %s", f, ft->openelements[i]->fname));
1141 if (i == ft->nopen - 1)
1143 foentry_free (ft->openelements[i]);
1144 ft->openelements[i] = NULL;
1148 foentry_free (ft->openelements[i]);
1149 ft->openelements[i] = ft->openelements[ft->nopen - 1];
1150 ft->openelements[ft->nopen - 1] = NULL;
1161 return (fclose (f) == 0);
1164 void fileTable_closeAll (fileTable ft)
1168 llassert (fileTable_isDefined (ft));
1170 for (i = 0; i < ft->nopen; i++)
1173 lldiagmsg (message ("Unclosed file at exit: %s", ft->openelements[i]->fname));
1176 if (ft->openelements[i]->f != NULL)
1178 (void) fclose (ft->openelements[i]->f); /* No check - cleaning up after errors */
1181 ft->openelements[i]->f = NULL;
1182 foentry_free (ft->openelements[i]);
1183 ft->openelements[i] = NULL;
1186 ft->nopenspace += ft->nopen;