Tokenize path by '/' into segments array. Returns number of segments added. */
| 86 | |
| 87 | /* Tokenize path by '/' into segments array. Returns number of segments added. */ |
| 88 | static int tokenize_path(char *path, const char **segments, int max_segs) { |
| 89 | int count = 0; |
| 90 | if (path[0] == '\0') { |
| 91 | return 0; |
| 92 | } |
| 93 | char *tok = path; |
| 94 | while (tok && *tok && count < max_segs) { |
| 95 | char *slash = strchr(tok, '/'); |
| 96 | if (slash) { |
| 97 | *slash = '\0'; |
| 98 | } |
| 99 | if (tok[0] != '\0') { |
| 100 | segments[count++] = tok; |
| 101 | } |
| 102 | tok = slash ? slash + SKIP_ONE : NULL; |
| 103 | } |
| 104 | return count; |
| 105 | } |
| 106 | |
| 107 | /* Strip __init__ (Python) / index (JS/TS) from the last segment when a |
| 108 | * symbol name is provided. Keeps it when no name is given to avoid QN |
no outgoing calls
no test coverage detected