- 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)
This commit is contained in:
parent
7aff03606f
commit
352883a22b
|
@ -37,13 +37,7 @@
|
||||||
#include "bog_lib_matching.h"
|
#include "bog_lib_matching.h"
|
||||||
|
|
||||||
|
|
||||||
/*size of memory block*/
|
static authtable* HTABLE = NULL;
|
||||||
#define BLOCK 256
|
|
||||||
|
|
||||||
static authtable* HTABLE;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* return 0, if there is already a variable with pattern */
|
/* 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;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
addauthelem(HTABLE, pattern,(int)expr);
|
addauthelem(HTABLE, pattern,(long)expr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,13 +128,23 @@ extern int pattern_matching(chain_list* expr, chain_list* pattern)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
HTABLE=createauthtable (BLOCK);
|
if ( HTABLE == (authtable *)0 )
|
||||||
|
{
|
||||||
|
HTABLE=createauthtable ( 13 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resetauthtable( HTABLE );
|
||||||
|
}
|
||||||
|
|
||||||
ret=loc_pattern_matching(expr,pattern);
|
ret=loc_pattern_matching(expr,pattern);
|
||||||
|
|
||||||
/*free table*/
|
|
||||||
destroyauthtable(HTABLE);
|
if ( HTABLE->TABLE_SIZE > 50 )
|
||||||
HTABLE=NULL;
|
{
|
||||||
|
destroyauthtable( HTABLE );
|
||||||
|
HTABLE = (authtable *)0;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue