Changeset 1621 for zzuf


Ignore:
Timestamp:
Jan 7, 2007, 10:14:26 PM (13 years ago)
Author:
Sam Hocevar
Message:
  • Factor regex stuff into fd.c, so that <regex.h> isn’t needed otherwhere.
Location:
zzuf/trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/fd.c

    r1613 r1621  
    3131#include "fd.h"
    3232
    33 regex_t * re_include = NULL;
    34 regex_t * re_exclude = NULL;
     33/* Regex stuff */
     34static regex_t * re_include = NULL;
     35static regex_t * re_exclude = NULL;
    3536
    3637/* File descriptor stuff */
     
    4647static int *fds;
    4748static int maxfd, nfiles;
     49
     50void _zz_include(char const *regex)
     51{
     52    re_include = malloc(sizeof(*re_include));
     53
     54    if(regcomp(re_include, regex, REG_EXTENDED) != 0)
     55    {
     56        free(re_include);
     57        re_include = NULL;
     58    }
     59}
     60
     61void _zz_exclude(char const *regex)
     62{
     63    re_exclude = malloc(sizeof(*re_exclude));
     64
     65    if(regcomp(re_exclude, regex, REG_EXTENDED) != 0)
     66    {
     67        free(re_exclude);
     68        re_exclude = NULL;
     69    }
     70}
    4871
    4972void _zz_fd_init(void)
  • zzuf/trunk/src/fd.h

    r1613 r1621  
    1717 */
    1818
     19extern void _zz_include(char const *);
     20extern void _zz_exclude(char const *);
    1921extern void _zz_fd_init(void);
    2022extern void _zz_fd_fini(void);
    21 
    22 extern regex_t * re_include;
    23 extern regex_t * re_exclude;
    2423
    2524extern int _zz_mustwatch(char const *);
  • zzuf/trunk/src/fuzz.c

    r1614 r1621  
    2626#include <stdio.h>
    2727#include <string.h>
    28 #include <regex.h>
    2928
    3029#include "libzzuf.h"
  • zzuf/trunk/src/libzzuf.c

    r1614 r1621  
    3030#include <string.h>
    3131#include <fcntl.h>
    32 #include <regex.h>
    3332
    3433#include <stdarg.h>
     
    7574    tmp = getenv("ZZUF_INCLUDE");
    7675    if(tmp && *tmp)
    77     {
    78         re_include = malloc(sizeof(*re_include));
    79         regcomp(re_include, tmp, REG_EXTENDED);
    80     }
     76        _zz_include(tmp);
    8177
    8278    tmp = getenv("ZZUF_EXCLUDE");
    8379    if(tmp && *tmp)
    84     {
    85         re_exclude = malloc(sizeof(*re_exclude));
    86         regcomp(re_exclude, tmp, REG_EXTENDED);
    87     }
     80        _zz_exclude(tmp);
    8881
    8982    tmp = getenv("ZZUF_SIGNAL");
  • zzuf/trunk/src/load-fd.c

    r1613 r1621  
    3232#include <string.h>
    3333#include <dlfcn.h>
    34 #include <regex.h>
    3534
    3635#include <sys/types.h>
  • zzuf/trunk/src/load-signal.c

    r1613 r1621  
    2929#include <stdlib.h>
    3030#include <dlfcn.h>
    31 #include <regex.h>
    3231
    3332#include <string.h>
  • zzuf/trunk/src/load-stream.c

    r1620 r1621  
    2828#include <stdlib.h>
    2929#include <dlfcn.h>
    30 #include <regex.h>
    3130
    3231#include <stdio.h>
Note: See TracChangeset for help on using the changeset viewer.