1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-22 14:08:06 +01:00

wmaker: took as much assignation as possible outside 'if' statements

It is generally considered bad practice to place an assignation inside the
expression for an "if" statement because it is often a source of bug,
because of possible typos and because it makes reviewing code more
complicated.

This patch fixes as much cases as possible to make the code easier to read.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2015-05-08 13:19:04 +02:00
committed by Carlos R. Mafra
parent e14fad1162
commit 1c1909d5fe
12 changed files with 88 additions and 47 deletions

View File

@@ -38,7 +38,8 @@ Bool GetCommandForPid(int pid, char ***argv, int *argc)
while (1) {
/* not switching this to stdio yet, as this does not need
* to be portable, and i'm lazy */
if ((fd = open(buf, O_RDONLY)) != -1)
fd = open(buf, O_RDONLY);
if (fd != -1)
break;
if (errno == EINTR)
continue;
@@ -46,7 +47,8 @@ Bool GetCommandForPid(int pid, char ***argv, int *argc)
}
while (1) {
if ((count = read(fd, buf, sizeof(buf))) != -1)
count = read(fd, buf, sizeof(buf));
if (count != -1)
break;
if (errno == EINTR)
continue;