+2009-04-09 Kamil Dudka <kdudka@redhat.com>
+
+ Fix regression in 'filevercmp' module. Thanks Sven Joachim
+ for reporting it.
+ * lib/filevercmp.c: Special handle for "", "." and "..".
+ * tests/test-filevercmp.c: Enlarge the set suite.
+
2009-04-07 Jim Meyering <meyering@redhat.com>
useless-if-before-free: show how to remove braced useless free, too
if (simple_cmp == 0)
return 0;
- /* handle hidden files */
- while (*s1 == '.' || *s2 == '.')
- {
- if (*s1 != *s2)
- return *s1 - *s2;
- s1++;
- s2++;
- }
+ /* special handle for "", "." and ".." */
+ if (!*s1)
+ return -1;
+ if (!*s2)
+ return 1;
+ if (0 == strcmp (".", s1))
+ return -1;
+ if (0 == strcmp (".", s2))
+ return 1;
+ if (0 == strcmp ("..", s1))
+ return -1;
+ if (0 == strcmp ("..", s2))
+ return 1;
/* "cut" file suffixes */
s1_pos = s1;
/* set of well sorted examples */
static const char *const examples[] =
{
+ "",
".",
"..",
".a~",
"nss_ldap-1.0-0.1a.tar.gz",
"nss_ldap-10beta1.fc8.tar.gz",
"nss_ldap-10.11.8.6.20040204cvs.fc10.ebuild",
+ "#.b#",
NULL
};