path: use strbuf_add_real_path()
Avoid a string copy to a static buffer by using strbuf_add_real_path() instead of combining strbuf_addstr() and real_path(). Patch generated by Coccinelle and contrib/coccinelle/strbuf.cocci. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
ea220ee40c
commit
fa2bb34477
2
path.c
2
path.c
@ -717,7 +717,7 @@ char *expand_user_path(const char *path, int real_home)
|
|||||||
if (!home)
|
if (!home)
|
||||||
goto return_null;
|
goto return_null;
|
||||||
if (real_home)
|
if (real_home)
|
||||||
strbuf_addstr(&user_path, real_path(home));
|
strbuf_add_real_path(&user_path, home);
|
||||||
else
|
else
|
||||||
strbuf_addstr(&user_path, home);
|
strbuf_addstr(&user_path, home);
|
||||||
#ifdef GIT_WINDOWS_NATIVE
|
#ifdef GIT_WINDOWS_NATIVE
|
||||||
|
Loading…
Reference in New Issue
Block a user