| 561 | } |
| 562 | |
| 563 | int |
| 564 | LogFilterInt::_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 | |
| 588 | LogFilterInt::LogFilterInt(const char *name, LogField *field, LogFilter::Action action, LogFilter::Operator oper, int64_t value) |
| 589 | : LogFilter(name, field, action, oper) |