Skip to content

Commit 5dafd97

Browse files
SolidWallOfCodezwoop
authored andcommitted
TCL: cleanup in HostLookup.cc, make sure keys are stable. (#6263)
1 parent 9987d72 commit 5dafd97

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/tscore/HostLookup.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ CharIndex::Insert(string_view match_data, HostBranch *toInsert)
301301
illegalKey.reset(new Table);
302302
}
303303
toInsert->key = match_data;
304-
illegalKey->emplace(match_data, toInsert);
304+
illegalKey->emplace(toInsert->key, toInsert);
305305
} else {
306306
while (true) {
307307
index = asciiToTable[static_cast<unsigned char>(match_data.front())];
@@ -675,20 +675,20 @@ HostLookup::InsertBranch(HostBranch *insert_in, string_view level_data)
675675
ink_release_assert(0);
676676
break;
677677
case HostBranch::HOST_HASH:
678-
insert_in->next_level._table->emplace(level_data, new_branch);
678+
insert_in->next_level._table->emplace(new_branch->key, new_branch);
679679
break;
680680
case HostBranch::HOST_INDEX:
681-
insert_in->next_level._index->Insert(level_data, new_branch);
681+
insert_in->next_level._index->Insert(new_branch->key, new_branch);
682682
break;
683683
case HostBranch::HOST_ARRAY: {
684684
auto array = insert_in->next_level._array;
685685
if (array->Insert(level_data, new_branch) == false) {
686686
// The array is out of space, time to move to a hash table
687687
auto ha = insert_in->next_level._array;
688688
auto ht = new HostTable;
689-
ht->emplace(level_data, new_branch);
689+
ht->emplace(new_branch->key, new_branch);
690690
for (auto &item : *array) {
691-
ht->emplace(item.match_data, item.branch);
691+
ht->emplace(item.branch->key, item.branch);
692692
}
693693
// Ring out the old, ring in the new
694694
delete ha;

0 commit comments

Comments
 (0)