Re: [hackers] [slock] [PATCH] Refactor main()

From: Markus Teich <markus.teich_AT_stusta.mhn.de>
Date: Mon, 22 Aug 2016 16:28:03 +0200

Heyho,

FRIGN wrote:
> ah, that might have slipped past. I generally code according to the
> suckless.org coding styles[0], and given there was no reference on how
> the project specific block looks like, I did it that way.
> For one-line if-statements it makes sense to keep the braces away, but
> big if-else-blocks benefit from braces in my opinion.

Well, I'd do it like that:

        if (bla) {
                if (blub)
                        lol;
                else
                        rofl;
        }

If you understand the "single statement" applicable tho the `if (blub) lol; else
rofl;` statement, you could also leave out the outer braces, but I think that
makes it too error-prone especially if someone with recent python coding patches
this section.

> > Why do we need that level of inderection? We can just include arg.h from
> > slock.c directly.
>
> Yes we could. I can change this, but was a bit irritated that util.h is so
> empty.

I think renaming util.h to something like bzero.h and putting the arg.h include
in slock.c would be good, so this header does not get confused with the usual
util.h from libsl using projects.

--Markus
Received on Mon Aug 22 2016 - 16:28:03 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 22 2016 - 16:36:14 CEST