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

Function http_config_enum_search

src/proxy/http/HttpConfig.cc:81–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79/// If found @a value is set to the corresponding value in @a list.
80template <typename T, unsigned N>
81static bool
82http_config_enum_search(std::string_view key, const ConfigEnumPair<T> (&list)[N], MgmtByte &value)
83{
84 Dbg(dbg_ctl_http_config, "enum element %.*s", static_cast<int>(key.size()), key.data());
85 // We don't expect any of these lists to be more than 10 long, so a linear search is the best choice.
86 for (unsigned i = 0; i < N; ++i) {
87 if (key.compare(list[i]._key) == 0) {
88 value = list[i]._value;
89 return true;
90 }
91 }
92 return false;
93}
94
95/// Read a string from the configuration and convert it to an enumeration value.
96/// @a n is the number of entries in the list.

Callers 2

http_config_enum_readFunction · 0.85

Calls 3

sizeMethod · 0.45
dataMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected