mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Use unsigned types for CPU counts and associated variables
This commit is contained in:

committed by
Benny Baumann

parent
53bcc5cbff
commit
a11d01568c
12
CPUMeter.c
12
CPUMeter.c
@ -35,23 +35,23 @@ static const int CPUMeter_attributes[] = {
|
||||
};
|
||||
|
||||
typedef struct CPUMeterData_ {
|
||||
int cpus;
|
||||
unsigned int cpus;
|
||||
Meter** meters;
|
||||
} CPUMeterData;
|
||||
|
||||
static void CPUMeter_init(Meter* this) {
|
||||
int cpu = this->param;
|
||||
unsigned int cpu = this->param;
|
||||
if (cpu == 0) {
|
||||
Meter_setCaption(this, "Avg");
|
||||
} else if (this->pl->cpuCount > 1) {
|
||||
char caption[10];
|
||||
xSnprintf(caption, sizeof(caption), "%3d", Settings_cpuId(this->pl->settings, cpu - 1));
|
||||
xSnprintf(caption, sizeof(caption), "%3u", Settings_cpuId(this->pl->settings, cpu - 1));
|
||||
Meter_setCaption(this, caption);
|
||||
}
|
||||
}
|
||||
|
||||
static void CPUMeter_updateValues(Meter* this) {
|
||||
int cpu = this->param;
|
||||
unsigned int cpu = this->param;
|
||||
if (cpu > this->pl->cpuCount) {
|
||||
xSnprintf(this->txtBuffer, sizeof(this->txtBuffer), "absent");
|
||||
for (uint8_t i = 0; i < this->curItems; i++)
|
||||
@ -168,7 +168,7 @@ static void CPUMeter_display(const Object* cast, RichString* out) {
|
||||
|
||||
static void AllCPUsMeter_getRange(const Meter* this, int* start, int* count) {
|
||||
const CPUMeterData* data = this->meterData;
|
||||
int cpus = data->cpus;
|
||||
unsigned int cpus = data->cpus;
|
||||
switch(Meter_name(this)[0]) {
|
||||
default:
|
||||
case 'A': // All
|
||||
@ -196,7 +196,7 @@ static void AllCPUsMeter_updateValues(Meter* this) {
|
||||
}
|
||||
|
||||
static void CPUMeterCommonInit(Meter* this, int ncol) {
|
||||
int cpus = this->pl->cpuCount;
|
||||
unsigned int cpus = this->pl->cpuCount;
|
||||
CPUMeterData* data = this->meterData;
|
||||
if (!data) {
|
||||
data = this->meterData = xMalloc(sizeof(CPUMeterData));
|
||||
|
Reference in New Issue
Block a user