Re: [hackers] Repeated usage of m->lt[m->sellt]->arrange deduplication

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Mon, 24 Apr 2017 10:01:31 +0200

On 23 April 2017 at 20:14, Hiltjo Posthuma <hiltjo_AT_codemadness.org> wrote:
> On Sun, Apr 23, 2017 at 11:54:31PM +1000, Daniel Cousens wrote:
>> I have found this pattern to take up significant parts of my time when
>> rebasing my changes onto suckless/master, Â such that I feel the
>> following patch will both increase readability, Â reduce diffs and
>> overall increase code quality :).
>> Thoughts?
>
>> From 160dbe6eaa8fccc1eb5c9cde036b9256c2e820c5 Mon Sep 17 00:00:00 2001
>> From: Daniel Cousens <github_AT_dcousens.com>
>> Date: Sun, 23 Apr 2017 18:46:47 +1000
>> Subject: [PATCH] use canarrange over sellmon->sellt repeated pattern
>>
>> ---
>> dwm.c | 28 ++++++++++++++++------------
>> 1 file changed, 16 insertions(+), 12 deletions(-)
>>
>> diff --git a/dwm.c b/dwm.c
>> index 7861512..fdea9e2 100644
>> --- a/dwm.c
>> +++ b/dwm.c
>> _AT_@ -235,6 +235,10 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee);
>> static int xerrorstart(Display *dpy, XErrorEvent *ee);
>> static void zoom(const Arg *arg);
>>
>> +int canarrange (Monitor* m) {
>> + return m->lt[m->sellt]->arrange != NULL;
>> +}
>> +

I'd prefer a define instead of a one-line function.

-Anselm
Received on Mon Apr 24 2017 - 10:01:31 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 24 2017 - 10:12:15 CEST