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>
René Scharfe committed
Oct 1, 2017 at 16:44 UTC
fa2bb34477120f18d0834a545ac777e6295650d2
1 file changed
+1
-1
path.c
+1
-1
@@ -717,7 +717,7 @@ char *expand_user_path(const char *path, int real_home)
717
if (!home)
718
goto return_null;
719
if (real_home)
720
- strbuf_addstr(&user_path, real_path(home));
720
+ strbuf_add_real_path(&user_path, home);
721
else
722
strbuf_addstr(&user_path, home);
723
#ifdef GIT_WINDOWS_NATIVE