git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Problem listing GIT repository with accents

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Feb 1, 2010, 12:48 UTC
Message-ID
<4B66CD81.3010005@viscovery.net>
In-Reply-To
<20100201121933.GA9995@coredump.intra.peff.net>
Jeff King schrieb:
Show 21 quoted lines
> @@ -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
Previous: Jeff KingNext: Jeff King
Message 4 of 8 in “Problem listing GIT repository with accents”
  1. Ellié Computing Open Source ProgramFeb 1, 2010
  2. Jeff KingFeb 1, 2010
  3. Jeff KingFeb 1, 2010
  4. Johannes SixtFeb 1, 2010
  5. Jeff KingFeb 1, 2010
  6. Jeff KingFeb 1, 2010
  7. Junio C HamanoFeb 1, 2010
  8. Jeff KingFeb 1, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.