- Timestamp:
- Jan 11, 2007, 11:43:45 PM (14 years ago)
- Location:
- zzuf/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
zzuf/trunk/src/fd.c
r1651 r1652 36 36 37 37 /* File descriptor stuff */ 38 /* TODO: split this into a static table of around 32 file descriptors, for 39 * most common uses, and a dynamic table for optional additional fds. */ 38 40 static struct files 39 41 { … … 62 64 void _zz_fd_init(void) 63 65 { 64 files = NULL; 65 nfiles = 0; 66 /* We start with 32 file descriptors. This is to reduce the number of 67 * calls to malloc() that we do, so we get better chances that memory 68 * corruption errors are reproducible */ 69 files = malloc(32 * sizeof(*files)); 70 for(nfiles = 0; nfiles < 32; nfiles++) 71 files[nfiles].managed = 0; 66 72 67 /* Start with one fd in the lookup table */ 68 fds = malloc(1 * sizeof(int)); 69 for(maxfd = 0; maxfd < 1; maxfd++) 73 fds = malloc(32 * sizeof(int)); 74 for(maxfd = 0; maxfd < 32; maxfd++) 70 75 fds[maxfd] = -1; 71 76 } … … 137 142 files[i].pos = 0; 138 143 files[i].fuzz.cur = -1; 139 files[i].fuzz.data = malloc(CHUNKBYTES);140 144 #ifdef HAVE_FGETLN 141 145 files[i].fuzz.tmp = NULL; … … 151 155 152 156 files[fds[fd]].managed = 0; 153 free(files[fds[fd]].fuzz.data);154 157 #ifdef HAVE_FGETLN 155 158 if(files[fds[fd]].fuzz.tmp) -
zzuf/trunk/src/libzzuf.h
r1641 r1652 29 29 { 30 30 int cur; 31 uint8_t *data;32 31 #ifdef HAVE_FGETLN 33 32 char *tmp; 34 33 #endif 34 uint8_t data[CHUNKBYTES]; 35 35 }; 36 36
Note: See TracChangeset
for help on using the changeset viewer.