Mercurial > ~dholland > hg > tradcpp > index.cgi
diff files.c @ 10:800f3a560a3b
move seenfiles to place.c too
author | David A. Holland |
---|---|
date | Sun, 19 Dec 2010 19:27:14 -0500 (2010-12-20) |
parents | 1fbcbd58742e |
children | 120629a5d6bf |
line wrap: on
line diff
--- a/files.c Sun Dec 19 19:19:02 2010 -0500 +++ b/files.c Sun Dec 19 19:27:14 2010 -0500 @@ -14,19 +14,10 @@ bool issystem; }; -struct seenfile { - struct place includedfrom; - char *name; - bool fromsystemdir; -}; - DECLARRAY(incdir); -DECLARRAY(seenfile); DEFARRAY(incdir, ); -DEFARRAY(seenfile, ); static struct incdirarray quotepath, bracketpath; -static struct seenfilearray seenfiles; //////////////////////////////////////////////////////////// // management @@ -50,27 +41,6 @@ free(id); } -static -struct seenfile * -seenfile_create(const struct place *from, char *name, bool fromsystemdir) -{ - struct seenfile *sf; - - sf = domalloc(sizeof(*sf)); - sf->includedfrom = *from; - sf->name = name; - sf->fromsystemdir = fromsystemdir; - return sf; -} - -static -void -seenfile_destroy(struct seenfile *sf) -{ - free(sf->name); - free(sf); -} - void files_init(void) { @@ -79,14 +49,10 @@ } DESTROYALL_ARRAY(incdir, ); -DESTROYALL_ARRAY(seenfile, ); void files_cleanup(void) { - seenfilearray_destroyall(&seenfiles); - seenfilearray_cleanup(&seenfiles); - incdirarray_destroyall("epath); incdirarray_cleanup("epath); incdirarray_destroyall(&bracketpath); @@ -115,21 +81,6 @@ } //////////////////////////////////////////////////////////// -// seenfile functions exposed for places.c - -const char * -seenfile_getname(const struct seenfile *file) -{ - return file->name; -} - -const struct place * -seenfile_getincludeplace(const struct seenfile *file) -{ - return &file->includedfrom; -} - -//////////////////////////////////////////////////////////// // parsing void @@ -170,8 +121,7 @@ file = dostrdup3(id->name, "/", name); fd = file_tryopen(file); if (fd >= 0) { - sf = seenfile_create(place, file, id->issystem); - seenfilearray_add(&seenfiles, sf, NULL); + sf = place_seen_file(place, file, id->issystem); file_read(sf, fd); close(fd); return; @@ -207,8 +157,7 @@ warn("%s", name); die(); } - sf = seenfile_create(place, dostrdup(name), false); - seenfilearray_add(&seenfiles, sf, NULL); + sf = place_seen_file(place, dostrdup(name), false); file_read(sf, fd); close(fd); }