From 352883a22baaa6063f1bc5193536c20b437930e0 Mon Sep 17 00:00:00 2001 From: Ludovic Jacomme Date: Fri, 30 Jul 2004 13:31:02 +0000 Subject: [PATCH] - Reading lib is 4 time faster like this :)) ! (small hash table size, and not destroyed every time) - bug fix ( sizeof(int) != sizeof(void *) in 64 bits) --- alliance/src/boog/src/bog_lib_matching.c | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/alliance/src/boog/src/bog_lib_matching.c b/alliance/src/boog/src/bog_lib_matching.c index 19b16aef..17e421b8 100644 --- a/alliance/src/boog/src/bog_lib_matching.c +++ b/alliance/src/boog/src/bog_lib_matching.c @@ -37,13 +37,7 @@ #include "bog_lib_matching.h" -/*size of memory block*/ -#define BLOCK 256 - -static authtable* HTABLE; - - - +static authtable* HTABLE = NULL; /******************************************************************************/ /* return 0, if there is already a variable with pattern */ @@ -60,7 +54,7 @@ static int relation_between(chain_list* expr, char* pattern) else return 0; } - addauthelem(HTABLE, pattern,(int)expr); + addauthelem(HTABLE, pattern,(long)expr); return 1; } @@ -134,13 +128,23 @@ extern int pattern_matching(chain_list* expr, chain_list* pattern) exit(1); } - HTABLE=createauthtable (BLOCK); + if ( HTABLE == (authtable *)0 ) + { + HTABLE=createauthtable ( 13 ); + } + else + { + resetauthtable( HTABLE ); + } ret=loc_pattern_matching(expr,pattern); - /*free table*/ - destroyauthtable(HTABLE); - HTABLE=NULL; + + if ( HTABLE->TABLE_SIZE > 50 ) + { + destroyauthtable( HTABLE ); + HTABLE = (authtable *)0; + } return ret; }