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/Battery.c | 10 ++++++---- dragonflybsd/DragonFlyBSDProcess.c | 5 +++-- dragonflybsd/DragonFlyBSDProcessList.c | 14 ++++++++++---- dragonflybsd/Platform.c | 4 +++- 4 files changed, 22 insertions(+), 11 deletions(-) (limited to 'dragonflybsd') diff --git a/dragonflybsd/Battery.c b/dragonflybsd/Battery.c index 4bae3aa5..1a690ee3 100644 --- a/dragonflybsd/Battery.c +++ b/dragonflybsd/Battery.c @@ -14,15 +14,17 @@ in the source distribution for its full text. void Battery_getData(double* level, ACPresence* isOnAC) { int life; size_t life_len = sizeof(life); - if (sysctlbyname("hw.acpi.battery.life", &life, &life_len, NULL, 0) == -1) + if (sysctlbyname("hw.acpi.battery.life", &life, &life_len, NULL, 0) == -1) { *level = NAN; - else + } else { *level = life; + } int acline; size_t acline_len = sizeof(acline); - if (sysctlbyname("hw.acpi.acline", &acline, &acline_len, NULL, 0) == -1) + if (sysctlbyname("hw.acpi.acline", &acline, &acline_len, NULL, 0) == -1) { *isOnAC = AC_ERROR; - else + } else { *isOnAC = acline == 0 ? AC_ABSENT : AC_PRESENT; + } } diff --git a/dragonflybsd/DragonFlyBSDProcess.c b/dragonflybsd/DragonFlyBSDProcess.c index 457a488a..bd209327 100644 --- a/dragonflybsd/DragonFlyBSDProcess.c +++ b/dragonflybsd/DragonFlyBSDProcess.c @@ -131,8 +131,9 @@ long DragonFlyBSDProcess_compare(const void* v1, const void* v2) { bool Process_isThread(const Process* this) { const DragonFlyBSDProcess* fp = (const DragonFlyBSDProcess*) this; - if (fp->kernel == 1 ) + if (fp->kernel == 1 ) { return 1; - else + } else { return (Process_isUserlandThread(this)); + } } diff --git a/dragonflybsd/DragonFlyBSDProcessList.c b/dragonflybsd/DragonFlyBSDProcessList.c index d3acf73d..b66dc0e8 100644 --- a/dragonflybsd/DragonFlyBSDProcessList.c +++ b/dragonflybsd/DragonFlyBSDProcessList.c @@ -123,7 +123,9 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui void ProcessList_delete(ProcessList* this) { const DragonFlyBSDProcessList* dfpl = (DragonFlyBSDProcessList*) this; - if (dfpl->kd) kvm_close(dfpl->kd); + if (dfpl->kd) { + kvm_close(dfpl->kd); + } if (dfpl->jails) { Hashtable_delete(dfpl->jails); @@ -199,7 +201,9 @@ static inline void DragonFlyBSDProcessList_scanCPUTime(ProcessList* pl) { // totals total_d = total_n - total_o; - if (total_d < 1 ) total_d = 1; + if (total_d < 1 ) { + total_d = 1; + } // save current state as old and calc percentages for (int s = 0; s < CPUSTATES; ++s) { @@ -331,8 +335,9 @@ retry: int jailid; char* str_hostname; nextpos = strchr(curpos, '\n'); - if (nextpos) + if (nextpos) { *nextpos++ = 0; + } jailid = atoi(strtok(curpos, " ")); str_hostname = strtok(NULL, " "); @@ -372,8 +377,9 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) { DragonFlyBSDProcessList_scanJails(dfpl); // in pause mode only gather global data for meters (CPU/memory/...) - if (pauseProcessUpdate) + if (pauseProcessUpdate) { return; + } int count = 0; 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