On Tue, 02 Oct 2012, Carlos R. Mafra escribió:

> On Tue,  2 Oct 2012 at 23:45:45 +0200, Rodolfo García Peñas wrote:
> > 
> > This patch reviews the code style in framewin.c, removing some
> > curly brackets not needed.
> > 
> > This patch removes some lines commented and join two "if's" in one.
> 
> >  
> > -   if (wPreferences.new_style == TS_NEW) {
> > -           if (!fwin->flags.hide_right_button && fwin->right_button && 
> > !fwin->flags.rbutton_dont_fit) {
> > -                   w -= fwin->right_button->width;
> > -           }
> > -   }
> > +   if ((wPreferences.new_style == TS_NEW) &&
> > +       (!fwin->flags.hide_right_button &&
> > +        fwin->right_button &&
> > +        !fwin->flags.rbutton_dont_fit))
> > +           w -= fwin->right_button->width;
> 
> 
> I prefer the old version, it reads better and the "intention" of the
> code is clearer. Furthermore, the statement w -= ... stands out
> in the old version, whereas in this patch it kind of mixes with the
> many conditionals in the if.
> 
> I'm probably going to apply it in order to avoid too much trouble
> for you. But please don't simply join ifs together just because
> it's mathematically equivalent. The intentions are important.

Ok, no problem. Both are correct, but probably you are right.

Attached is the patch to revert this change.

Thanks a lot for your review.

kix
-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From c1dad83619e7300ef1c57a915271f5dcd5d0f3f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Wed, 3 Oct 2012 00:56:28 +0200
Subject: [PATCH] framewin.c code style if block revert

This code revert the if blocks joined in the commit
"framewin.c code style", because the original version reads better.
---
 src/framewin.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/framewin.c b/src/framewin.c
index b1ca486..b30c5c6 100644
--- a/src/framewin.c
+++ b/src/framewin.c
@@ -578,11 +578,10 @@ static void updateTitlebar(WFrameWindow * fwin)
 	}
 #endif
 
-	if ((wPreferences.new_style == TS_NEW) &&
-	    (!fwin->flags.hide_right_button &&
-	     fwin->right_button &&
-	     !fwin->flags.rbutton_dont_fit))
-		w -= fwin->right_button->width;
+	if (wPreferences.new_style == TS_NEW) {
+		if (!fwin->flags.hide_right_button && fwin->right_button && !fwin->flags.rbutton_dont_fit)
+			w -= fwin->right_button->width;
+	}
 
 	if (wPreferences.new_style == TS_NEW || fwin->titlebar->width != w)
 		fwin->flags.need_texture_remake = 1;
-- 
1.7.10.4

Reply via email to