bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH 2/5] ddb/db_sym.c: move assignment outside if


From: Marin Ramesa
Subject: Re: [PATCH 2/5] ddb/db_sym.c: move assignment outside if
Date: Fri, 22 Nov 2013 19:36:02 +0100

On 22.11.2013 19:21:32, Guillem Jover wrote:
> On Thu, 2013-11-21 at 13:11:05 +0100, Marin Ramesa wrote:
> > diff --git a/ddb/db_sym.c b/ddb/db_sym.c
> > index 0819e08..359ec7c 100644
> > --- a/ddb/db_sym.c
> > +++ b/ddb/db_sym.c
> > @@ -276,7 +276,9 @@ db_name_is_ambiguous(sym_name)
> >  
> >     for (i = 0; i < db_nsymtab; i++) {
> >             db_sym_t sp;
> > -           if (sp = X_db_lookup(&db_symtabs[i], sym_name)) {
> > +           boolean_t db_lookup;
> > +           db_lookup = (int)(sp = X_db_lookup(&db_symtabs[i],
> > sym_name));
> > +           if (db_lookup) {
> >                     if (found_once)
> >                     {
> >                             db_free_symbol(sp);
> 
> Regarding readability, this does not seem to me like a big 
> improvement (bar the squashed warning :). 

I liked it better when it was inside parantheses in the if statement.

> Why not assign sp on its own? 

How to then check the truth value of the assignment?

> And does the db_sym_t type require a cast for the conditional?

Yes, otherwise there is a warning from GCC.


reply via email to

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