Re: [PATCH] for-each-ref: Fix --format=%(subject) for log message without newlines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johan Herland <johan@xxxxxxxxxxx> writes:

>  builtin-for-each-ref.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
> index 9b44092..e59bd80 100644
> --- a/builtin-for-each-ref.c
> +++ b/builtin-for-each-ref.c
> @@ -321,8 +321,8 @@ static const char *find_wholine(const char *who, int wholen, const char *buf, un
>  static const char *copy_line(const char *buf)
>  {
>  	const char *eol = strchr(buf, '\n');
> -	if (!eol)
> -		return "";
> +	if (!eol) // simulate strchrnul()
> +		eol = buf + strlen(buf);
>  	return xmemdupz(buf, eol - buf);
>  }

Why does this C++ style comment talk about "simulate"?

Don't other parts of git already use strchrnul()?

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux