| 1679 | } |
| 1680 | |
| 1681 | static const char *join_route_paths(CBMArena *a, const char *prefix, const char *path) { |
| 1682 | if (!path || !path[0]) { |
| 1683 | return prefix; |
| 1684 | } |
| 1685 | if (!prefix || !prefix[0] || strcmp(prefix, "/") == 0) { |
| 1686 | return path; |
| 1687 | } |
| 1688 | if (strcmp(path, "/") == 0) { |
| 1689 | return prefix; |
| 1690 | } |
| 1691 | size_t plen = strlen(prefix); |
| 1692 | bool prefix_slash = prefix[plen - 1] == '/'; |
| 1693 | bool path_slash = path[0] == '/'; |
| 1694 | if (prefix_slash && path_slash) { |
| 1695 | return cbm_arena_sprintf(a, "%s%s", prefix, path + SKIP_CHAR); |
| 1696 | } |
| 1697 | if (!prefix_slash && !path_slash) { |
| 1698 | return cbm_arena_sprintf(a, "%s/%s", prefix, path); |
| 1699 | } |
| 1700 | return cbm_arena_sprintf(a, "%s%s", prefix, path); |
| 1701 | } |
| 1702 | |
| 1703 | static const char *spring_class_route_prefix(CBMArena *a, TSNode class_node, const char *source, |
| 1704 | const CBMLangSpec *spec) { |
no test coverage detected