From 849ab6055580e8d9a2b8f43fd65974fcd3a36194 Mon Sep 17 00:00:00 2001 From: "Alan M. Carroll" Date: Thu, 16 Feb 2023 22:15:57 -0600 Subject: [PATCH 1/2] libswoc: replace TextView in src/tscore/HostLookup.cc --- src/tscore/HostLookup.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tscore/HostLookup.cc b/src/tscore/HostLookup.cc index 440474e9456..ac92ed7745f 100644 --- a/src/tscore/HostLookup.cc +++ b/src/tscore/HostLookup.cc @@ -31,14 +31,14 @@ #include "tscore/ink_inet.h" #include "tscore/ink_assert.h" #include "tscore/HostLookup.h" -#include "tscpp/util/TextView.h" +#include "swoc/TextView.h" #include #include #include using std::string_view; -using ts::TextView; +using swoc::TextView; namespace { @@ -914,9 +914,10 @@ HostLookup::MatchNext(HostLookupState *s, void **opaque_ptr) break; } - string_view token{TextView{s->hostname_stub}.suffix('.')}; - s->hostname_stub.remove_suffix(std::min(s->hostname_stub.size(), token.size() + 1)); - cur = FindNextLevel(cur, token, true); + TextView name{s->hostname_stub}; + auto token = name.remove_suffix_at('.'); + s->hostname_stub = name; + cur = FindNextLevel(cur, token, true); if (cur == nullptr) { break; From 81530cedccd798476135e91894acf1214d56ffd7 Mon Sep 17 00:00:00 2001 From: "Alan M. Carroll" Date: Wed, 1 Mar 2023 18:46:30 -0600 Subject: [PATCH 2/2] fix. --- src/tscore/HostLookup.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tscore/HostLookup.cc b/src/tscore/HostLookup.cc index ac92ed7745f..fcb4e0b9d0c 100644 --- a/src/tscore/HostLookup.cc +++ b/src/tscore/HostLookup.cc @@ -915,7 +915,7 @@ HostLookup::MatchNext(HostLookupState *s, void **opaque_ptr) } TextView name{s->hostname_stub}; - auto token = name.remove_suffix_at('.'); + auto token = name.take_suffix_at('.'); s->hostname_stub = name; cur = FindNextLevel(cur, token, true);