comparison place.c @ 13:120629a5d6bf

seenfile -> placefile (clearer)
author David A. Holland
date Sun, 19 Dec 2010 19:49:43 -0500
parents 6c15ca895585
children 5045b9678bb0
comparison
equal deleted inserted replaced
12:6c15ca895585 13:120629a5d6bf
9 9
10 #define NOWHERE_LINE 0 10 #define NOWHERE_LINE 0
11 #define BUILTIN_LINE 1 11 #define BUILTIN_LINE 1
12 #define COMMANDLINE_LINE 2 12 #define COMMANDLINE_LINE 2
13 13
14 struct seenfile { 14 struct placefile {
15 struct place includedfrom; 15 struct place includedfrom;
16 char *name; 16 char *name;
17 bool fromsystemdir; 17 bool fromsystemdir;
18 }; 18 };
19 DECLARRAY(seenfile); 19 DECLARRAY(placefile);
20 DEFARRAY(seenfile, ); 20 DEFARRAY(placefile, );
21 21
22 static struct seenfilearray seenfiles; 22 static struct placefilearray placefiles;
23 static bool overall_failure; 23 static bool overall_failure;
24 24
25 //////////////////////////////////////////////////////////// 25 ////////////////////////////////////////////////////////////
26 // seenfiles 26 // seenfiles
27 27
28 static 28 static
29 struct seenfile * 29 struct placefile *
30 seenfile_create(const struct place *from, char *name, bool fromsystemdir) 30 placefile_create(const struct place *from, const char *name,
31 bool fromsystemdir)
31 { 32 {
32 struct seenfile *sf; 33 struct placefile *pf;
33 34
34 sf = domalloc(sizeof(*sf)); 35 pf = domalloc(sizeof(*pf));
35 sf->includedfrom = *from; 36 pf->includedfrom = *from;
36 sf->name = name; 37 pf->name = dostrdup(name);
37 sf->fromsystemdir = fromsystemdir; 38 pf->fromsystemdir = fromsystemdir;
38 return sf; 39 return pf;
39 } 40 }
40 41
41 static 42 static
42 void 43 void
43 seenfile_destroy(struct seenfile *sf) 44 placefile_destroy(struct placefile *pf)
44 { 45 {
45 free(sf->name); 46 free(pf->name);
46 free(sf); 47 free(pf);
47 } 48 }
48 49
49 DESTROYALL_ARRAY(seenfile, ); 50 DESTROYALL_ARRAY(placefile, );
50 51
51 struct seenfile * 52 const struct placefile *
52 place_seen_file(const struct place *place, char *file, bool issystem) 53 place_addfile(const struct place *place, const char *file, bool issystem)
53 { 54 {
54 struct seenfile *sf; 55 struct placefile *pf;
55 56
56 sf = seenfile_create(place, file, issystem); 57 pf = placefile_create(place, file, issystem);
57 seenfilearray_add(&seenfiles, sf, NULL); 58 placefilearray_add(&placefiles, pf, NULL);
58 return sf; 59 return pf;
59 } 60 }
60 61
61 //////////////////////////////////////////////////////////// 62 ////////////////////////////////////////////////////////////
62 // places 63 // places
63 64
147 // module init and cleanup 148 // module init and cleanup
148 149
149 void 150 void
150 place_init(void) 151 place_init(void)
151 { 152 {
152 seenfilearray_init(&seenfiles); 153 placefilearray_init(&placefiles);
153 } 154 }
154 155
155 void 156 void
156 place_cleanup(void) 157 place_cleanup(void)
157 { 158 {
158 seenfilearray_destroyall(&seenfiles); 159 placefilearray_destroyall(&placefiles);
159 seenfilearray_cleanup(&seenfiles); 160 placefilearray_cleanup(&placefiles);
160 } 161 }