Re: Problem listing GIT repository with accents

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

 



Jeff King schrieb:
> @@ -209,11 +209,14 @@ static size_t quote_c_style_counted(const char *name, ssize_t maxlen,
>  	size_t len, count = 0;
>  	const char *p = name;
>  
> +	if (maxlen < 0)
> +		maxlen = strlen(name);
> +
>  	for (;;) {
>  		int ch;
>  
>  		len = next_quote_pos(p, maxlen);
> -		if (len == maxlen || !p[len])
> +		if (len == maxlen)
>  			break;
>  
>  		if (!no_dq && p == name)
> @@ -223,6 +226,7 @@ static size_t quote_c_style_counted(const char *name, ssize_t maxlen,
>  		EMIT('\\');
>  		p += len;
>  		ch = (unsigned char)*p++;
> +		maxlen -= len + 1;

Couldn't you just write

		if (0 <= maxlen)
			maxlen -= len + 1;

to avoid the strlen(), because the rest of the loop is actually OK when
maxlen == -1, isn't it?

-- Hannes
--
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]