git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Christian Couder <chriscool@tuxfamily.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Avery Pennarun <apenwarr@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jeff King <peff@peff.net>, Max Horn <max@quendi.de>
Subject: Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result
Date: Wed, 6 Nov 2013 14:17:35 -0800	[thread overview]
Message-ID: <20131106221735.GB10302@google.com> (raw)
In-Reply-To: <20131105210237.21525.61810.chriscool@tuxfamily.org>

Hi,

Christian Couder wrote:

> Now has_suffix() returns 1 when the suffix is present and 0 otherwise.

Ok.  My only worry is that the function is less discoverable since
its name is so different from prefixcmp(), which might cause someone
to invent yet another postfixcmp.

> The old name followed the pattern anything-cmp(), which suggests
> a general comparison function suitable for e.g. sorting objects.
> But this was not the case for suffixcmp().

It's not clear to me that prefixcmp() is usable for sorting objects,
either.  Shouldn't it get the same treatment?

Except for that concern, the patch looks good.

If some day we invent a type for 4-byte-aligned object names, it might
make sense to do something similar to hashcmp, distinguishing between
hashcmp for use where ordering is important and something like hash_eq
when checking for equality (since I suspect the latter can be made
faster).

Thanks,
Jonathan

  reply	other threads:[~2013-11-06 22:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 21:02 [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result Christian Couder
2013-11-06 22:17 ` Jonathan Nieder [this message]
2013-11-06 22:56   ` Max Horn
2013-11-06 23:28     ` Jonathan Nieder
2013-11-06 23:53       ` Max Horn
2013-11-07  0:12   ` Junio C Hamano
2013-11-07 11:04     ` Christian Couder

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=20131106221735.GB10302@google.com \
    --to=jrnieder@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=apenwarr@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=max@quendi.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).