# HG changeset patch # User Jim Meyering # Date 1264329102 -3600 # Node ID 2ea3e3fab7ee28d7807c31a916ca68e8e187a7b2 # Parent a11a67aec9bf315235e12909f69ddce3304e5fea define STREQ(a,b) consistently, removing useless parentheses #define STREQ(a, b) (strcmp ((a), (b)) == 0) is over-parenthesized, since the only risk is that "a" or "b" contains an unparenthesized comma, but if either did that, STREQ would have 3 or more arguments. Hence, #define STREQ(a, b) (strcmp (a, b) == 0) is better. * lib/fts.c (STREQ): Remove unnecessary parentheses. * lib/hash-triple.c (STREQ): Likewise. * tests/test-argv-iter.c (STREQ): Use a and b, not s1 and s2. * lib/getugroups.c (STREQ): Likewise. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2010-01-24 Jim Meyering + + define STREQ(a,b) consistently, removing useless parentheses + #define STREQ(a, b) (strcmp ((a), (b)) == 0) is over-parenthesized, + since the only risk is that "a" or "b" contains an unparenthesized + comma, but if either did that, STREQ would have 3 or more arguments. + Hence, #define STREQ(a, b) (strcmp (a, b) == 0) is better. + * lib/fts.c (STREQ): Remove unnecessary parentheses. + * lib/hash-triple.c (STREQ): Likewise. + * tests/test-argv-iter.c (STREQ): Use a and b, not s1 and s2. + * lib/getugroups.c (STREQ): Likewise. + 2010-01-23 Jim Meyering maint.mk: fix syntax-check in a non-srcdir build directory diff --git a/lib/fts.c b/lib/fts.c --- a/lib/fts.c +++ b/lib/fts.c @@ -223,7 +223,7 @@ #endif #define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2]))) -#define STREQ(a, b) (strcmp ((a), (b)) == 0) +#define STREQ(a, b) (strcmp (a, b) == 0) #define CLR(opt) (sp->fts_options &= ~(opt)) #define ISSET(opt) (sp->fts_options & (opt)) diff --git a/lib/getugroups.c b/lib/getugroups.c --- a/lib/getugroups.c +++ b/lib/getugroups.c @@ -45,7 +45,7 @@ #else /* HAVE_GRP_H */ # include -# define STREQ(s1, s2) (strcmp (s1, s2) == 0) +# define STREQ(a, b) (strcmp (a, b) == 0) /* Like `getgroups', but for user USERNAME instead of for the current process. Store at most MAXCOUNT group IDs in the GROUPLIST array. diff --git a/lib/hash-triple.c b/lib/hash-triple.c --- a/lib/hash-triple.c +++ b/lib/hash-triple.c @@ -27,7 +27,7 @@ #include "same.h" #include "same-inode.h" -#define STREQ(a, b) (strcmp ((a), (b)) == 0) +#define STREQ(a, b) (strcmp (a, b) == 0) /* Hash an F_triple, and *do* consider the file name. */ size_t diff --git a/tests/test-argv-iter.c b/tests/test-argv-iter.c --- a/tests/test-argv-iter.c +++ b/tests/test-argv-iter.c @@ -26,7 +26,7 @@ #include "macros.h" #define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) -#define STREQ(s1, s2) (strcmp (s1, s2) == 0) +#define STREQ(a, b) (strcmp (a, b) == 0) static FILE * write_nul_delimited_argv (char **argv)