[Sysfence-commit] sysfence/parseopt parse.c,1.13,1.14
Status: Alpha
Brought to you by:
emes
|
From: Michal S. <em...@us...> - 2004-05-26 04:14:23
|
Update of /cvsroot/sysfence/sysfence/parseopt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32209/parseopt Modified Files: parse.c Log Message: + collect_stats() comes back Index: parse.c =================================================================== RCS file: /cvsroot/sysfence/sysfence/parseopt/parse.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- parse.c 23 May 2004 20:52:23 -0000 1.13 +++ parse.c 26 May 2004 04:14:13 -0000 1.14 @@ -23,6 +23,10 @@ #include "parse.h" #include <stdio.h> #include <stdlib.h> +#ifdef DEBUG +#include <syslog.h> +#include "../log.h" +#endif #define ERRMSGBUF 128 @@ -56,18 +60,20 @@ bail_out (EXIT_PARSE, buf); } -#if 0 -void collect_stats (expression *ex, int *tab) +void collect_stats (sf_expression *ex, sf_list **statlist) { - if (ex->type == ATOMIC) { - *(tab + ((atomic *) ex->arg1)->val_id) = 1; - } else { - collect_stats ((expression *) ex->arg1, tab); - collect_stats ((expression *) ex->arg2, tab); - } -} + sf_atomic *atmp = (sf_atomic *) ex->arg1; + +#ifdef DEBUG + syslog (LOG_DEBUG, "collect_stats (%x, %x)", ex, statlist); #endif + if (ex->type == RELATION) { + collect_stats ((sf_expression *) ex->arg1, statlist); + collect_stats ((sf_expression *) ex->arg2, statlist); + } else add_def_to_list (statlist, &atmp->stat); +} + parserdata * get_logdata (tokdata *tok) { /* grammar: @@ -430,6 +436,7 @@ rlst->log = NULL; rlst->hit = 0; rlst->prevhit = 0; + rlst->watchstats = NULL; /* ruleset begins with IF */ if (tok->type != KW_IF) @@ -505,7 +512,7 @@ rlst->step = *((unsigned int *) tmp->parsed); /* search expression tree for used stats */ -// collect_stats (rlst->expr, &(rlst->showstat[0])); + collect_stats (rlst->expr, &(rlst->watchstats)); /* ok, now we got full ruleset structure. * we need only to skip to next token. |