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

Function TSUserArgIndexNameLookup

src/api/InkAPI.cc:5115–5133  ·  view source on GitHub ↗

Not particularly efficient, but good enough for now.

Source from the content-addressed store, hash-verified

5113
5114// Not particularly efficient, but good enough for now.
5115TSReturnCode
5116TSUserArgIndexNameLookup(TSUserArgType type, const char *name, int *arg_idx, const char **description)
5117{
5118 sdk_assert(sdk_sanity_check_null_ptr(arg_idx) == TS_SUCCESS);
5119 sdk_assert(0 <= type && type < TS_USER_ARGS_COUNT);
5120
5121 std::string_view n{name};
5122
5123 for (UserArg *arg = UserArgTable[type], *limit = arg + UserArgIdx[type]; arg < limit; ++arg) {
5124 if (arg->name == n) {
5125 if (description) {
5126 *description = arg->description.c_str();
5127 }
5128 *arg_idx = arg - UserArgTable[type] + get_user_arg_offset(type);
5129 return TS_SUCCESS;
5130 }
5131 }
5132 return TS_ERROR;
5133}
5134
5135// -------------
5136void

Callers 3

TSUserArgIndexReserveFunction · 0.85
TSRemapNewInstanceFunction · 0.85

Calls 3

get_user_arg_offsetFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected