Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions iocore/cache/CacheHosting.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,18 @@ CacheHostMatcher::Match(const char *rdata, int rlen, CacheHostResult *result) co
return;
}

char *data = static_cast<char *>(ats_malloc(rlen + 1));
memcpy(data, rdata, rlen);
*(data + rlen) = '\0';
std::string_view data{rdata, static_cast<size_t>(rlen)};
HostLookupState s;

r = host_lookup->MatchFirst(data, &s, &opaque_ptr);

while (r == true) {
ink_assert(opaque_ptr != nullptr);
data_ptr = static_cast<CacheHostRecord *>(opaque_ptr);
data_ptr->UpdateMatch(result, data);
data_ptr->UpdateMatch(result);

r = host_lookup->MatchNext(&s, &opaque_ptr);
}
ats_free(data);
}

//
Expand Down Expand Up @@ -577,7 +574,7 @@ CacheHostRecord::Init(matcher_line *line_info, CacheType typ)
}

void
CacheHostRecord::UpdateMatch(CacheHostResult *r, char * /* rd ATS_UNUSED */)
CacheHostRecord::UpdateMatch(CacheHostResult *r)
{
r->record = this;
}
Expand Down
2 changes: 1 addition & 1 deletion iocore/cache/P_CacheHosting.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct CacheHostRecord {
int Init(CacheType typ);
int Init(matcher_line *line_info, CacheType typ);

void UpdateMatch(CacheHostResult *r, char *rd);
void UpdateMatch(CacheHostResult *r);
void Print() const;

~CacheHostRecord()
Expand Down