Mercurial > ~dholland > hg > tradcpp > index.cgi
comparison files.c @ 9:1fbcbd58742e
move destroyall to array.h
author | David A. Holland |
---|---|
date | Sun, 19 Dec 2010 19:19:02 -0500 |
parents | 97243badae69 |
children | 800f3a560a3b |
comparison
equal
deleted
inserted
replaced
8:97243badae69 | 9:1fbcbd58742e |
---|---|
29 static struct seenfilearray seenfiles; | 29 static struct seenfilearray seenfiles; |
30 | 30 |
31 //////////////////////////////////////////////////////////// | 31 //////////////////////////////////////////////////////////// |
32 // management | 32 // management |
33 | 33 |
34 #define DESTROYALL(T) \ | |
35 static \ | |
36 void \ | |
37 T##array_destroyall(struct T##array *arr) \ | |
38 { \ | |
39 unsigned i, num; \ | |
40 struct T *t; \ | |
41 \ | |
42 num = T##array_num(arr); \ | |
43 for (i=0; i<num; i++) { \ | |
44 t = T##array_get(arr, i); \ | |
45 T##_destroy(t); \ | |
46 } \ | |
47 T##array_setsize(arr, 0); \ | |
48 } | |
49 | |
50 static | 34 static |
51 struct incdir * | 35 struct incdir * |
52 incdir_create(const char *name, bool issystem) | 36 incdir_create(const char *name, bool issystem) |
53 { | 37 { |
54 struct incdir *id; | 38 struct incdir *id; |
92 { | 76 { |
93 incdirarray_init("epath); | 77 incdirarray_init("epath); |
94 incdirarray_init(&bracketpath); | 78 incdirarray_init(&bracketpath); |
95 } | 79 } |
96 | 80 |
97 DESTROYALL(incdir); | 81 DESTROYALL_ARRAY(incdir, ); |
98 DESTROYALL(seenfile); | 82 DESTROYALL_ARRAY(seenfile, ); |
99 | 83 |
100 void | 84 void |
101 files_cleanup(void) | 85 files_cleanup(void) |
102 { | 86 { |
103 seenfilearray_destroyall(&seenfiles); | 87 seenfilearray_destroyall(&seenfiles); |