diff options
author | Calvin Wan <calvinwan@google.com> | 2023-06-06 22:48:42 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-12 23:49:36 +0300 |
commit | aba070683295a20bdf4f49146384984961c794b2 (patch) | |
tree | 7443395ecf2bee3aa871646474576feab241984d /strbuf.c | |
parent | f94018506c6103331a0183d78b206f39cf739ec3 (diff) |
path: move related function to path
Move path-related function from strbuf.[ch] to path.[ch] so that strbuf
is focused on string manipulation routines with minimal dependencies.
repository.h is no longer a necessary dependency after moving this
function out.
Signed-off-by: Calvin Wan <calvinwan@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.c')
-rw-r--r-- | strbuf.c | 21 |
1 files changed, 0 insertions, 21 deletions
@@ -3,7 +3,6 @@ #include "environment.h" #include "gettext.h" #include "hex.h" -#include "repository.h" #include "strbuf.h" #include "string-list.h" #include "utf8.h" @@ -1089,26 +1088,6 @@ void strbuf_stripspace(struct strbuf *sb, int skip_comments) strbuf_setlen(sb, j); } -int strbuf_normalize_path(struct strbuf *src) -{ - struct strbuf dst = STRBUF_INIT; - - strbuf_grow(&dst, src->len); - if (normalize_path_copy(dst.buf, src->buf) < 0) { - strbuf_release(&dst); - return -1; - } - - /* - * normalize_path does not tell us the new length, so we have to - * compute it by looking for the new NUL it placed - */ - strbuf_setlen(&dst, strlen(dst.buf)); - strbuf_swap(src, &dst); - strbuf_release(&dst); - return 0; -} - void strbuf_strip_file_from_path(struct strbuf *sb) { char *path_sep = find_last_dir_sep(sb->buf); |