| 1779 | } |
| 1780 | |
| 1781 | static const char *join_route_paths(CBMArena *a, const char *prefix, const char *path) { |
| 1782 | if (!path || !path[0]) { |
| 1783 | return prefix; |
| 1784 | } |
| 1785 | if (!prefix || !prefix[0] || strcmp(prefix, "/") == 0) { |
| 1786 | return path; |
| 1787 | } |
| 1788 | if (strcmp(path, "/") == 0) { |
| 1789 | return prefix; |
| 1790 | } |
| 1791 | size_t plen = strlen(prefix); |
| 1792 | bool prefix_slash = prefix[plen - 1] == '/'; |
| 1793 | bool path_slash = path[0] == '/'; |
| 1794 | if (prefix_slash && path_slash) { |
| 1795 | return cbm_arena_sprintf(a, "%s%s", prefix, path + SKIP_CHAR); |
| 1796 | } |
| 1797 | if (!prefix_slash && !path_slash) { |
| 1798 | return cbm_arena_sprintf(a, "%s/%s", prefix, path); |
| 1799 | } |
| 1800 | return cbm_arena_sprintf(a, "%s%s", prefix, path); |
| 1801 | } |
| 1802 | |
| 1803 | static const char *spring_class_route_prefix(CBMArena *a, TSNode class_node, const char *source, |
| 1804 | const CBMLangSpec *spec) { |
no test coverage detected