>From b13fb87c2dd02d1444566997a04a967d2bf91615 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Wed, 6 Jun 2012 12:25:58 +0200
Subject: [PATCH 06/10] Remove code duplication by calling
 get_name_for_instance_class()

The code in application.c to create the icon name is
included in icon.c (function get_name_for_instance_class).
---
 src/application.c |   19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/src/application.c b/src/application.c
index c50f3e4..ca47203 100644
--- a/src/application.c
+++ b/src/application.c
@@ -114,25 +114,8 @@ void wApplicationSaveIconPathFor(char *iconPath, char 
*wm_instance, char *wm_cla
        WMPropList *adict, *key, *iconk;
        WMPropList *val;
        char *tmp;
-       int i;
-
-       i = 0;
-       if (wm_instance)
-               i += strlen(wm_instance);
-       if (wm_class)
-               i += strlen(wm_class);
-
-       tmp = wmalloc(i + 8);
-       *tmp = 0;
-       if (wm_class && wm_instance) {
-               sprintf(tmp, "%s.%s", wm_instance, wm_class);
-       } else {
-               if (wm_instance)
-                       strcat(tmp, wm_instance);
-               if (wm_class)
-                       strcat(tmp, wm_class);
-       }
 
+       tmp = get_name_for_instance_class(wm_instance, wm_class);
        key = WMCreatePLString(tmp);
        wfree(tmp);
 
-- 
1.7.10

-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From b13fb87c2dd02d1444566997a04a967d2bf91615 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Wed, 6 Jun 2012 12:25:58 +0200
Subject: [PATCH 06/10] Remove code duplication by calling
 get_name_for_instance_class()

The code in application.c to create the icon name is
included in icon.c (function get_name_for_instance_class).
---
 src/application.c |   19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/src/application.c b/src/application.c
index c50f3e4..ca47203 100644
--- a/src/application.c
+++ b/src/application.c
@@ -114,25 +114,8 @@ void wApplicationSaveIconPathFor(char *iconPath, char *wm_instance, char *wm_cla
 	WMPropList *adict, *key, *iconk;
 	WMPropList *val;
 	char *tmp;
-	int i;
-
-	i = 0;
-	if (wm_instance)
-		i += strlen(wm_instance);
-	if (wm_class)
-		i += strlen(wm_class);
-
-	tmp = wmalloc(i + 8);
-	*tmp = 0;
-	if (wm_class && wm_instance) {
-		sprintf(tmp, "%s.%s", wm_instance, wm_class);
-	} else {
-		if (wm_instance)
-			strcat(tmp, wm_instance);
-		if (wm_class)
-			strcat(tmp, wm_class);
-	}
 
+	tmp = get_name_for_instance_class(wm_instance, wm_class);
 	key = WMCreatePLString(tmp);
 	wfree(tmp);
 
-- 
1.7.10

Reply via email to