Mercurial > hg > octave-nkf > gnulib-hg
changeset 12772:2ea3e3fab7ee
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.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Sun, 24 Jan 2010 11:31:42 +0100 |
parents | a11a67aec9bf |
children | 1fedbaac4fa9 |
files | ChangeLog lib/fts.c lib/getugroups.c lib/hash-triple.c tests/test-argv-iter.c |
diffstat | 5 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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))
--- a/lib/getugroups.c +++ b/lib/getugroups.c @@ -45,7 +45,7 @@ #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.
--- 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
--- 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)