Re: [PATCH v3 02/25] Convert git_snpath() to strbuf_git_path()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 20, 2014, 19:44 UTC
- Message-ID
- <xmqqha7t6039.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1392730814-19656-3-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 20 quoted lines
> @@ -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?