libiberty: d-demangle: remove parenthesis where it is not needed
Commit Message
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
> 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.
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.
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.
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.
@@ -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;
}