* [PATCH 2/2] strbuf: make it clear that suffixcmp() should not be used for sorting
@ 2013-11-04 20:42 Christian Couder
0 siblings, 0 replies; only message in thread
From: Christian Couder @ 2013-11-04 20:42 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Avery Pennarun, Johannes Schindelin, Jonathan Nieder
Nobody sane uses suffixcmp() for anything but checking with zero,
but it is not very clear from the implementation that it should
not be used for any sorting.
So let's make it clear that the callers should not expect anything
but "does str have sfx as its suffix, yes or no?".
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
strbuf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/strbuf.c b/strbuf.c
index 1170d01..9ba50de 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -16,7 +16,7 @@ int suffixcmp(const char *str, const char *suffix)
if (len < suflen)
return -1;
else
- return strcmp(str + len - suflen, suffix);
+ return !!strcmp(str + len - suflen, suffix);
}
/*
--
1.8.4.1.576.g36ba827.dirty
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-11-04 20:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-04 20:42 [PATCH 2/2] strbuf: make it clear that suffixcmp() should not be used for sorting Christian Couder
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).