{"thread":{"id":"35274","subject":"[PATCH 2/2] strbuf: make it clear that suffixcmp() should not be used for sorting","startedAt":"2013-11-04T20:42:50Z","lastAt":"2013-11-04T20:42:50Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"230090","messageId":"20131104204251.16987.42654.chriscool@tuxfamily.org","threadId":"35274","inReplyTo":null,"subject":"[PATCH 2/2] strbuf: make it clear that suffixcmp() should not be used for sorting","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2013-11-04T20:42:50Z","receivedAt":"2013-11-04T20:42:50Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Nobody sane uses suffixcmp() for anything but checking with zero,\nbut it is not very clear from the implementation that it should\nnot be used for any sorting.\n\nSo let's make it clear that the callers should not expect anything\nbut \"does str have sfx as its suffix, yes or no?\".\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n strbuf.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/strbuf.c b/strbuf.c\nindex 1170d01..9ba50de 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -16,7 +16,7 @@ int suffixcmp(const char *str, const char *suffix)\n \tif (len < suflen)\n \t\treturn -1;\n \telse\n-\t\treturn strcmp(str + len - suflen, suffix);\n+\t\treturn !!strcmp(str + len - suflen, suffix);\n }\n \n /*\n-- \n1.8.4.1.576.g36ba827.dirty\n"}]}