Commit 59d2b74e authored by Geoff Simmons's avatar Geoff Simmons

trackrdrd: hash_insert without goto

parent c7311045
...@@ -499,9 +499,7 @@ static hashentry ...@@ -499,9 +499,7 @@ static hashentry
uint32_t h = h1(xid); uint32_t h = h1(xid);
he = &htbl.entry[INDEX(h)]; he = &htbl.entry[INDEX(h)];
if (he->state == HASH_EMPTY) if (he->state != HASH_EMPTY) {
goto ok;
htbl.collisions++; htbl.collisions++;
oldest = he; oldest = he;
...@@ -512,7 +510,7 @@ static hashentry ...@@ -512,7 +510,7 @@ static hashentry
probes++; probes++;
if (he->state == HASH_EMPTY) if (he->state == HASH_EMPTY)
goto ok; break;
if (he->insert_time < oldest->insert_time) if (he->insert_time < oldest->insert_time)
oldest = he; oldest = he;
n++; n++;
...@@ -520,6 +518,7 @@ static hashentry ...@@ -520,6 +518,7 @@ static hashentry
} while (probes <= htbl.max_probes); } while (probes <= htbl.max_probes);
/* none eligible for evacuation */ /* none eligible for evacuation */
if (he->state != HASH_EMPTY) {
if ((oldest->insert_time + htbl.mlt) > t) { if ((oldest->insert_time + htbl.mlt) > t) {
htbl.fail++; htbl.fail++;
htbl.insert_probes += probes; htbl.insert_probes += probes;
...@@ -528,8 +527,9 @@ static hashentry ...@@ -528,8 +527,9 @@ static hashentry
hash_evacuate(oldest); hash_evacuate(oldest);
he = oldest; he = oldest;
}
}
ok:
htbl.insert_probes += probes; htbl.insert_probes += probes;
he->state = HASH_OPEN; 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