- while (*in) {
- if (is_any_path_separator(*in)) {
- /* Collapse multiple path separators into one */
- *out++ = WIM_PATH_SEPARATOR;
- do {
- in++;
- } while (is_any_path_separator(*in));
- } else {
- /* Copy non-path-separator character */
- *out++ = *in++;
- }
- }
-
- /* Remove trailing slash if existent */
- if (*(out - 1) == WIM_PATH_SEPARATOR && (out - 1) != result)
- --out;
-
- *out = T('\0');