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

Method _convertStringToInt

src/proxy/logging/LogFilter.cc:563–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561}
562
563int
564LogFilterInt::_convertStringToInt(char *value, int64_t *ival, LogFieldAliasMap *map)
565{
566 size_t i, l = strlen(value);
567 for (i = 0; i < l && ParseRules::is_digit(value[i]); i++) {
568 ;
569 }
570
571 if (i < l) {
572 // not all characters of value are digits, assume that
573 // value is an alias and try to get the actual integer value
574 // from the log field alias map if field has one
575 //
576 if (map == nullptr || map->asInt(value, ival) != LogFieldAliasMap::ALL_OK) {
577 return -1; // error
578 };
579 } else {
580 // all characters of value are digits, simply convert
581 // the string to int
582 //
583 *ival = ink_atoui(value);
584 }
585 return 0; // all OK
586}
587
588LogFilterInt::LogFilterInt(const char *name, LogField *field, LogFilter::Action action, LogFilter::Operator oper, int64_t value)
589 : LogFilter(name, field, action, oper)

Callers

nothing calls this directly

Calls 3

is_digitFunction · 0.85
ink_atouiFunction · 0.85
asIntMethod · 0.80

Tested by

no test coverage detected