bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] removing useless parentheses in cpp #define directives


From: Jim Meyering
Subject: [PATCH] removing useless parentheses in cpp #define directives
Date: Tue, 02 Feb 2010 08:01:59 +0100

FYI, continuing the clean-up, I ran this:

  git grep -E 'define.*\(\([^)]+\),'

and fixed some of the culprits in the patch below.
The following remain (from glibc), and I'll leave them as-is:

    lib/regex_internal.h:#  define internal_function   __attribute ((regparm 
(3), stdcall))
    lib/strsignal.c:# define __libc_once(NAME, INIT) gl_once ((NAME), (INIT))
    lib/strsignal.c:# define __libc_setspecific(NAME, POINTER) gl_tls_set 
((NAME), (POINTER))
    lib/strtol.c:#  define ISSPACE(Ch) __iswspace_l ((Ch), loc)
    lib/strtol.c:#  define ISALPHA(Ch) __iswalpha_l ((Ch), loc)
    lib/strtol.c:#  define TOUPPER(Ch) __towupper_l ((Ch), loc)
    lib/strtol.c:#  define ISSPACE(Ch) __isspace_l ((Ch), loc)
    lib/strtol.c:#  define ISALPHA(Ch) __isalpha_l ((Ch), loc)
    lib/strtol.c:#  define TOUPPER(Ch) __toupper_l ((Ch), loc)

>From 67e58686c25ce341565a000d91073920488f618f Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 1 Feb 2010 19:05:26 +0100
Subject: [PATCH] removing useless parentheses in cpp #define directives

For motivation, see commit c0221df4, "define STREQ(a,b)
consistently, removing useless parentheses"
* lib/memcmp.c (CMP_LT_OR_GT): Remove useless parentheses.
* lib/mountlist.c (MNT_IGNORE): Likewise.
* lib/trim.h (trim, trim_trailing, trim_leading): Likewise.
---
 ChangeLog       |    9 +++++++++
 lib/memcmp.c    |    2 +-
 lib/mountlist.c |    2 +-
 lib/trim.h      |    7 +++----
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3843078..eaf566e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-02-01  Jim Meyering  <address@hidden>
+
+       removing useless parentheses in cpp #define directives
+       For motivation, see commit c0221df4, "define STREQ(a,b)
+       consistently, removing useless parentheses"
+       * lib/memcmp.c (CMP_LT_OR_GT): Remove useless parentheses.
+       * lib/mountlist.c (MNT_IGNORE): Likewise.
+       * lib/trim.h (trim, trim_trailing, trim_leading): Likewise.
+
 2010-01-28  Eric Blake  <address@hidden>

        regex: fix build failure
diff --git a/lib/memcmp.c b/lib/memcmp.c
index 847867a..0c7ce5e 100644
--- a/lib/memcmp.c
+++ b/lib/memcmp.c
@@ -65,7 +65,7 @@ typedef unsigned char byte;
 #ifdef WORDS_BIGENDIAN
 # define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1)
 #else
-# define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b))
+# define CMP_LT_OR_GT(a, b) memcmp_bytes (a, b)
 #endif

 /* BE VERY CAREFUL IF YOU CHANGE THIS CODE!  */
diff --git a/lib/mountlist.c b/lib/mountlist.c
index ccb08dd..996b71a 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -125,7 +125,7 @@

 #undef MNT_IGNORE
 #if defined MNTOPT_IGNORE && defined HAVE_HASMNTOPT
-# define MNT_IGNORE(M) hasmntopt ((M), MNTOPT_IGNORE)
+# define MNT_IGNORE(M) hasmntopt (M, MNTOPT_IGNORE)
 #else
 # define MNT_IGNORE(M) 0
 #endif
diff --git a/lib/trim.h b/lib/trim.h
index 61880c1..c70a16f 100644
--- a/lib/trim.h
+++ b/lib/trim.h
@@ -22,13 +22,12 @@
 #define TRIM_BOTH 2

 /* Removes trailing and leading whitespaces. */
-#define trim(s) trim2((s), TRIM_BOTH)
+#define trim(s) trim2(s, TRIM_BOTH)

 /* Removes trailing whitespaces. */
-#define trim_trailing(s) trim2((s), TRIM_TRAILING)
+#define trim_trailing(s) trim2(s, TRIM_TRAILING)

 /* Removes leading whitespaces. */
-#define trim_leading(s) trim2((s), TRIM_LEADING)
+#define trim_leading(s) trim2(s, TRIM_LEADING)

 char *trim2(const char *, int);
-
--
1.7.0.rc1.149.g0b0b7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]