forked from github/server
Bessere hashgröße für seenhash
This commit is contained in:
parent
7d856b43da
commit
61a6a52665
|
@ -968,7 +968,7 @@ get_addresses(report_context * ctx)
|
||||||
ctx->addresses = flist;
|
ctx->addresses = flist;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAXSEEHASH 10007
|
#define MAXSEEHASH 0x3000
|
||||||
seen_region * reuse;
|
seen_region * reuse;
|
||||||
|
|
||||||
seen_region **
|
seen_region **
|
||||||
|
@ -1005,7 +1005,7 @@ free_seen(void)
|
||||||
seen_region *
|
seen_region *
|
||||||
find_seen(struct seen_region * seehash[], const region * r)
|
find_seen(struct seen_region * seehash[], const region * r)
|
||||||
{
|
{
|
||||||
unsigned int index = reg_hashkey(r) % MAXSEEHASH;
|
unsigned int index = reg_hashkey(r) & (MAXSEEHASH-1);
|
||||||
seen_region * find = seehash[index];
|
seen_region * find = seehash[index];
|
||||||
while (find) {
|
while (find) {
|
||||||
if (find->r==r) return find;
|
if (find->r==r) return find;
|
||||||
|
@ -1039,7 +1039,7 @@ add_seen(struct seen_region * seehash[], struct region * r, unsigned char mode,
|
||||||
{
|
{
|
||||||
seen_region * find = find_seen(seehash, r);
|
seen_region * find = find_seen(seehash, r);
|
||||||
if (find==NULL) {
|
if (find==NULL) {
|
||||||
unsigned int index = reg_hashkey(r) % MAXSEEHASH;
|
unsigned int index = reg_hashkey(r) & (MAXSEEHASH-1);
|
||||||
if (!reuse) reuse = (seen_region*)calloc(1, sizeof(struct seen_region));
|
if (!reuse) reuse = (seen_region*)calloc(1, sizeof(struct seen_region));
|
||||||
find = reuse;
|
find = reuse;
|
||||||
reuse = reuse->nextHash;
|
reuse = reuse->nextHash;
|
||||||
|
|
Loading…
Reference in New Issue