diff mbox series

libiberty: d-demangle: remove parenthesis where it is not needed

Message ID 20210929162621.473786-1-contact@lsferreira.net
State New
Headers show
Series libiberty: d-demangle: remove parenthesis where it is not needed | expand

Commit Message

Luís Ferreira Sept. 29, 2021, 4:26 p.m. UTC
Those parenthesis doesn't increase readability at all and this patch makes the
source code a bit more consistent with the rest of the dereferencing
assignments.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
---
 libiberty/d-demangle.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Bill Schmidt via Gcc-patches Oct. 4, 2021, 7:33 a.m. UTC | #1
> On 29/09/2021 18:26 Luís Ferreira <contact@lsferreira.net> wrote:
> 
>  
> Those parenthesis doesn't increase readability at all and this patch makes the
> source code a bit more consistent with the rest of the dereferencing
> assignments.
> 

OK, but can you write up a changelog entry for it?

Thanks,
Iain.
Andreas Schwab Oct. 4, 2021, 8:40 a.m. UTC | #2
On Sep 29 2021, Luís Ferreira wrote:

> diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
> index 3adf7b562d1..a05e72d8efe 100644
> --- a/libiberty/d-demangle.c
> +++ b/libiberty/d-demangle.c
> @@ -253,15 +253,15 @@ dlang_hexdigit (const char *mangled, char *ret)
>  
>    c = mangled[0];
>    if (!ISDIGIT (c))
> -    (*ret) = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
> +    *ret = (c - (ISUPPER (c) ? 'A' : 'a') + 10);

The outer pair of parens around rhs is also redundant.

Andreas.
Luís Ferreira Oct. 12, 2021, 2:07 p.m. UTC | #3
On Mon, 2021-10-04 at 10:40 +0200, Andreas Schwab wrote:
> On Sep 29 2021, Luís Ferreira wrote:
> 
> > diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
> > index 3adf7b562d1..a05e72d8efe 100644
> > --- a/libiberty/d-demangle.c
> > +++ b/libiberty/d-demangle.c
> > @@ -253,15 +253,15 @@ dlang_hexdigit (const char *mangled, char
> > *ret)
> >  
> >    c = mangled[0];
> >    if (!ISDIGIT (c))
> > -    (*ret) = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
> > +    *ret = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
> 
> The outer pair of parens around rhs is also redundant.
> 
> Andreas.
> 

Resent the patch with the requested change.
Luís Ferreira Oct. 12, 2021, 2:10 p.m. UTC | #4
On Mon, 2021-10-04 at 09:33 +0200, ibuclaw@gdcproject.org wrote:
> > On 29/09/2021 18:26 Luís Ferreira <contact@lsferreira.net> wrote:
> > 
> >  
> > Those parenthesis doesn't increase readability at all and this
> > patch makes the
> > source code a bit more consistent with the rest of the
> > dereferencing
> > assignments.
> > 
> 
> OK, but can you write up a changelog entry for it?
> 
> Thanks,
> Iain.

Added on a PATCH v2.
diff mbox series

Patch

diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index 3adf7b562d1..a05e72d8efe 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -253,15 +253,15 @@  dlang_hexdigit (const char *mangled, char *ret)
 
   c = mangled[0];
   if (!ISDIGIT (c))
-    (*ret) = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
+    *ret = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
   else
-    (*ret) = (c - '0');
+    *ret = c - '0';
 
   c = mangled[1];
   if (!ISDIGIT (c))
-    (*ret) = (*ret << 4) | (c - (ISUPPER (c) ? 'A' : 'a') + 10);
+    *ret = (*ret << 4) | (c - (ISUPPER (c) ? 'A' : 'a') + 10);
   else
-    (*ret) = (*ret << 4) | (c - '0');
+    *ret = (*ret << 4) | (c - '0');
 
   mangled += 2;
 
@@ -338,7 +338,7 @@  dlang_decode_backref (const char *mangled, long *ret)
 static const char *
 dlang_backref (const char *mangled, const char **ret, struct dlang_info *info)
 {
-  (*ret) = NULL;
+  *ret = NULL;
 
   if (mangled == NULL || *mangled != 'Q')
     return NULL;
@@ -356,7 +356,7 @@  dlang_backref (const char *mangled, const char **ret, struct dlang_info *info)
     return NULL;
 
   /* Set the position of the back reference.  */
-  (*ret) = qpos - refpos;
+  *ret = qpos - refpos;
 
   return mangled;
 }