From cedc61a99804db99f9a658c3cccd5c2786a28501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 17 Jul 2014 01:38:18 +0200 Subject: strbuf: use strbuf_addstr() for adding C strings Avoid code duplication and let strbuf_addstr() call strlen() for us. Signed-off-by: Rene Scharfe Reviewed-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- path.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'path.c') diff --git a/path.c b/path.c index bc804a31b3..c3883d43d8 100644 --- a/path.c +++ b/path.c @@ -277,16 +277,16 @@ char *expand_user_path(const char *path) const char *home = getenv("HOME"); if (!home) goto return_null; - strbuf_add(&user_path, home, strlen(home)); + strbuf_addstr(&user_path, home); } else { struct passwd *pw = getpw_str(username, username_len); if (!pw) goto return_null; - strbuf_add(&user_path, pw->pw_dir, strlen(pw->pw_dir)); + strbuf_addstr(&user_path, pw->pw_dir); } to_copy = first_slash; } - strbuf_add(&user_path, to_copy, strlen(to_copy)); + strbuf_addstr(&user_path, to_copy); return strbuf_detach(&user_path, NULL); return_null: strbuf_release(&user_path); -- cgit v1.2.1