>From 8aff96cbf6d76e87202a96ade884c10cd21e839b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Tue, 2 Oct 2012 23:19:26 +0200
Subject: [PATCH 3/9] Removed block in restore_icon_state

The block inside restore_icon_state is not needed, so can be removed.

There are no changes with or without the block (variables scope,...).
---
 src/dock.c |   49 ++++++++++++++++++++++---------------------------
 1 file changed, 22 insertions(+), 27 deletions(-)

diff --git a/src/dock.c b/src/dock.c
index 26d348a..c90ae93 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -1343,6 +1343,7 @@ static WAppIcon *restore_icon_state(WScreen *scr, 
WMPropList *info, int type, in
 {
        WAppIcon *aicon;
        WMPropList *cmd, *value;
+       char *wclass, *winstance, *command;
 
        cmd = WMGetFromPLDictionary(info, dCommand);
        if (!cmd || !WMIsPLString(cmd))
@@ -1353,42 +1354,36 @@ static WAppIcon *restore_icon_state(WScreen *scr, 
WMPropList *info, int type, in
        if (!value)
                return NULL;
 
-       {
-               char *wclass, *winstance;
-               char *command;
-
-               ParseWindowName(value, &winstance, &wclass, "dock");
-
-               if (!winstance && !wclass)
-                       return NULL;
-
-               /* get commands */
+       ParseWindowName(value, &winstance, &wclass, "dock");
 
-               if (cmd)
-                       command = wstrdup(WMGetFromPLString(cmd));
-               else
-                       command = NULL;
-
-               if (!command || strcmp(command, "-") == 0) {
-                       if (command)
-                               wfree(command);
-                       if (wclass)
-                               wfree(wclass);
-                       if (winstance)
-                               wfree(winstance);
+       if (!winstance && !wclass)
+               return NULL;
 
-                       return NULL;
-               }
+       /* get commands */
+       if (cmd)
+               command = wstrdup(WMGetFromPLString(cmd));
+       else
+               command = NULL;
 
-               aicon = wAppIconCreateForDock(scr, command, winstance, wclass, 
TILE_NORMAL);
+       if (!command || strcmp(command, "-") == 0) {
+               if (command)
+                       wfree(command);
                if (wclass)
                        wfree(wclass);
                if (winstance)
                        wfree(winstance);
-               if (command)
-                       wfree(command);
+
+               return NULL;
        }
 
+       aicon = wAppIconCreateForDock(scr, command, winstance, wclass, 
TILE_NORMAL);
+       if (wclass)
+               wfree(wclass);
+       if (winstance)
+               wfree(winstance);
+       if (command)
+               wfree(command);
+
        aicon->icon->core->descriptor.handle_mousedown = iconMouseDown;
        if (type == WM_CLIP) {
                aicon->icon->core->descriptor.handle_enternotify = 
clipEnterNotify;
-- 
1.7.10.4

-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From 8aff96cbf6d76e87202a96ade884c10cd21e839b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Tue, 2 Oct 2012 23:19:26 +0200
Subject: [PATCH 3/9] Removed block in restore_icon_state

The block inside restore_icon_state is not needed, so can be removed.

There are no changes with or without the block (variables scope,...).
---
 src/dock.c |   49 ++++++++++++++++++++++---------------------------
 1 file changed, 22 insertions(+), 27 deletions(-)

diff --git a/src/dock.c b/src/dock.c
index 26d348a..c90ae93 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -1343,6 +1343,7 @@ static WAppIcon *restore_icon_state(WScreen *scr, WMPropList *info, int type, in
 {
 	WAppIcon *aicon;
 	WMPropList *cmd, *value;
+	char *wclass, *winstance, *command;
 
 	cmd = WMGetFromPLDictionary(info, dCommand);
 	if (!cmd || !WMIsPLString(cmd))
@@ -1353,42 +1354,36 @@ static WAppIcon *restore_icon_state(WScreen *scr, WMPropList *info, int type, in
 	if (!value)
 		return NULL;
 
-	{
-		char *wclass, *winstance;
-		char *command;
-
-		ParseWindowName(value, &winstance, &wclass, "dock");
-
-		if (!winstance && !wclass)
-			return NULL;
-
-		/* get commands */
+	ParseWindowName(value, &winstance, &wclass, "dock");
 
-		if (cmd)
-			command = wstrdup(WMGetFromPLString(cmd));
-		else
-			command = NULL;
-
-		if (!command || strcmp(command, "-") == 0) {
-			if (command)
-				wfree(command);
-			if (wclass)
-				wfree(wclass);
-			if (winstance)
-				wfree(winstance);
+	if (!winstance && !wclass)
+		return NULL;
 
-			return NULL;
-		}
+	/* get commands */
+	if (cmd)
+		command = wstrdup(WMGetFromPLString(cmd));
+	else
+		command = NULL;
 
-		aicon = wAppIconCreateForDock(scr, command, winstance, wclass, TILE_NORMAL);
+	if (!command || strcmp(command, "-") == 0) {
+		if (command)
+			wfree(command);
 		if (wclass)
 			wfree(wclass);
 		if (winstance)
 			wfree(winstance);
-		if (command)
-			wfree(command);
+
+		return NULL;
 	}
 
+	aicon = wAppIconCreateForDock(scr, command, winstance, wclass, TILE_NORMAL);
+	if (wclass)
+		wfree(wclass);
+	if (winstance)
+		wfree(winstance);
+	if (command)
+		wfree(command);
+
 	aicon->icon->core->descriptor.handle_mousedown = iconMouseDown;
 	if (type == WM_CLIP) {
 		aicon->icon->core->descriptor.handle_enternotify = clipEnterNotify;
-- 
1.7.10.4

Reply via email to