On Sat, 03 Nov 2012, Carlos R. Mafra escribió:

> On Sat,  3 Nov 2012 at 19:53:55 +0100, Rodolfo García Peñas (kix) wrote:
> > From: "Rodolfo García Peñas (kix)" <[email protected]>
> > 
> > The flag (declared as int, not Bool) "error" was negated in the return
> > sentences because is set to 1 when error. Is better set a positive flag,
> > like "ok_flag" (declared as Boolean, like the function returned value)
> > and set to False when error is found. The the function can return the
> > flag without negate it.
> > ---
> >  src/icon.c |   12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/src/icon.c b/src/icon.c
> > index fce0a51..5fe444f 100644
> > --- a/src/icon.c
> > +++ b/src/icon.c
> > @@ -371,21 +371,21 @@ Bool wIconChangeImageFile(WIcon *icon, char *file)
> >     WScreen *scr = icon->core->screen_ptr;
> >     char *path;
> >     RImage *image = NULL;
> > -   int error = 0;
> > +   Bool ok_flag = True;
> >  
> >     /* If no new image, don't do nothing */
> >     if (!file)
> > -           return True;
> > +           return ok_flag;
> >  
> >     /* Find the new image */
> >     path = FindImage(wPreferences.icon_path, file);
> >     if (path)
> >             image = get_rimage_from_file(scr, path, wPreferences.icon_size);
> >     else
> > -           error = 1;
> > +           ok_flag = False;
> >  
> >     /* New image! */
> > -   if (!error && image) {
> > +   if (ok_flag && image) {
> >             /* Remove the old one */
> >             unset_icon_image(icon);
> >  
> > @@ -394,13 +394,13 @@ Bool wIconChangeImageFile(WIcon *icon, char *file)
> >             icon->file = wstrdup(path);
> >             wIconUpdate(icon);
> >     } else {
> > -           error = 1;
> > +           ok_flag = False;
> >     }
> >  
> >     if (path)
> >             wfree(path);
> >  
> > -   return !error;
> > +   return ok_flag;
> >  }
> >  
> >  static char *get_name_for_wwin(WWindow *wwin)
> 
> I forgot to tell you before, but I didn't take this patch on your last
> series because there's something I don't like about it.

Ah! ok, I didn't understand whats happend with this patch (if I sent it or not).
No problem.
 
> 'error' is much more direct to understand than 'ok_flag'. I've never
> seen this convention before (ok_flag), it's strange.

Ok, is a cosmetic patch. No problem.

kix
-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


-- 
To unsubscribe, send mail to [email protected].

Reply via email to