From b23f8235e28472c410dcb00893e0e3d403892673 Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Sat, 31 Oct 2020 22:14:27 +0100 Subject: Whitespace and indentation issues --- dragonflybsd/Platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dragonflybsd/Platform.c') diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c index 5b81c610..6f8c2023 100644 --- a/dragonflybsd/Platform.c +++ b/dragonflybsd/Platform.c @@ -154,10 +154,10 @@ double Platform_setCPUValues(Meter* this, int cpu) { const CPUData* cpuData; if (cpus == 1) { - // single CPU box has everything in fpl->cpus[0] - cpuData = &(fpl->cpus[0]); + // single CPU box has everything in fpl->cpus[0] + cpuData = &(fpl->cpus[0]); } else { - cpuData = &(fpl->cpus[cpu]); + cpuData = &(fpl->cpus[cpu]); } double percent; -- cgit v1.2.3 From 61e14d4bb25268593019e6df3eb02264b4ac8e0e Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Sat, 31 Oct 2020 23:28:02 +0100 Subject: Spacing around operators --- dragonflybsd/Platform.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'dragonflybsd/Platform.c') diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c index 6f8c2023..5e9fe335 100644 --- a/dragonflybsd/Platform.c +++ b/dragonflybsd/Platform.c @@ -169,11 +169,11 @@ double Platform_setCPUValues(Meter* this, int cpu) { v[CPU_METER_KERNEL] = cpuData->systemPercent; v[CPU_METER_IRQ] = cpuData->irqPercent; this->curItems = 4; - percent = v[0]+v[1]+v[2]+v[3]; + percent = v[0] + v[1] + v[2] + v[3]; } else { v[2] = cpuData->systemAllPercent; this->curItems = 3; - percent = v[0]+v[1]+v[2]; + percent = v[0] + v[1] + v[2]; } percent = CLAMP(percent, 0.0, 100.0); @@ -212,10 +212,10 @@ bool Platform_getDiskIO(DiskIOData* data) { return false; } -bool Platform_getNetworkIO(unsigned long int *bytesReceived, - unsigned long int *packetsReceived, - unsigned long int *bytesTransmitted, - unsigned long int *packetsTransmitted) { +bool Platform_getNetworkIO(unsigned long int* bytesReceived, + unsigned long int* packetsReceived, + unsigned long int* bytesTransmitted, + unsigned long int* packetsTransmitted) { // TODO *bytesReceived = 0; *packetsReceived = 0; -- cgit v1.2.3 From 45869513bfebba80cc2ab42e4218f68b34b1e6ac Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Sun, 1 Nov 2020 01:09:51 +0100 Subject: Embracing branches --- dragonflybsd/Platform.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'dragonflybsd/Platform.c') diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c index 5e9fe335..5f9f6373 100644 --- a/dragonflybsd/Platform.c +++ b/dragonflybsd/Platform.c @@ -177,7 +177,9 @@ double Platform_setCPUValues(Meter* this, int cpu) { } percent = CLAMP(percent, 0.0, 100.0); - if (isnan(percent)) percent = 0.0; + if (isnan(percent)) { + percent = 0.0; + } v[CPU_METER_FREQUENCY] = NAN; -- cgit v1.2.3 From 0e922d4085f0285cf353323fd5a96edae604d5da Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Mon, 2 Nov 2020 21:36:20 +0100 Subject: Integrate NAN check into assignment The check for NAN is kept to avoid relying on implementation details of the CLAMP macro/function --- dragonflybsd/Platform.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'dragonflybsd/Platform.c') diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c index 5f9f6373..604994c4 100644 --- a/dragonflybsd/Platform.c +++ b/dragonflybsd/Platform.c @@ -176,10 +176,7 @@ double Platform_setCPUValues(Meter* this, int cpu) { percent = v[0] + v[1] + v[2]; } - percent = CLAMP(percent, 0.0, 100.0); - if (isnan(percent)) { - percent = 0.0; - } + percent = isnan(percent) ? 0.0 : CLAMP(percent, 0.0, 100.0); v[CPU_METER_FREQUENCY] = NAN; -- cgit v1.2.3