| 1209 | } |
| 1210 | |
| 1211 | int strbuf_normalize_path(struct strbuf *src) |
| 1212 | { |
| 1213 | struct strbuf dst = STRBUF_INIT; |
| 1214 | |
| 1215 | strbuf_grow(&dst, src->len); |
| 1216 | if (normalize_path_copy(dst.buf, src->buf) < 0) { |
| 1217 | strbuf_release(&dst); |
| 1218 | return -1; |
| 1219 | } |
| 1220 | |
| 1221 | /* |
| 1222 | * normalize_path does not tell us the new length, so we have to |
| 1223 | * compute it by looking for the new NUL it placed |
| 1224 | */ |
| 1225 | strbuf_setlen(&dst, strlen(dst.buf)); |
| 1226 | strbuf_swap(src, &dst); |
| 1227 | strbuf_release(&dst); |
| 1228 | return 0; |
| 1229 | } |
| 1230 | |
| 1231 | /* |
| 1232 | * path = Canonical absolute path |
no test coverage detected