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

Method asInt

include/proxy/logging/LogFieldAliasMap.h:132–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130 void init(size_t numPairs, ...);
131
132 int
133 asInt(char *key, IntType *val, bool case_sensitive) const override
134 {
135 int retVal = INVALID_STRING;
136
137 for (IntType i = 0; i < m_entries; i++) {
138 bool found;
139 if (m_table[i].valid) {
140 if (case_sensitive) {
141 found = (strcmp(key, m_table[i].name) == 0);
142 } else {
143 found = (strcasecmp(key, m_table[i].name) == 0);
144 }
145 } else {
146 found = false;
147 }
148 if (found) {
149 *val = (unsigned int)(i + m_min);
150 retVal = ALL_OK;
151 break;
152 }
153 }
154
155 return retVal;
156 }
157
158 int
159 asString(IntType key, char *buf, size_t bufLen, size_t *numCharsPtr = nullptr) const override

Callers 1

_convertStringToIntMethod · 0.80

Calls 2

strcmpFunction · 0.85
strcasecmpFunction · 0.85

Tested by

no test coverage detected