{"thread":{"id":"46866","subject":"[PATCH] path: use strbuf_add_real_path()","startedAt":"2017-10-01T14:44:17Z","lastAt":"2017-10-01T14:44:17Z","messageCount":1,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"329281","messageId":"7f710738-98e1-f075-9369-113296e077bb@web.de","threadId":"46866","inReplyTo":null,"subject":"[PATCH] path: use strbuf_add_real_path()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2017-10-01T14:44:06Z","receivedAt":"2017-10-01T14:44:17Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Avoid a string copy to a static buffer by using strbuf_add_real_path()\ninstead of combining strbuf_addstr() and real_path().\n\nPatch generated by Coccinelle and contrib/coccinelle/strbuf.cocci.\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n path.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/path.c b/path.c\nindex b533ec938d..bf096c411c 100644\n--- a/path.c\n+++ b/path.c\n@@ -717,7 +717,7 @@ char *expand_user_path(const char *path, int real_home)\n \t\t\tif (!home)\n \t\t\t\tgoto return_null;\n \t\t\tif (real_home)\n-\t\t\t\tstrbuf_addstr(&user_path, real_path(home));\n+\t\t\t\tstrbuf_add_real_path(&user_path, home);\n \t\t\telse\n \t\t\t\tstrbuf_addstr(&user_path, home);\n #ifdef GIT_WINDOWS_NATIVE\n-- \n2.14.2\n"}]}