get (and remove) the next component in 'remaining' and place it in 'next' */
| 31 | |
| 32 | /* get (and remove) the next component in 'remaining' and place it in 'next' */ |
| 33 | static void get_next_component(struct strbuf *next, struct strbuf *remaining) |
| 34 | { |
| 35 | char *start = NULL; |
| 36 | char *end = NULL; |
| 37 | |
| 38 | strbuf_reset(next); |
| 39 | |
| 40 | /* look for the next component */ |
| 41 | /* Skip sequences of multiple path-separators */ |
| 42 | for (start = remaining->buf; is_dir_sep(*start); start++) |
| 43 | ; /* nothing */ |
| 44 | /* Find end of the path component */ |
| 45 | for (end = start; *end && !is_dir_sep(*end); end++) |
| 46 | ; /* nothing */ |
| 47 | |
| 48 | strbuf_add(next, start, end - start); |
| 49 | /* remove the component from 'remaining' */ |
| 50 | strbuf_remove(remaining, 0, end - remaining->buf); |
| 51 | } |
| 52 | |
| 53 | /* copies root part from remaining to resolved, canonicalizing it on the way */ |
| 54 | static void get_root_part(struct strbuf *resolved, struct strbuf *remaining) |
no test coverage detected