From: Junio C Hamano Date: Thu, 20 Feb 2014 19:44:10 GMT Subject: Re: [PATCH v3 02/25] Convert git_snpath() to strbuf_git_path() Message-ID: In-Reply-To: <1392730814-19656-3-git-send-email-pclouds@gmail.com> Nguyễn Thái Ngọc Duy writes: > @@ -2717,17 +2729,19 @@ static int copy_msg(char *buf, const char *msg) > return cp - buf; > } > > -int log_ref_setup(const char *refname, char *logfile, int bufsize) > +int log_ref_setup(const char *refname, struct strbuf *sb_logfile) > { > int logfd, oflags = O_APPEND | O_WRONLY; > + const char *logfile; > > - git_snpath(logfile, bufsize, "logs/%s", refname); > + strbuf_git_path(sb_logfile, "logs/%s", refname); > + logfile = sb_logfile->buf; > if (log_all_ref_updates && > (starts_with(refname, "refs/heads/") || > starts_with(refname, "refs/remotes/") || > starts_with(refname, "refs/notes/") || > !strcmp(refname, "HEAD"))) { > - if (safe_create_leading_directories(logfile) < 0) > + if (safe_create_leading_directories(sb_logfile->buf) < 0) Other references to logfile in this function are kept as-is, and I think this line can also stay as-it-was. That is the whole point of introducing the local variable logfile and assinging to it upfront as a synonym, isn't it?