From 3250144b945bb391270679b4b2e99e66c19c6dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Sat, 28 Sep 2013 15:33:51 +0200 Subject: [PATCH] wIconChangeImageFile find image if block swapped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch swaps the "if (path)" block to "if (!path)" therefore, the true block is now "error = 1" and the false block is the call to get_rimage_from_file function. The second change is that the "error = 1" statement is changed to "return 0", because if "error" is "1", then only the "return !error" statement is used, then we can change it for "return !1" that is "return 0". Then, we can move the get_rimage_from_file call out of the if block. Signed-off-by: Rodolfo García Peñas (kix) --- src/icon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/icon.c b/src/icon.c index c3ab64ad..c30aeb44 100644 --- a/src/icon.c +++ b/src/icon.c @@ -364,10 +364,10 @@ int wIconChangeImageFile(WIcon *icon, const char *file) /* 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; + if (!path) + return 0; + + image = get_rimage_from_file(scr, path, wPreferences.icon_size); /* New image! */ if (!error && image) {