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

From: Quentin Rameau <quinq_AT_fifth.space>
Date: Mon, 22 Aug 2016 18:55:40 +0200

> From 5a2a3fb9d193ee5d4ce14d54a38261c0f2cc4b9e Mon Sep 17 00:00:00 2001
> From: FRIGN <dev_AT_frign.de>

Hi FRIGN,

I agree with Markus remarks and I have a few more myself:

> + ARGBEGIN {
> + case 'v':
> + fprintf(stderr, "slock-"VERSION"\n");

Do we really need that?

> - XSync(dpy, False);
> + XSync(dpy, 0);

Xlib provides and use a boolean type for its functions, I think we
should stick to that.

> + /* did we actually manage to lock anything? */
> + if (nlocks == 0) {
> + /* nothing to protect */
> free(locks);
                ^----- Is it necessary?
> XCloseDisplay(dpy);
> return 1;
> }

> + if (argc > 0) {
> + switch (fork()) {
> + case -1:
> + free(locks);
Same remark. -----^
> + XCloseDisplay(dpy);
> + die("slock: fork failed: %s\n", strerror(errno));

> + for (s = 0; s < nscreens; s++)
> + unlockscreen(dpy, locks[s]);
>
> free(locks);
        ^----- Same remark.
> XCloseDisplay(dpy);

Thanks!
Received on Mon Aug 22 2016 - 18:55:40 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 22 2016 - 19:00:17 CEST