| 1588 | } |
| 1589 | |
| 1590 | static bool is_env_var_pattern(const char *s, int len) { |
| 1591 | if (len < MIN_ROUTE_LEN || len > MAX_HEX_NAME_LEN) { |
| 1592 | return false; |
| 1593 | } |
| 1594 | bool has_upper = false; |
| 1595 | bool has_underscore = false; |
| 1596 | for (int i = 0; i < len; i++) { |
| 1597 | char c = s[i]; |
| 1598 | if (c >= 'A' && c <= 'Z') { |
| 1599 | has_upper = true; |
| 1600 | } else if (c == '_') { |
| 1601 | has_underscore = true; |
| 1602 | } else if (c >= '0' && c <= '9') { |
| 1603 | /* digits ok */ |
| 1604 | } else { |
| 1605 | return false; |
| 1606 | } |
| 1607 | } |
| 1608 | return has_upper && has_underscore; |
| 1609 | } |
| 1610 | |
| 1611 | int cbm_classify_string(const char *str, int len) { |
| 1612 | if (!str || len < PAIR_LEN) { |
no outgoing calls
no test coverage detected