define STREQ(a,b) consistently, removing useless parentheses
authorJim Meyering <meyering@redhat.com>
Sun, 24 Jan 2010 10:31:42 +0000 (11:31 +0100)
committerJim Meyering <meyering@redhat.com>
Sun, 24 Jan 2010 10:31:42 +0000 (11:31 +0100)
#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.

ChangeLog
lib/fts.c
lib/getugroups.c
lib/hash-triple.c
tests/test-argv-iter.c

index e85062f690878c400c9eb6ff449656dffe91e95d..373a1bb092d51000e68fbd9f4b4cc57f63a98e21 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-01-24  Jim Meyering  <meyering@redhat.com>
+
+       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  <meyering@redhat.com>
 
        maint.mk: fix syntax-check in a non-srcdir build directory
index ca967fc5aa91e9c81b2f46279f8d814011b117ef..374c58ad5648fb36287fbc77c8a238db165e7c33 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -223,7 +223,7 @@ static void free_dir (FTS *fts) {}
 #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))
index 4a5a69ddce1ca774190f12e6faa71de9446e56e2..299bae685f80f484a98f88720ed1ffa332bd587e 100644 (file)
@@ -45,7 +45,7 @@ getugroups (int maxcount _GL_UNUSED,
 #else /* HAVE_GRP_H */
 # include <grp.h>
 
-# 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.
index 094ca694798a69fbcd01a08c120faa5d88ebfebf..4205376243ee700ca9a44529a7c7f288b53cab0b 100644 (file)
@@ -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
index 868635c56b24c7ce7ad953885ec78170063c0faa..d0597bd5dc27183eb2b9182947e81e5f1b01c2f2 100644 (file)
@@ -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)