Skip to content

Commit

Permalink
Shorten CPUData ptr initialization stanza
Browse files Browse the repository at this point in the history
  • Loading branch information
BenBE committed May 9, 2023
1 parent 508d9ce commit e05a203
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions freebsd/Platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,9 @@ double Platform_setCPUValues(Meter* this, unsigned int cpu) {
const Machine* host = this->host;
const FreeBSDMachine* fhost = (const FreeBSDMachine*) host;
unsigned int cpus = host->activeCPUs;
const CPUData* cpuData;

if (cpus == 1) {
// single CPU box has everything in fhost->cpus[0]
cpuData = &(fhost->cpus[0]);
} else {
cpuData = &(fhost->cpus[cpu]);
}
// single CPU box has everything in fhost->cpus[0]
const CPUData* cpuData = cpus == 1 ? &fhost->cpus[0] : &fhost->cpus[cpu];

double percent;
double* v = this->values;
Expand Down

0 comments on commit e05a203

Please sign in to comment.