All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Jeff King <peff@peff.net>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Ellié Computing Open Source Program"
	<opensource@elliecomputing.com>,
	"Pierre Habouzit" <madcoder@debian.org>,
	git@vger.kernel.org
Subject: Re: Problem listing GIT repository with accents
Date: Mon, 01 Feb 2010 13:48:01 +0100	[thread overview]
Message-ID: <4B66CD81.3010005@viscovery.net> (raw)
In-Reply-To: <20100201121933.GA9995@coredump.intra.peff.net>

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

  reply	other threads:[~2010-02-01 12:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01 10:48 Problem listing GIT repository with accents Ellié Computing Open Source Program
2010-02-01 11:32 ` Jeff King
2010-02-01 12:19   ` Jeff King
2010-02-01 12:48     ` Johannes Sixt [this message]
2010-02-01 13:39       ` Jeff King
2010-02-01 13:44         ` Jeff King
2010-02-01 17:21           ` Junio C Hamano
2010-02-01 17:40             ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B66CD81.3010005@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=madcoder@debian.org \
    --cc=opensource@elliecomputing.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.