Commit 6904dca3 authored by Geoff Simmons's avatar Geoff Simmons

trackrdrd: hash_insert without goto

parent 365555a4
......@@ -499,37 +499,37 @@ static hashentry
uint32_t h = h1(xid);
he = &htbl.entry[INDEX(h)];
if (he->state == HASH_EMPTY)
goto ok;
htbl.collisions++;
oldest = he;
h = h2(xid);
unsigned n = 0;
do {
he = &htbl.entry[INDEX(h)];
probes++;
if (he->state == HASH_EMPTY)
goto ok;
if (he->insert_time < oldest->insert_time)
oldest = he;
n++;
h += n * n;
} while (probes <= htbl.max_probes);
if (he->state != HASH_EMPTY) {
htbl.collisions++;
oldest = he;
h = h2(xid);
unsigned n = 0;
do {
he = &htbl.entry[INDEX(h)];
probes++;
if (he->state == HASH_EMPTY)
break;
if (he->insert_time < oldest->insert_time)
oldest = he;
n++;
h += n * n;
} while (probes <= htbl.max_probes);
/* none eligible for evacuation */
if (he->state != HASH_EMPTY) {
if ((oldest->insert_time + htbl.mlt) > t) {
htbl.fail++;
htbl.insert_probes += probes;
return (NULL);
}
/* none eligible for evacuation */
if ((oldest->insert_time + htbl.mlt) > t) {
htbl.fail++;
htbl.insert_probes += probes;
return (NULL);
hash_evacuate(oldest);
he = oldest;
}
}
hash_evacuate(oldest);
he = oldest;
ok:
htbl.insert_probes += probes;
he->state = HASH_OPEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment