From e7f447b6a3473a572d3e6c191128f1796477860d Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Tue, 4 Apr 2023 16:24:37 +1000 Subject: Refactor and consolidate dynamic meters/columns pointers This removes the duplication of dynamic meter/column hashtable pointers that has come in between the Settings and ProcessList structures - only one copy of these is needed. With the future planned dynamic screens feature adding another pointer, let us first clean this up before any further duplication happens. --- pcp/PCPDynamicColumn.c | 2 +- pcp/PCPProcessList.c | 4 ++-- pcp/PCPProcessList.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'pcp') diff --git a/pcp/PCPDynamicColumn.c b/pcp/PCPDynamicColumn.c index 33c6d72a..8c35fc10 100644 --- a/pcp/PCPDynamicColumn.c +++ b/pcp/PCPDynamicColumn.c @@ -304,7 +304,7 @@ void PCPDynamicColumn_writeField(PCPDynamicColumn* this, const Process* proc, Ri } int PCPDynamicColumn_compareByKey(const PCPProcess* p1, const PCPProcess* p2, ProcessField key) { - const PCPDynamicColumn* column = Hashtable_get(p1->super.processList->dynamicColumns, key); + const PCPDynamicColumn* column = Hashtable_get(p1->super.settings->dynamicColumns, key); if (!column) return -1; diff --git a/pcp/PCPProcessList.c b/pcp/PCPProcessList.c index f893689a..8147beeb 100644 --- a/pcp/PCPProcessList.c +++ b/pcp/PCPProcessList.c @@ -63,11 +63,11 @@ static char* setUser(UsersTable* this, unsigned int uid, int pid, int offset) { return name; } -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId) { +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) { PCPProcessList* this = xCalloc(1, sizeof(PCPProcessList)); ProcessList* super = &(this->super); - ProcessList_init(super, Class(PCPProcess), usersTable, dynamicMeters, dynamicColumns, pidMatchList, userId); + ProcessList_init(super, Class(PCPProcess), usersTable, pidMatchList, userId); struct timeval timestamp; gettimeofday(×tamp, NULL); diff --git a/pcp/PCPProcessList.h b/pcp/PCPProcessList.h index a3a7372a..90e9939c 100644 --- a/pcp/PCPProcessList.h +++ b/pcp/PCPProcessList.h @@ -63,7 +63,7 @@ typedef struct PCPProcessList_ { ZfsArcStats zfs; } PCPProcessList; -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId); +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId); void ProcessList_delete(ProcessList* pl); -- cgit v1.2.3