From 0a51eae11fdd741c295d7b0390c6d9dbf04468d8 Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Sat, 31 Oct 2020 20:39:01 +0100 Subject: Spacing after keywords (while) --- darwin/Platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'darwin/Platform.c') diff --git a/darwin/Platform.c b/darwin/Platform.c index b1f9283d..17be92b2 100644 --- a/darwin/Platform.c +++ b/darwin/Platform.c @@ -286,7 +286,7 @@ char* Platform_getProcessEnv(pid_t pid) { p = strchr(p, 0)+1; // skip padding - while(!*p && p < endp) + while (!*p && p < endp) ++p; // skip argv @@ -294,7 +294,7 @@ char* Platform_getProcessEnv(pid_t pid) { ; // skip padding - while(!*p && p < endp) + while (!*p && p < endp) ++p; size_t size = endp - p; -- cgit v1.2.3 From 374edb9ed5e9d5fa24cfe358258d82f69d9d430d Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Sat, 31 Oct 2020 20:52:20 +0100 Subject: Spacing after keywords (if) --- darwin/Platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'darwin/Platform.c') 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]; -- cgit v1.2.3 From adf797c295db2e0b24cc49efc7af70dafc3f10c2 Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Sat, 31 Oct 2020 20:55:36 +0100 Subject: Spacing after keywords (for) --- darwin/Platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'darwin/Platform.c') diff --git a/darwin/Platform.c b/darwin/Platform.c index a7adaeee..9086c6de 100644 --- a/darwin/Platform.c +++ b/darwin/Platform.c @@ -206,7 +206,7 @@ double Platform_setCPUValues(Meter* mtr, int cpu) { double total = 0; /* Take the sums */ - for(size_t i = 0; i < CPU_STATE_MAX; ++i) { + for (size_t i = 0; i < CPU_STATE_MAX; ++i) { total += (double)curr->cpu_ticks[i] - (double)prev->cpu_ticks[i]; } -- cgit v1.2.3 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 --- darwin/Platform.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'darwin/Platform.c') diff --git a/darwin/Platform.c b/darwin/Platform.c index 9086c6de..c5a22da4 100644 --- a/darwin/Platform.c +++ b/darwin/Platform.c @@ -211,11 +211,11 @@ double Platform_setCPUValues(Meter* mtr, int cpu) { } mtr->values[CPU_METER_NICE] - = ((double)curr->cpu_ticks[CPU_STATE_NICE] - (double)prev->cpu_ticks[CPU_STATE_NICE])* 100.0 / total; + = ((double)curr->cpu_ticks[CPU_STATE_NICE] - (double)prev->cpu_ticks[CPU_STATE_NICE]) * 100.0 / total; mtr->values[CPU_METER_NORMAL] - = ((double)curr->cpu_ticks[CPU_STATE_USER] - (double)prev->cpu_ticks[CPU_STATE_USER])* 100.0 / total; + = ((double)curr->cpu_ticks[CPU_STATE_USER] - (double)prev->cpu_ticks[CPU_STATE_USER]) * 100.0 / total; mtr->values[CPU_METER_KERNEL] - = ((double)curr->cpu_ticks[CPU_STATE_SYSTEM] - (double)prev->cpu_ticks[CPU_STATE_SYSTEM])* 100.0 / total; + = ((double)curr->cpu_ticks[CPU_STATE_SYSTEM] - (double)prev->cpu_ticks[CPU_STATE_SYSTEM]) * 100.0 / total; mtr->curItems = 3; @@ -239,13 +239,13 @@ void Platform_setMemoryValues(Meter* mtr) { } void Platform_setSwapValues(Meter* mtr) { - int mib[2] = {CTL_VM, VM_SWAPUSAGE}; - struct xsw_usage swapused; - size_t swlen = sizeof(swapused); - sysctl(mib, 2, &swapused, &swlen, NULL, 0); + int mib[2] = {CTL_VM, VM_SWAPUSAGE}; + struct xsw_usage swapused; + size_t swlen = sizeof(swapused); + sysctl(mib, 2, &swapused, &swlen, NULL, 0); - mtr->total = swapused.xsu_total / 1024; - mtr->values[0] = swapused.xsu_used / 1024; + mtr->total = swapused.xsu_total / 1024; + mtr->values[0] = swapused.xsu_used / 1024; } void Platform_setZfsArcValues(Meter* this) { -- 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 --- darwin/Platform.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'darwin/Platform.c') diff --git a/darwin/Platform.c b/darwin/Platform.c index c5a22da4..e48fbbd3 100644 --- a/darwin/Platform.c +++ b/darwin/Platform.c @@ -176,7 +176,7 @@ ProcessPidColumn Process_pidColumns[] = { }; static double Platform_setCPUAverageValues(Meter* mtr) { - const ProcessList *dpl = mtr->pl; + const ProcessList* dpl = mtr->pl; int cpus = dpl->cpuCount; double sumNice = 0.0; double sumNormal = 0.0; @@ -200,9 +200,9 @@ double Platform_setCPUValues(Meter* mtr, int cpu) { return Platform_setCPUAverageValues(mtr); } - const DarwinProcessList *dpl = (const DarwinProcessList *)mtr->pl; - const processor_cpu_load_info_t prev = &dpl->prev_load[cpu-1]; - const processor_cpu_load_info_t curr = &dpl->curr_load[cpu-1]; + const DarwinProcessList* dpl = (const DarwinProcessList*)mtr->pl; + const processor_cpu_load_info_t prev = &dpl->prev_load[cpu - 1]; + const processor_cpu_load_info_t curr = &dpl->curr_load[cpu - 1]; double total = 0; /* Take the sums */ @@ -228,7 +228,7 @@ double Platform_setCPUValues(Meter* mtr, int cpu) { } void Platform_setMemoryValues(Meter* mtr) { - const DarwinProcessList *dpl = (const DarwinProcessList *)mtr->pl; + const DarwinProcessList* dpl = (const DarwinProcessList*)mtr->pl; const struct vm_statistics* vm = &dpl->vm_stats; double page_K = (double)vm_page_size / (double)1024; @@ -283,14 +283,14 @@ char* Platform_getProcessEnv(pid_t pid) { p += sizeof(int); // skip exe - p = strchr(p, 0)+1; + p = strchr(p, 0) + 1; // skip padding while (!*p && p < endp) ++p; // skip argv - for (; argc-- && p < endp; p = strrchr(p, 0)+1) + for (; argc-- && p < endp; p = strrchr(p, 0) + 1) ; // skip padding @@ -298,10 +298,10 @@ char* Platform_getProcessEnv(pid_t pid) { ++p; size_t size = endp - p; - env = xMalloc(size+2); + env = xMalloc(size + 2); memcpy(env, p, size); env[size] = 0; - env[size+1] = 0; + env[size + 1] = 0; } } free(buf); @@ -317,10 +317,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