MCPcopy Create free account
hub / github.com/apache/trafficserver / match

Function match

src/proxy/http2/HPACK.cc:214–230  ·  view source on GitHub ↗

Try not to use memcmp(sv, sv) and strncasecmp(sv, sv) because we don't care which value comes first on a dictionary. Return immediately if the lengths of given strings don't match. Also, we noticed with profiling that taking char* and int was more performant than taking std::string_view.

Source from the content-addressed store, hash-verified

212// Return immediately if the lengths of given strings don't match.
213// Also, we noticed with profiling that taking char* and int was more performant than taking std::string_view.
214inline bool
215match(const char *s1, int s1_len, const char *s2, int s2_len)
216{
217 if (s1_len != s2_len) {
218 return false;
219 }
220
221 if (s1 == s2) {
222 return true;
223 }
224
225 if (memcmp(s1, s2, s1_len) != 0) {
226 return false;
227 }
228
229 return true;
230}
231
232//
233// The first byte of an HPACK field unambiguously tells us what

Callers 7

lookupFunction · 0.70
acceptMethod · 0.70
apply_ip_allow_filterMethod · 0.50
acceptMethod · 0.50
acquire_sessionMethod · 0.50
acceptMethod · 0.50

Calls 1

memcmpFunction · 0.50

Tested by

no test coverage detected