From 69f439eff387a6ecb52734e400b297a3c85f2285 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Tue, 21 Sep 2021 08:35:19 +0200 Subject: New upstream version 3.1.0 --- AffinityPanel.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'AffinityPanel.c') diff --git a/AffinityPanel.c b/AffinityPanel.c index a4d6361..d50d554 100644 --- a/AffinityPanel.c +++ b/AffinityPanel.c @@ -357,7 +357,7 @@ static const char* const AffinityPanelFunctions[] = { static const char* const AffinityPanelKeys[] = {"Enter", "Esc", "F1", "F2", "F3"}; static const int AffinityPanelEvents[] = {13, 27, KEY_F(1), KEY_F(2), KEY_F(3)}; -Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity, int* width) { +Panel* AffinityPanel_new(ProcessList* pl, const Affinity* affinity, int* width) { AffinityPanel* this = AllocThis(AffinityPanel); Panel* super = (Panel*) this; Panel_init(super, 1, 1, 1, 1, Class(MaskItem), false, FunctionBar_new(AffinityPanelFunctions, AffinityPanelKeys, AffinityPanelEvents)); @@ -382,8 +382,11 @@ Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity, int* width) { Panel_setHeader(super, "Use CPUs:"); - int curCpu = 0; - for (int i = 0; i < pl->cpuCount; i++) { + unsigned int curCpu = 0; + for (unsigned int i = 0; i < pl->existingCPUs; i++) { + if (!ProcessList_isCPUonline(this->pl, i)) + continue; + char number[16]; xSnprintf(number, 9, "CPU %d", Settings_cpuId(pl->settings, i)); unsigned cpu_width = 4 + strlen(number); @@ -418,17 +421,17 @@ Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity, int* width) { } Affinity* AffinityPanel_getAffinity(Panel* super, ProcessList* pl) { - AffinityPanel* this = (AffinityPanel*) super; + const AffinityPanel* this = (AffinityPanel*) super; Affinity* affinity = Affinity_new(pl); #ifdef HAVE_LIBHWLOC int i; hwloc_bitmap_foreach_begin(i, this->workCpuset) - Affinity_add(affinity, i); + Affinity_add(affinity, (unsigned)i); hwloc_bitmap_foreach_end(); #else - for (int i = 0; i < this->pl->cpuCount; i++) { - MaskItem* item = (MaskItem*)Vector_get(this->cpuids, i); + for (int i = 0; i < Vector_size(this->cpuids); i++) { + const MaskItem* item = (const MaskItem*)Vector_get(this->cpuids, i); if (item->value) { Affinity_add(affinity, item->cpu); } -- cgit v1.2.3