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)
-- 
1.7.10.4


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

Reply via email to