summaryrefslogtreecommitdiffstats
path: root/darwin
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 /darwin
parent0a51eae11fdd741c295d7b0390c6d9dbf04468d8 (diff)
Spacing after keywords (if)
Diffstat (limited to 'darwin')
-rw-r--r--darwin/Battery.c10
-rw-r--r--darwin/DarwinProcess.c6
-rw-r--r--darwin/DarwinProcessList.c10
-rw-r--r--darwin/Platform.c2
4 files changed, 14 insertions, 14 deletions
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];

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