| 1406 | } |
| 1407 | |
| 1408 | static bool is_env_var_pattern(const char *s, int len) { |
| 1409 | if (len < MIN_ROUTE_LEN || len > MAX_HEX_NAME_LEN) { |
| 1410 | return false; |
| 1411 | } |
| 1412 | bool has_upper = false; |
| 1413 | bool has_underscore = false; |
| 1414 | for (int i = 0; i < len; i++) { |
| 1415 | char c = s[i]; |
| 1416 | if (c >= 'A' && c <= 'Z') { |
| 1417 | has_upper = true; |
| 1418 | } else if (c == '_') { |
| 1419 | has_underscore = true; |
| 1420 | } else if (c >= '0' && c <= '9') { |
| 1421 | /* digits ok */ |
| 1422 | } else { |
| 1423 | return false; |
| 1424 | } |
| 1425 | } |
| 1426 | return has_upper && has_underscore; |
| 1427 | } |
| 1428 | |
| 1429 | int cbm_classify_string(const char *str, int len) { |
| 1430 | if (!str || len < PAIR_LEN) { |
no outgoing calls
no test coverage detected