From 54506c4b495bd680ea4a62e5ab97be51f968cc09 Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Thu, 15 May 2008 22:00:26 +0000 Subject: There is a bug in tree_process() that mixes the start state with the final state from the last run of the machine. This can cause extra matches to be reported. --- Makefile | 3 +++ treexpr.c | 1 + 2 files changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 624869f..8cf3568 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,9 @@ $(LIB)GrokHtml$(DOTSO): $(JNISOURCES) GrokHtml.h $(LIB)treexpr$(DOTSO): $(SOURCES) $(CC) $(LIBS) $(CFLAGS) $(INCL) -shared -o $@ $(SOURCES) +run: run.c $(LIB)treexpr$(DOTSO) treexpr.h + $(CC) $(LIBS) $(CFLAGS) $(INCL) $(LIB)treexpr$(DOTSO) -o $@ run.c + test: $(LIB)GrokHtml$(DOTSO) TestIt.class LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):. $(JAVA) TestIt diff --git a/treexpr.c b/treexpr.c index 3b6a836..99d4ff6 100644 --- a/treexpr.c +++ b/treexpr.c @@ -990,6 +990,7 @@ int tree_process( struct machine *m, xmlNodePtr node ) m->next_state = zalloc( N( m->next_state, m->states ) * sizeof( *m->next_state )); // our inital current state is E(start) + memset( m->cur_state, 0, N( m->cur_state, m->states ) * sizeof( *m->cur_state )); OR( m->cur_state, m->E[m->start->num], m->states ); // main loop, terminate when we run out of input or when there's no states in the cur_state bitmask -- cgit v1.2.3-18-g5258