Embracing branches

This commit is contained in:
Benny Baumann
2020-11-01 01:09:51 +01:00
parent 61e14d4bb2
commit 45869513bf
46 changed files with 656 additions and 277 deletions

View File

@ -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;
}
}

View File

@ -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));
}
}

View File

@ -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;

View File

@ -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;