summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-10-31 20:52:20 +0100
committerBenny Baumann <BenBE@geshi.org>2020-11-02 22:14:59 +0100
commit374edb9ed5e9d5fa24cfe358258d82f69d9d430d (patch)
treec03a9a6e7ebc9e49180bbb22b5555c02819e47b0
parent0a51eae11fdd741c295d7b0390c6d9dbf04468d8 (diff)
Spacing after keywords (if)
-rw-r--r--CRT.c4
-rw-r--r--Process.c2
-rw-r--r--TraceScreen.c4
-rw-r--r--Vector.c4
-rw-r--r--darwin/Battery.c10
-rw-r--r--darwin/DarwinProcess.c6
-rw-r--r--darwin/DarwinProcessList.c10
-rw-r--r--darwin/Platform.c2
-rw-r--r--dragonflybsd/DragonFlyBSDProcessList.c4
-rw-r--r--freebsd/FreeBSDProcessList.c4
-rw-r--r--htop.c6
-rw-r--r--linux/LinuxProcess.c6
-rw-r--r--linux/LinuxProcessList.c32
-rw-r--r--linux/Platform.c2
-rw-r--r--linux/ZramMeter.c6
-rw-r--r--solaris/SolarisProcessList.c2
16 files changed, 52 insertions, 52 deletions
diff --git a/CRT.c b/CRT.c
index a13f531a..d91d0d79 100644
--- a/CRT.c
+++ b/CRT.c
@@ -770,7 +770,7 @@ void CRT_handleSIGSEGV(int signal) {
);
const char* signal_str = strsignal(signal);
- if(!signal_str) {
+ if (!signal_str) {
signal_str = "unknown reason";
}
fprintf(stderr,
@@ -821,7 +821,7 @@ void CRT_handleSIGSEGV(int signal) {
);
/* Call old sigsegv handler; may be default exit or third party one (e.g. ASAN) */
- if(sigaction (signal, &old_sig_handler[signal], NULL) < 0) {
+ if (sigaction (signal, &old_sig_handler[signal], NULL) < 0) {
/* This avoids an infinite loop in case the handler could not be reset. */
fprintf(stderr,
"!!! Chained handler could not be restored. Forcing exit.\n"
diff --git a/Process.c b/Process.c
index 842232f7..bbc85ce1 100644
--- a/Process.c
+++ b/Process.c
@@ -325,7 +325,7 @@ void Process_writeField(const Process* this, RichString* str, ProcessField field
case PID: xSnprintf(buffer, n, Process_pidFormat, this->pid); break;
case PPID: xSnprintf(buffer, n, Process_pidFormat, this->ppid); break;
case PRIORITY: {
- if(this->priority <= -100)
+ if (this->priority <= -100)
xSnprintf(buffer, n, " RT ");
else
xSnprintf(buffer, n, "%3ld ", this->priority);
diff --git a/TraceScreen.c b/TraceScreen.c
index e83e8a51..18dad58c 100644
--- a/TraceScreen.c
+++ b/TraceScreen.c
@@ -81,10 +81,10 @@ bool TraceScreen_forkTracer(TraceScreen* this) {
if (pipe(fdpair) == -1)
return false;
- if(fcntl(fdpair[0], F_SETFL, O_NONBLOCK) < 0)
+ if (fcntl(fdpair[0], F_SETFL, O_NONBLOCK) < 0)
goto err;
- if(fcntl(fdpair[1], F_SETFL, O_NONBLOCK) < 0)
+ if (fcntl(fdpair[1], F_SETFL, O_NONBLOCK) < 0)
goto err;
pid_t child = fork();
diff --git a/Vector.c b/Vector.c
index 63b64723..ea276671 100644
--- a/Vector.c
+++ b/Vector.c
@@ -201,7 +201,7 @@ void Vector_insert(Vector* this, int idx, void* data_) {
Vector_checkArraySize(this);
//assert(this->array[this->items] == NULL);
- if(idx < this->items) {
+ if (idx < this->items) {
memmove(&this->array[idx + 1], &this->array[idx], (this->items - idx) * sizeof(this->array[0]));
}
this->array[idx] = data;
@@ -215,7 +215,7 @@ Object* Vector_take(Vector* this, int idx) {
Object* removed = this->array[idx];
assert(removed);
this->items--;
- if(idx < this->items) {
+ if (idx < this->items) {
memmove(&this->array[idx], &this->array[idx + 1], (this->items - idx) * sizeof(this->array[0]));
}
//this->array[this->items] = NULL;
diff --git a/darwin/Battery.c b/darwin/Battery.c
index d82d0ffd..df644643 100644
--- a/darwin/Battery.c
+++ b/darwin/Battery.c
@@ -13,7 +13,7 @@ void Battery_getData(double* level, ACPresence* isOnAC) {
*level = NAN;
*isOnAC = AC_ERROR;
- if(NULL == power_sources) {
+ if (NULL == power_sources) {
return;
}
@@ -21,7 +21,7 @@ void Battery_getData(double* level, ACPresence* isOnAC) {
CFDictionaryRef battery = NULL;
int len;
- if(NULL == list) {
+ if (NULL == list) {
CFRelease(power_sources);
return;
@@ -35,18 +35,18 @@ void Battery_getData(double* level, ACPresence* isOnAC) {
CFArrayGetValueAtIndex(list, i)); /* GET rule */
CFStringRef type;
- if(NULL != candidate) {
+ if (NULL != candidate) {
type = (CFStringRef) CFDictionaryGetValue(candidate,
CFSTR(kIOPSTransportTypeKey)); /* GET rule */
- if(kCFCompareEqualTo == CFStringCompare(type, CFSTR(kIOPSInternalType), 0)) {
+ if (kCFCompareEqualTo == CFStringCompare(type, CFSTR(kIOPSInternalType), 0)) {
CFRetain(candidate);
battery = candidate;
}
}
}
- if(NULL != battery) {
+ if (NULL != battery) {
/* Determine the AC state */
CFStringRef power_state = CFDictionaryGetValue(battery, CFSTR(kIOPSPowerSourceStateKey));
diff --git a/darwin/DarwinProcess.c b/darwin/DarwinProcess.c
index 73214836..8ad7a6d8 100644
--- a/darwin/DarwinProcess.c
+++ b/darwin/DarwinProcess.c
@@ -212,7 +212,7 @@ void DarwinProcess_setFromKInfoProc(Process *proc, struct kinfo_proc *ps, bool e
*/
/* First, the "immutable" parts */
- if(!exists) {
+ if (!exists) {
/* Set the PID/PGID/etc. */
proc->pid = ep->p_pid;
proc->ppid = ps->kp_eproc.e_ppid;
@@ -244,8 +244,8 @@ void DarwinProcess_setFromKInfoProc(Process *proc, struct kinfo_proc *ps, bool e
void DarwinProcess_setFromLibprocPidinfo(DarwinProcess *proc, DarwinProcessList *dpl) {
struct proc_taskinfo pti;
- if(sizeof(pti) == proc_pidinfo(proc->super.pid, PROC_PIDTASKINFO, 0, &pti, sizeof(pti))) {
- if(0 != proc->utime || 0 != proc->stime) {
+ if (sizeof(pti) == proc_pidinfo(proc->super.pid, PROC_PIDTASKINFO, 0, &pti, sizeof(pti))) {
+ if (0 != proc->utime || 0 != proc->stime) {
uint64_t diff = (pti.pti_total_system - proc->stime)
+ (pti.pti_total_user - proc->utime);
diff --git a/darwin/DarwinProcessList.c b/darwin/DarwinProcessList.c
index bae8e222..59ec9d31 100644
--- a/darwin/DarwinProcessList.c
+++ b/darwin/DarwinProcessList.c
@@ -57,14 +57,14 @@ int CompareKernelVersion(short int major, short int minor, short int component)
void ProcessList_getHostInfo(host_basic_info_data_t *p) {
mach_msg_type_number_t info_size = HOST_BASIC_INFO_COUNT;
- if(0 != host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)p, &info_size)) {
+ if (0 != host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)p, &info_size)) {
CRT_fatalError("Unable to retrieve host info\n");
}
}
void ProcessList_freeCPULoadInfo(processor_cpu_load_info_t *p) {
- if(NULL != p && NULL != *p) {
- if(0 != munmap(*p, vm_page_size)) {
+ if (NULL != p && NULL != *p) {
+ if (0 != munmap(*p, vm_page_size)) {
CRT_fatalError("Unable to free old CPU load information\n");
}
*p = NULL;
@@ -76,7 +76,7 @@ unsigned ProcessList_allocateCPULoadInfo(processor_cpu_load_info_t *p) {
unsigned cpu_count;
// TODO Improving the accuracy of the load counts woule help a lot.
- if(0 != host_processor_info(mach_host_self(), PROCESSOR_CPU_LOAD_INFO, &cpu_count, (processor_info_array_t *)p, &info_size)) {
+ if (0 != host_processor_info(mach_host_self(), PROCESSOR_CPU_LOAD_INFO, &cpu_count, (processor_info_array_t *)p, &info_size)) {
CRT_fatalError("Unable to retrieve CPU info\n");
}
@@ -200,7 +200,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
super->totalTasks += 1;
- if(!preExisting) {
+ if (!preExisting) {
proc->super.user = UsersTable_getRef(super->usersTable, proc->super.st_uid);
ProcessList_add(super, &proc->super);
diff --git a/darwin/Platform.c b/darwin/Platform.c
index 17be92b2..a7adaeee 100644
--- a/darwin/Platform.c
+++ b/darwin/Platform.c
@@ -149,7 +149,7 @@ int Platform_getUptime() {
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
double results[3];
- if(3 == getloadavg(results, 3)) {
+ if (3 == getloadavg(results, 3)) {
*one = results[0];
*five = results[1];
*fifteen = results[2];
diff --git a/dragonflybsd/DragonFlyBSDProcessList.c b/dragonflybsd/DragonFlyBSDProcessList.c
index 8c441de5..2fe20dae 100644
--- a/dragonflybsd/DragonFlyBSDProcessList.c
+++ b/dragonflybsd/DragonFlyBSDProcessList.c
@@ -417,7 +417,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
dfp->jname = DragonFlyBSDProcessList_readJailName(dfpl, kproc->kp_jailid);
} else {
proc->processor = kproc->kp_lwp.kl_cpuid;
- if(dfp->jid != kproc->kp_jailid) { // process can enter jail anytime
+ if (dfp->jid != kproc->kp_jailid) { // process can enter jail anytime
dfp->jid = kproc->kp_jailid;
free(dfp->jname);
dfp->jname = DragonFlyBSDProcessList_readJailName(dfpl, kproc->kp_jailid);
@@ -425,7 +425,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
if (proc->ppid != kproc->kp_ppid) { // if there are reapers in the system, process can get reparented anytime
proc->ppid = kproc->kp_ppid;
}
- if(proc->st_uid != kproc->kp_uid) { // some processes change users (eg. to lower privs)
+ if (proc->st_uid != kproc->kp_uid) { // some processes change users (eg. to lower privs)
proc->st_uid = kproc->kp_uid;
proc->user = UsersTable_getRef(super->usersTable, proc->st_uid);
}
diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c
index df06546c..bfa046b8 100644
--- a/freebsd/FreeBSDProcessList.c
+++ b/freebsd/FreeBSDProcessList.c
@@ -502,7 +502,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
proc->comm = FreeBSDProcessList_readProcessName(fpl->kd, kproc, &proc->basenameOffset);
fp->jname = FreeBSDProcessList_readJailName(kproc);
} else {
- if(fp->jid != kproc->ki_jid) {
+ if (fp->jid != kproc->ki_jid) {
// process can enter jail anytime
fp->jid = kproc->ki_jid;
free(fp->jname);
@@ -512,7 +512,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
// if there are reapers in the system, process can get reparented anytime
proc->ppid = kproc->ki_ppid;
}
- if(proc->st_uid != kproc->ki_uid) {
+ if (proc->st_uid != kproc->ki_uid) {
// some processes change users (eg. to lower privs)
proc->st_uid = kproc->ki_uid;
proc->user = UsersTable_getRef(super->usersTable, proc->st_uid);
diff --git a/htop.c b/htop.c
index f5c35929..2e11a949 100644
--- a/htop.c
+++ b/htop.c
@@ -186,7 +186,7 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
char* saveptr;
char* pid = strtok_r(argCopy, ",", &saveptr);
- if(!flags.pidMatchList) {
+ if (!flags.pidMatchList) {
flags.pidMatchList = Hashtable_new(8, false);
}
@@ -243,7 +243,7 @@ static void setCommFilter(State* state, char** commFilter) {
int main(int argc, char** argv) {
char *lc_ctype = getenv("LC_CTYPE");
- if(lc_ctype != NULL)
+ if (lc_ctype != NULL)
setlocale(LC_CTYPE, lc_ctype);
else if ((lc_ctype = getenv("LC_ALL")))
setlocale(LC_CTYPE, lc_ctype);
@@ -334,7 +334,7 @@ int main(int argc, char** argv) {
UsersTable_delete(ut);
Settings_delete(settings);
- if(flags.pidMatchList) {
+ if (flags.pidMatchList) {
Hashtable_delete(flags.pidMatchList);
}
return 0;
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index d607a71b..94b43896 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -244,11 +244,11 @@ void LinuxProcess_writeField(const Process* this, RichString* str, ProcessField
case IO_WRITE_RATE: Process_outputRate(str, buffer, n, lp->io_rate_write_bps, coloring); return;
case IO_RATE: {
double totalRate = NAN;
- if(!isnan(lp->io_rate_read_bps) && !isnan(lp->io_rate_write_bps))
+ if (!isnan(lp->io_rate_read_bps) && !isnan(lp->io_rate_write_bps))
totalRate = lp->io_rate_read_bps + lp->io_rate_write_bps;
- else if(!isnan(lp->io_rate_read_bps))
+ else if (!isnan(lp->io_rate_read_bps))
totalRate = lp->io_rate_read_bps;
- else if(!isnan(lp->io_rate_write_bps))
+ else if (!isnan(lp->io_rate_write_bps))
totalRate = lp->io_rate_write_bps;
else
totalRate = NAN;
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index e500f9dc..86dd4c75 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -208,7 +208,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
// Check for /proc/*/smaps_rollup availability (improves smaps parsing speed, Linux 4.14+)
FILE* file = fopen(PROCDIR "/self/smaps_rollup", "r");
- if(file != NULL) {
+ if (file != NULL) {
this->haveSmapsRollup = true;
fclose(file);
} else {
@@ -271,10 +271,10 @@ void ProcessList_delete(ProcessList* pl) {
static inline unsigned long long LinuxProcess_adjustTime(unsigned long long t) {
static double jiffy = NAN;
- if(isnan(jiffy)) {
+ if (isnan(jiffy)) {
errno = 0;
long sc_jiffy = sysconf(_SC_CLK_TCK);
- if(errno || -1 == sc_jiffy) {
+ if (errno || -1 == sc_jiffy) {
jiffy = NAN;
return t; // Assume 100Hz clock
}
@@ -481,7 +481,7 @@ static bool LinuxProcessList_readSmapsFile(LinuxProcess* process, const char* di
char buffer[256];
- if(haveSmapsRollup) {// only available in Linux 4.14+
+ if (haveSmapsRollup) {// only available in Linux 4.14+
xSnprintf(buffer, sizeof(buffer), "%s/%s/smaps_rollup", dirname, name);
} else {
xSnprintf(buffer, sizeof(buffer), "%s/%s/smaps", dirname, name);
@@ -496,10 +496,10 @@ static bool LinuxProcessList_readSmapsFile(LinuxProcess* process, const char* di
process->m_psswp = 0;
while (fgets(buffer, sizeof(buffer), f)) {
- if(!strchr(buffer, '\n')) {
+ if (!strchr(buffer, '\n')) {
// Partial line, skip to end of this line
while (fgets(buffer, sizeof(buffer), f)) {
- if(strchr(buffer, '\n')) {
+ if (strchr(buffer, '\n')) {
break;
}
}
@@ -543,10 +543,10 @@ static void LinuxProcessList_readOpenVZData(LinuxProcess* process, const char* d
bool foundVPid = false;
char linebuf[256];
while (fgets(linebuf, sizeof(linebuf), file) != NULL) {
- if(strchr(linebuf, '\n') == NULL) {
+ if (strchr(linebuf, '\n') == NULL) {
// Partial line, skip to end of this line
while (fgets(linebuf, sizeof(linebuf), file) != NULL) {
- if(strchr(linebuf, '\n') != NULL) {
+ if (strchr(linebuf, '\n') != NULL) {
break;
}
}
@@ -554,14 +554,14 @@ static void LinuxProcessList_readOpenVZData(LinuxProcess* process, const char* d
}
char* name_value_sep = strchr(linebuf, ':');
- if(name_value_sep == NULL) {
+ if (name_value_sep == NULL) {
continue;
}
int field;
- if(0 == strncasecmp(linebuf, "envID", name_value_sep - linebuf)) {
+ if (0 == strncasecmp(linebuf, "envID", name_value_sep - linebuf)) {
field = 1;
- } else if(0 == strncasecmp(linebuf, "VPid", name_value_sep - linebuf)) {
+ } else if (0 == strncasecmp(linebuf, "VPid", name_value_sep - linebuf)) {
field = 2;
} else {
continue;
@@ -577,7 +577,7 @@ static void LinuxProcessList_readOpenVZData(LinuxProcess* process, const char* d
value_end++;
}
- if(name_value_sep == value_end) {
+ if (name_value_sep == value_end) {
continue;
}
@@ -586,7 +586,7 @@ static void LinuxProcessList_readOpenVZData(LinuxProcess* process, const char* d
switch(field) {
case 1:
foundEnvID = true;
- if(!String_eq(name_value_sep, process->ctid ? process->ctid : "")) {
+ if (!String_eq(name_value_sep, process->ctid ? process->ctid : "")) {
free(process->ctid);
process->ctid = xStrdup(name_value_sep);
}
@@ -603,12 +603,12 @@ static void LinuxProcessList_readOpenVZData(LinuxProcess* process, const char* d
fclose(file);
- if(!foundEnvID) {
+ if (!foundEnvID) {
free(process->ctid);
process->ctid = NULL;
}
- if(!foundVPid) {
+ if (!foundVPid) {
process->vpid = process->super.pid;
}
}
@@ -1010,7 +1010,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
if (isnan(proc->percent_cpu)) proc->percent_cpu = 0.0;
proc->percent_mem = (proc->m_resident * CRT_pageSizeKB) / (double)(pl->totalMem) * 100.0;
- if(!preExisting) {
+ if (!preExisting) {
if (! LinuxProcessList_statProcessDir(proc, dirname, name))
goto errorReadingProcess;
diff --git a/linux/Platform.c b/linux/Platform.c
index f7a768c9..674952b0 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -272,7 +272,7 @@ char* Platform_getProcessEnv(pid_t pid) {
char procname[128];
xSnprintf(procname, sizeof(procname), PROCDIR "/%d/environ", pid);
FILE* fd = fopen(procname, "r");
- if(!fd)
+ if (!fd)
return NULL;
char *env = NULL;
diff --git a/linux/ZramMeter.c b/linux/ZramMeter.c
index f855488e..30d78eaa 100644
--- a/linux/ZramMeter.c
+++ b/linux/ZramMeter.c
@@ -19,18 +19,18 @@ static void ZramMeter_updateValues(Meter* this, char* buffer, int size) {
written = Meter_humanUnit(buffer, this->values[0], size);
buffer += written;
size -= written;
- if(size <= 0) {
+ if (size <= 0) {
return;
}
*buffer++ = '(';
size--;
- if(size <= 0) {
+ if (size <= 0) {
return;
}
written = Meter_humanUnit(buffer, this->values[1], size);
buffer += written;
size -= written;
- if(size <= 0) {
+ if (size <= 0) {
return;
}
*buffer++ = ')';
diff --git a/solaris/SolarisProcessList.c b/solaris/SolarisProcessList.c
index 2af82aab..e219d1ee 100644
--- a/solaris/SolarisProcessList.c
+++ b/solaris/SolarisProcessList.c
@@ -322,7 +322,7 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
// See note above (in common section) about this BINARY FRACTION
proc->percent_cpu = ((uint16_t)_psinfo->pr_pctcpu/(double)32768)*(double)100.0;
proc->time = _psinfo->pr_time.tv_sec;
- if(!preExisting) { // Tasks done only for NEW processes
+ if (!preExisting) { // Tasks done only for NEW processes
sproc->is_lwp = false;
proc->starttime_ctime = _psinfo->pr_start.tv_sec;
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy