mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-25 16:02:33 +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:
committed by
Carlos R. Mafra
parent
e14fad1162
commit
1c1909d5fe
@@ -102,17 +102,20 @@ Bool GetCommandForPid(int pid, char ***argv, int *argc)
|
||||
|
||||
#if defined( OPENBSD )
|
||||
/* kvm descriptor */
|
||||
if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, kvmerr)) == NULL)
|
||||
kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, kvmerr);
|
||||
if (kd == NULL)
|
||||
return False;
|
||||
|
||||
procs = 0;
|
||||
/* the process we are interested in */
|
||||
if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, sizeof(*kp), &procs)) == NULL || procs == 0)
|
||||
kp = kvm_getprocs(kd, KERN_PROC_PID, pid, sizeof(*kp), &procs);
|
||||
if (kp == NULL || procs == 0)
|
||||
/* if kvm_getprocs() bombs out or does not find the process */
|
||||
return False;
|
||||
|
||||
/* get its argv */
|
||||
if ((nargv = kvm_getargv(kd, kp, 0)) == NULL)
|
||||
nargv = kvm_getargv(kd, kp, 0);
|
||||
if (nargv == NULL)
|
||||
return False;
|
||||
|
||||
/* flatten nargv into args */
|
||||
|
||||
Reference in New Issue
Block a user