public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: David Kastrup <dak@gnu•org>
Cc: Michael Haggerty <mhagger@alum•mit.edu>, git@vger•kernel.org
Subject: Re: [PATCH v2] cache_tree_find(): remove redundant checks
Date: Wed, 05 Mar 2014 10:40:08 -0800	[thread overview]
Message-ID: <xmqq38iwij5j.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <87eh2hi7jk.fsf@fencepost.gnu.org> (David Kastrup's message of "Wed, 05 Mar 2014 05:38:39 +0100")

David Kastrup <dak@gnu•org> writes:

> Junio C Hamano <gitster@pobox•com> writes:
>
>> Michael Haggerty <mhagger@alum•mit.edu> writes:
>>
>>>  	while (*path) {
>>> -		const char *slash;
>>>  		struct cache_tree_sub *sub;
>>> +		const char *slash = strchr(path, '/');
>>>  
>>> -		slash = strchr(path, '/');
>>>  		if (!slash)
>>>  			slash = path + strlen(path);
>>
>> Isn't the above a strchrnul()?
>
> Yes.  I realized that previously, but since it's a GNU extension rather
> than part of the C standards, I discarded that idea.  Calling
>
>     git grep strchrnul
>
> shows, however, that it _is_ used plentifully already.

Yes, we have a fallback definition in compat-util, I think.

> Still worth thinking about whether there is no better name than slash
> for something that indicated the end of the current path name segment.

end_of_path_component?  Sounds a bit too long ;-)

  reply	other threads:[~2014-03-05 18:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04  8:31 [PATCH v2] cache_tree_find(): remove redundant checks Michael Haggerty
2014-03-04  9:40 ` David Kastrup
2014-03-04 10:22   ` Michael Haggerty
2014-03-04 10:34     ` David Kastrup
2014-03-04 21:05 ` Junio C Hamano
2014-03-04 22:24   ` Michael Haggerty
2014-03-04 23:18     ` Junio C Hamano
2014-03-05 17:57       ` Junio C Hamano
2014-03-05  4:38   ` David Kastrup
2014-03-05 18:40     ` Junio C Hamano [this message]
2014-03-04 21:11 ` [microproject idea] Junio C Hamano

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=xmqq38iwij5j.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=dak@gnu$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    --cc=mhagger@alum$(echo .)mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox