diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-02-17 17:38:35 +0100 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2021-03-19 23:30:54 +0100 |
commit | a11d01568c5e7bc5570fd48fa0703d837c4bcd84 (patch) | |
tree | 3e298e81123789ed6ae288e5bd32e91ebfb3ff01 /openbsd | |
parent | 53bcc5cbffbdd69e0e08bd33c5e357dd5b753456 (diff) |
Use unsigned types for CPU counts and associated variables
Diffstat (limited to 'openbsd')
-rw-r--r-- | openbsd/OpenBSDProcessList.c | 4 | ||||
-rw-r--r-- | openbsd/Platform.c | 2 | ||||
-rw-r--r-- | openbsd/Platform.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c index ff5c9278..0a0c0a5f 100644 --- a/openbsd/OpenBSDProcessList.c +++ b/openbsd/OpenBSDProcessList.c @@ -63,7 +63,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui CRT_fatalError("pagesize sysconf call failed"); pageSizeKB = pageSize / ONE_K; - for (int i = 0; i <= pl->cpuCount; i++) { + for (unsigned int i = 0; i <= pl->cpuCount; i++) { CPUData* d = opl->cpus + i; d->totalTime = 1; d->totalPeriod = 1; @@ -313,7 +313,7 @@ static void OpenBSDProcessList_scanCPUTime(OpenBSDProcessList* this) { u_int64_t kernelTimes[CPUSTATES] = {0}; u_int64_t avg[CPUSTATES] = {0}; - for (int i = 0; i < this->super.cpuCount; i++) { + for (unsigned int i = 0; i < this->super.cpuCount; i++) { getKernelCPUTimes(i, kernelTimes); CPUData* cpu = this->cpus + i + 1; kernelCPUTimesToHtop(kernelTimes, cpu); diff --git a/openbsd/Platform.c b/openbsd/Platform.c index c57e6cc3..fee4b71b 100644 --- a/openbsd/Platform.c +++ b/openbsd/Platform.c @@ -166,7 +166,7 @@ int Platform_getMaxPid() { return 99999; } -double Platform_setCPUValues(Meter* this, int cpu) { +double Platform_setCPUValues(Meter* this, unsigned int cpu) { const OpenBSDProcessList* pl = (const OpenBSDProcessList*) this->pl; const CPUData* cpuData = &(pl->cpus[cpu]); double total = cpuData->totalPeriod == 0 ? 1 : cpuData->totalPeriod; diff --git a/openbsd/Platform.h b/openbsd/Platform.h index bdd44a50..211b92f3 100644 --- a/openbsd/Platform.h +++ b/openbsd/Platform.h @@ -44,7 +44,7 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen); int Platform_getMaxPid(void); -double Platform_setCPUValues(Meter* this, int cpu); +double Platform_setCPUValues(Meter* this, unsigned int cpu); void Platform_setMemoryValues(Meter* this); |