This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 863e59a TCL: cleanup in HostLookup.cc, make sure keys are stable.
(#6263)
863e59a is described below
commit 863e59a29833888a16b59cce1512d84afac318dd
Author: Alan M. Carroll <[email protected]>
AuthorDate: Tue Dec 17 11:58:53 2019 -0600
TCL: cleanup in HostLookup.cc, make sure keys are stable. (#6263)
(cherry picked from commit 5dafd97c9f106bf56cda450a57346168e44e077f)
---
src/tscore/HostLookup.cc | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/tscore/HostLookup.cc b/src/tscore/HostLookup.cc
index 79c5095..37c0f9e 100644
--- a/src/tscore/HostLookup.cc
+++ b/src/tscore/HostLookup.cc
@@ -301,7 +301,7 @@ CharIndex::Insert(string_view match_data, HostBranch
*toInsert)
illegalKey.reset(new Table);
}
toInsert->key = match_data;
- illegalKey->emplace(match_data, toInsert);
+ illegalKey->emplace(toInsert->key, toInsert);
} else {
while (true) {
index = asciiToTable[static_cast<unsigned char>(match_data.front())];
@@ -675,10 +675,10 @@ HostLookup::InsertBranch(HostBranch *insert_in,
string_view level_data)
ink_release_assert(0);
break;
case HostBranch::HOST_HASH:
- insert_in->next_level._table->emplace(level_data, new_branch);
+ insert_in->next_level._table->emplace(new_branch->key, new_branch);
break;
case HostBranch::HOST_INDEX:
- insert_in->next_level._index->Insert(level_data, new_branch);
+ insert_in->next_level._index->Insert(new_branch->key, new_branch);
break;
case HostBranch::HOST_ARRAY: {
auto array = insert_in->next_level._array;
@@ -686,9 +686,9 @@ HostLookup::InsertBranch(HostBranch *insert_in, string_view
level_data)
// The array is out of space, time to move to a hash table
auto ha = insert_in->next_level._array;
auto ht = new HostTable;
- ht->emplace(level_data, new_branch);
+ ht->emplace(new_branch->key, new_branch);
for (auto &item : *array) {
- ht->emplace(item.match_data, item.branch);
+ ht->emplace(item.branch->key, item.branch);
}
// Ring out the old, ring in the new
delete ha;