* Renamed ranges_static into static_ranges.

This commit is contained in:
Sam Hocevar
2007-07-06 20:47:51 +00:00
committed by sam
parent 583632ff09
commit cc7dc895b5
3 changed files with 11 additions and 10 deletions
+4 -3
View File
@@ -45,7 +45,7 @@ static int has_include = 0, has_exclude = 0;
/* File descriptor cherry picking */
static int *ranges = NULL;
static int ranges_static[512];
static int static_ranges[512];
/* File descriptor stuff. When program is launched, we use the static array of
* 32 structures, which ought to be enough for most programs. If it happens
@@ -98,8 +98,7 @@ void _zz_exclude(char const *regex)
/* This function is the same as _zz_bytes() */
void _zz_pick(char const *list)
{
/* TODO: free(ranges) if ranges != ranges_static */
ranges = _zz_allocrange(list, ranges_static);
ranges = _zz_allocrange(list, static_ranges);
}
void _zz_setseed(int32_t s)
@@ -190,6 +189,8 @@ void _zz_fd_fini(void)
free(files);
if(fds != static_fds)
free(fds);
if(ranges != static_ranges)
free(ranges);
}
int _zz_mustwatch(char const *file)
+3 -3
View File
@@ -46,7 +46,7 @@ fuzzing;
/* Per-offset byte protection */
static int *ranges = NULL;
static int ranges_static[512];
static int static_ranges[512];
/* Per-value byte protection */
static int protect[256];
@@ -68,8 +68,8 @@ extern void _zz_fuzzing(char const *mode)
/* This function is the same as _zz_pick() */
void _zz_bytes(char const *list)
{
/* TODO: free(ranges) if ranges != ranges_static */
ranges = _zz_allocrange(list, ranges_static);
/* TODO: free(ranges) if ranges != static_ranges */
ranges = _zz_allocrange(list, static_ranges);
}
void _zz_protect(char const *list)
+4 -4
View File
@@ -32,9 +32,9 @@
/* This function converts a string containing a list of ranges in the format
* understood by cut(1) such as "1-5,8,10-" into a C array for lookup.
* If more than 256 slots are required, new memory is allocated, otherwise
* the static array ranges_static is used. It is the caller's duty to call
* free() if the returned value is not ranges_static. */
int *_zz_allocrange(char const *list, int *ranges_static)
* the static array static_ranges is used. It is the caller's duty to call
* free() if the returned value is not static_ranges. */
int *_zz_allocrange(char const *list, int *static_ranges)
{
char const *parser;
int *ranges;
@@ -48,7 +48,7 @@ int *_zz_allocrange(char const *list, int *ranges_static)
if(chunks >= 256)
ranges = malloc((chunks + 1) * 2 * sizeof(unsigned int));
else
ranges = ranges_static;
ranges = static_ranges;
/* Fill ranges list */
for(parser = list, i = 0; i < chunks; i++)