comparison files.c @ 39:337110e7240a

Pass the size to free; it makes debug checking easier.
author David A. Holland
date Sat, 30 Mar 2013 21:17:47 -0400
parents b156910b59b2
children 2e25e55dba6b
comparison
equal deleted inserted replaced
38:b156910b59b2 39:337110e7240a
68 68
69 static 69 static
70 void 70 void
71 incdir_destroy(struct incdir *id) 71 incdir_destroy(struct incdir *id)
72 { 72 {
73 dofree(id); 73 dofree(id, sizeof(*id));
74 } 74 }
75 75
76 void 76 void
77 files_init(void) 77 files_init(void)
78 { 78 {
158 lineend -= linestart; 158 lineend -= linestart;
159 linestart = 0; 159 linestart = 0;
160 } 160 }
161 if (bufend >= bufmax) { 161 if (bufend >= bufmax) {
162 /* need bigger buffer */ 162 /* need bigger buffer */
163 bufmax *= 2; 163 buf = dorealloc(buf, bufmax, bufmax*2);
164 buf = dorealloc(buf, bufmax); 164 bufmax = bufmax*2;
165 } 165 }
166 166
167 if (ateof) { 167 if (ateof) {
168 /* don't read again, in case it's a socket */ 168 /* don't read again, in case it's a socket */
169 result = 0; 169 result = 0;
240 } 240 }
241 241
242 if (toplevel) { 242 if (toplevel) {
243 directive_goteof(&linestartplace); 243 directive_goteof(&linestartplace);
244 } 244 }
245 dofree(buf); 245 dofree(buf, bufmax);
246 } 246 }
247 247
248 //////////////////////////////////////////////////////////// 248 ////////////////////////////////////////////////////////////
249 // path search 249 // path search
250 250
306 file = mkfilename(id->name, name); 306 file = mkfilename(id->name, name);
307 fd = file_tryopen(file); 307 fd = file_tryopen(file);
308 if (fd >= 0) { 308 if (fd >= 0) {
309 pf = place_addfile(place, file, id->issystem); 309 pf = place_addfile(place, file, id->issystem);
310 file_read(pf, fd, file, false); 310 file_read(pf, fd, file, false);
311 dofree(file); 311 dostrfree(file);
312 close(fd); 312 close(fd);
313 return; 313 return;
314 } 314 }
315 dofree(file); 315 dostrfree(file);
316 } 316 }
317 complain(place, "Include file %s not found", name); 317 complain(place, "Include file %s not found", name);
318 complain_fail(); 318 complain_fail();
319 } 319 }
320 320