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,13 +1005,13 @@ 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;
|
||||||
find=find->nextHash;
|
find=find->nextHash;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1037,21 +1037,21 @@ get_seen_interval(report_context * ctx)
|
||||||
boolean
|
boolean
|
||||||
add_seen(struct seen_region * seehash[], struct region * r, unsigned char mode, boolean dis)
|
add_seen(struct seen_region * seehash[], struct region * r, unsigned char mode, boolean dis)
|
||||||
{
|
{
|
||||||
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;
|
||||||
find->nextHash = seehash[index];
|
find->nextHash = seehash[index];
|
||||||
seehash[index] = find;
|
seehash[index] = find;
|
||||||
find->r = r;
|
find->r = r;
|
||||||
} else if (find->mode >= mode) {
|
} else if (find->mode >= mode) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
find->mode = mode;
|
find->mode = mode;
|
||||||
find->disbelieves |= dis;
|
find->disbelieves |= dis;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct report_type {
|
typedef struct report_type {
|
||||||
|
|
Loading…
Reference in New Issue