From 65357c8c46154de4e4eca14075bfe5523bb5fc14 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 7 Dec 2020 10:26:01 +0100 Subject: New upstream version 3.0.3 --- TasksMeter.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'TasksMeter.c') diff --git a/TasksMeter.c b/TasksMeter.c index 0b37ab2..7696988 100644 --- a/TasksMeter.c +++ b/TasksMeter.c @@ -1,22 +1,30 @@ /* htop - TasksMeter.c (C) 2004-2011 Hisham H. Muhammad -Released under the GNU GPL, see the COPYING file +Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ #include "TasksMeter.h" -#include "Platform.h" #include "CRT.h" +#include "Macros.h" +#include "Object.h" +#include "ProcessList.h" +#include "RichString.h" +#include "Settings.h" +#include "XUtils.h" -int TasksMeter_attributes[] = { - CPU_SYSTEM, PROCESS_THREAD, PROCESS, TASKS_RUNNING +static const int TasksMeter_attributes[] = { + CPU_SYSTEM, + PROCESS_THREAD, + PROCESS, + TASKS_RUNNING }; -static void TasksMeter_updateValues(Meter* this, char* buffer, int len) { - ProcessList* pl = this->pl; +static void TasksMeter_updateValues(Meter* this, char* buffer, size_t len) { + const ProcessList* pl = this->pl; this->values[0] = pl->kernelThreads; this->values[1] = pl->userlandThreads; this->values[2] = pl->totalTasks - pl->kernelThreads - pl->userlandThreads; @@ -24,15 +32,15 @@ static void TasksMeter_updateValues(Meter* this, char* buffer, int len) { if (pl->totalTasks > this->total) { this->total = pl->totalTasks; } - if (this->pl->settings->hideKernelThreads) { + if (pl->settings->hideKernelThreads) { this->values[0] = 0; } xSnprintf(buffer, len, "%d/%d", (int) this->values[3], (int) this->total); } -static void TasksMeter_display(Object* cast, RichString* out) { - Meter* this = (Meter*)cast; - Settings* settings = this->pl->settings; +static void TasksMeter_display(const Object* cast, RichString* out) { + const Meter* this = (const Meter*)cast; + const Settings* settings = this->pl->settings; char buffer[20]; int processes = (int) this->values[2]; @@ -63,7 +71,7 @@ static void TasksMeter_display(Object* cast, RichString* out) { RichString_append(out, CRT_colors[METER_TEXT], " running"); } -MeterClass TasksMeter_class = { +const MeterClass TasksMeter_class = { .super = { .extends = Class(Meter), .delete = Meter_delete, -- cgit v1.2.3