X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fstat%2Fstatev.c;h=1e78d6de2dbcf92665da55d1eeac637f88f1f09c;hb=1350645390c1ab5f39ab987d9c3dfb2b031e56ec;hp=4d5c9e16f62e37369314ad0e3cf943f16292a17b;hpb=424c800b2c999ae359d857a21b234fd4a07e154b;p=libfirm diff --git a/ir/stat/statev.c b/ir/stat/statev.c index 4d5c9e16f..1e78d6de2 100644 --- a/ir/stat/statev.c +++ b/ir/stat/statev.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "util.h" #include "stat_timing.h" @@ -41,10 +42,6 @@ #ifndef DISABLE_STATEV -#ifdef HAVE_REGEX_H -#define FIRM_HAVE_REGEX -#endif - #define MAX_TIMER 256 static FILE* stat_ev_file = NULL; @@ -54,8 +51,6 @@ int stat_ev_timer_sp = 0; timing_ticks_t stat_ev_timer_elapsed[MAX_TIMER]; timing_ticks_t stat_ev_timer_start[MAX_TIMER]; -#ifdef FIRM_HAVE_REGEX -#include static regex_t regex; static regex_t *filter = NULL; static inline int key_matches(const char *key) @@ -66,22 +61,6 @@ static inline int key_matches(const char *key) return regexec(filter, key, 0, NULL, 0) == 0; } -#else -static char filter[128] = { '\0' }; -static inline int key_matches(const char *key) -{ - int i = 0; - - for (i = 0; filter[i] != '\0'; ++i) { - if (key[i] != filter[i]) - return 0; - } - - return 1; -} -#endif /* FIRM_HAVE_REGEX */ - - void stat_ev_printf(char ev, const char *key, const char *fmt, ...) { if (!key_matches(key)) @@ -108,13 +87,9 @@ void stat_ev_begin(const char *prefix, const char *filt) stat_ev_file = fopen(buf, "wt"); if (filt && filt[0] != '\0') { -#ifdef FIRM_HAVE_REGEX filter = NULL; if (regcomp(®ex, filt, REG_EXTENDED) == 0) filter = ®ex; -#else - strncpy(filter, filt, sizeof(filter) - sizeof(filter[0])); -#endif /* FIRM_HAVE_REGEX */ } stat_ev_enabled = stat_ev_file != NULL; @@ -125,6 +100,8 @@ void stat_ev_end(void) if (stat_ev_file) { fclose(stat_ev_file); } + if (filter != NULL) + regfree(filter); } #endif