| 3563 | } |
| 3564 | |
| 3565 | static const char *join_route_paths(CBMArena *a, const char *prefix, const char *path) { |
| 3566 | if (!path || !path[0]) { |
| 3567 | return prefix; |
| 3568 | } |
| 3569 | if (!prefix || !prefix[0] || strcmp(prefix, "/") == 0) { |
| 3570 | return path; |
| 3571 | } |
| 3572 | if (strcmp(path, "/") == 0) { |
| 3573 | return prefix; |
| 3574 | } |
| 3575 | size_t plen = strlen(prefix); |
| 3576 | bool prefix_slash = prefix[plen - 1] == '/'; |
| 3577 | bool path_slash = path[0] == '/'; |
| 3578 | if (prefix_slash && path_slash) { |
| 3579 | return cbm_arena_sprintf(a, "%s%s", prefix, path + SKIP_CHAR); |
| 3580 | } |
| 3581 | if (!prefix_slash && !path_slash) { |
| 3582 | return cbm_arena_sprintf(a, "%s/%s", prefix, path); |
| 3583 | } |
| 3584 | return cbm_arena_sprintf(a, "%s%s", prefix, path); |
| 3585 | } |
| 3586 | |
| 3587 | static const char *spring_class_route_prefix(CBMArena *a, TSNode class_node, const char *source, |
| 3588 | const CBMLangSpec *spec) { |
no test coverage detected