index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Tobias Stoeckmann <tobias@stoeckmann.org> | 2016-06-18 18:58:07 +0200 |
---|---|---|
committer | Andrew Gregory <andrew.gregory.8@gmail.com> | 2017-05-08 23:27:41 -0400 |
commit | 21fe34c3a1938a5dedf1ea384573f28cef52b75a (patch) | |
tree | e012acb4aac44a14a9035e8d8ad52c7fbb42d8f6 | |
parent | 3218360114d0e3a3a965feb2f6fd3f4e2da8c8a0 (diff) |
-rw-r--r-- | src/pacman/util.c | 8 |
diff --git a/src/pacman/util.c b/src/pacman/util.c index 3346a340..9c53c8b6 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -1488,6 +1488,8 @@ int select_question(int count) return (preset - 1); } +#define CMP(x, y) ((x) < (y) ? -1 : ((x) > (y) ? 1 : 0)) + static int mbscasecmp(const char *s1, const char *s2) { size_t len1 = strlen(s1), len2 = strlen(s2); @@ -1505,19 +1507,19 @@ static int mbscasecmp(const char *s1, const char *s2) return strcasecmp(p1, p2); } if(b1 == 0 || b2 == 0) { - return c1 - c2; + return CMP(c1, c2); } c1 = towlower(c1); c2 = towlower(c2); if(c1 != c2) { - return c1 - c2; + return CMP(c1, c2); } p1 += b1; p2 += b2; len1 -= b1; len2 -= b2; } - return *p1 - *p2; + return CMP(*p1, *p2); } /* presents a prompt and gets a Y/N answer */ |