Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-07 Thread Christian Couder
On Thu, Nov 7, 2013 at 1:12 AM, Junio C Hamano gits...@pobox.com wrote: Jonathan Nieder jrnie...@gmail.com writes: 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().

Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-06 Thread Jonathan Nieder
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

Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-06 Thread Max Horn
On 06.11.2013, at 23:17, Jonathan Nieder jrnie...@gmail.com wrote: 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

Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-06 Thread Jonathan Nieder
Max Horn wrote: Well, unlike suffixcmp, it is transitive, so it could be used for sorting. It is not antisymmetric. prefixcmp(foo, foobar) 0 prefixcmp(foobar, foo) == 0 I can see how it's possible to care about the sign of the return value, but it's equally possible to care

Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-06 Thread Max Horn
Am 07.11.2013 um 00:28 schrieb Jonathan Nieder jrnie...@gmail.com: Max Horn wrote: Well, unlike suffixcmp, it is transitive, so it could be used for sorting. It is not antisymmetric. prefixcmp(foo, foobar) 0 prefixcmp(foobar, foo) == 0 Right! I wasn't thinkinh :-( I can

Re: [PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-06 Thread Junio C Hamano
Jonathan Nieder jrnie...@gmail.com writes: 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,

[PATCH v3 2/2] Rename suffixcmp() to has_suffix() and invert its result

2013-11-05 Thread Christian Couder
Now has_suffix() returns 1 when the suffix is present and 0 otherwise. 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(). Signed-off-by: Christian Couder