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 /freebsd/FreeBSDProcessList.c | |
parent | 53bcc5cbffbdd69e0e08bd33c5e357dd5b753456 (diff) |
Use unsigned types for CPU counts and associated variables
Diffstat (limited to 'freebsd/FreeBSDProcessList.c')
-rw-r--r-- | freebsd/FreeBSDProcessList.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c index 87f2e4d5..628956d1 100644 --- a/freebsd/FreeBSDProcessList.c +++ b/freebsd/FreeBSDProcessList.c @@ -175,8 +175,8 @@ void ProcessList_delete(ProcessList* this) { static inline void FreeBSDProcessList_scanCPU(ProcessList* pl) { const FreeBSDProcessList* fpl = (FreeBSDProcessList*) pl; - int cpus = pl->cpuCount; // actual CPU count - int maxcpu = cpus; // max iteration (in case we have average + smp) + unsigned int cpus = pl->cpuCount; // actual CPU count + unsigned int maxcpu = cpus; // max iteration (in case we have average + smp) int cp_times_offset; assert(cpus > 0); @@ -203,7 +203,7 @@ static inline void FreeBSDProcessList_scanCPU(ProcessList* pl) { sysctl(MIB_kern_cp_times, 2, fpl->cp_times_n, &sizeof_cp_time_array, NULL, 0); } - for (int i = 0; i < maxcpu; i++) { + for (unsigned int i = 0; i < maxcpu; i++) { if (cpus == 1) { // single CPU box cp_time_n = fpl->cp_time_n; @@ -287,7 +287,7 @@ static inline void FreeBSDProcessList_scanCPU(ProcessList* pl) { if (cpus > 1) { if (pl->settings->showCPUTemperature) { double maxTemp = NAN; - for (int i = 1; i < maxcpu; i++) { + for (unsigned int i = 1; i < maxcpu; i++) { const double coreTemp = fpl->cpus[i].temperature; if (isnan(coreTemp)) continue; @@ -302,7 +302,7 @@ static inline void FreeBSDProcessList_scanCPU(ProcessList* pl) { const double coreZeroFreq = fpl->cpus[1].frequency; double freqSum = coreZeroFreq; if (!isnan(coreZeroFreq)) { - for (int i = 2; i < maxcpu; i++) { + for (unsigned int i = 2; i < maxcpu; i++) { if (isnan(fpl->cpus[i].frequency)) fpl->cpus[i].frequency = coreZeroFreq; |