From: "Rodolfo García Peñas (kix)" <[email protected]>

The False return part of the if is moved up, then the lines at the
True block are shorter.

This patch also add some curly brackets.
---
 src/misc.c |   29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/misc.c b/src/misc.c
index 9922ea2..13170ea 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -94,22 +94,25 @@ Bool wGetIconName(Display *dpy, Window win, char **iconname)
        char **list;
        int num;
 
-       if (XGetWMIconName(dpy, win, &text_prop) != 0 && text_prop.value && 
text_prop.nitems > 0) {
-               if (text_prop.encoding == XA_STRING)
+       if ((XGetWMIconName(dpy, win, &text_prop) == 0) || (text_prop.value && 
text_prop.nitems <= 0)) {
+               *iconname = NULL;
+               return False;
+       }
+
+       if (text_prop.encoding == XA_STRING) {
+               *iconname = (char *)text_prop.value;
+       } else {
+               text_prop.nitems = strlen((char *)text_prop.value);
+               if (XmbTextPropertyToTextList(dpy, &text_prop, &list, &num) >= 
Success && num > 0 && *list) {
+                       XFree(text_prop.value);
+                       *iconname = wstrdup(*list);
+                       XFreeStringList(list);
+               } else {
                        *iconname = (char *)text_prop.value;
-               else {
-                       text_prop.nitems = strlen((char *)text_prop.value);
-                       if (XmbTextPropertyToTextList(dpy, &text_prop, &list, 
&num) >= Success && num > 0 && *list) {
-                               XFree(text_prop.value);
-                               *iconname = wstrdup(*list);
-                               XFreeStringList(list);
-                       } else
-                               *iconname = (char *)text_prop.value;
                }
-               return True;
        }
-       *iconname = NULL;
-       return False;
+
+       return True;
 }
 
 static void eatExpose(void)
-- 
1.7.10.4


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

Reply via email to