summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Lisov <dennis.lissov@gmail.com>2022-05-05 10:48:31 +0300
committerBenBE <BenBE@geshi.org>2022-05-05 10:00:34 +0200
commit4b8b61fe183cd6d8b5e6e01127742b0c24884ac4 (patch)
treed1262af5748015d637639d081ada8c109a37af96
parentfae7ff6f030d65bbb656028941c9254b214533a4 (diff)
ProcessList.h: remove `ProcessList_remove`
As the "highlight dying processes" option has to keep processes in the list when they disappear, no code except the cleanup loop in `ProcessList_scan` should remove processes from the list directly. Remove the export to prevent random process removals from being reintroduced accidentally.
-rw-r--r--ProcessList.c11
-rw-r--r--ProcessList.h2
2 files changed, 1 insertions, 12 deletions
diff --git a/ProcessList.c b/ProcessList.c
index fc896add..f71619f6 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -176,6 +176,7 @@ void ProcessList_add(ProcessList* this, Process* p) {
// ProcessList_removeIndex removes Process p from the list's map and soft deletes
// it from its vector. Vector_compact *must* be called once the caller is done
// removing items.
+// Should only be called from ProcessList_scan to avoid breaking dying process highlighting.
static void ProcessList_removeIndex(ProcessList* this, const Process* p, int idx) {
pid_t pid = p->pid;
@@ -194,16 +195,6 @@ static void ProcessList_removeIndex(ProcessList* this, const Process* p, int idx
assert(Vector_countEquals(this->processes, Hashtable_count(this->processTable)));
}
-void ProcessList_remove(ProcessList* this, const Process* p) {
- int idx = Vector_indexOf(this->processes, p, Process_pidEqualCompare);
- assert(0 <= idx && idx < Vector_size(this->processes));
- if (idx >= 0) {
- ProcessList_removeIndex(this, p, idx);
- // This function is public so must not require callers to compact the Vector
- Vector_compact(this->processes);
- }
-}
-
static void ProcessList_buildTreeBranch(ProcessList* this, pid_t pid, int level, int indent, bool show) {
// On OpenBSD the kernel thread 'swapper' has pid 0.
// Do not treat it as root of any tree.
diff --git a/ProcessList.h b/ProcessList.h
index c4200380..419dea89 100644
--- a/ProcessList.h
+++ b/ProcessList.h
@@ -106,8 +106,6 @@ void ProcessList_printHeader(const ProcessList* this, RichString* header);
void ProcessList_add(ProcessList* this, Process* p);
-void ProcessList_remove(ProcessList* this, const Process* p);
-
void ProcessList_updateDisplayList(ProcessList* this);
ProcessField ProcessList_keyAt(const ProcessList* this, int at);

© 2014-2022 Faster IT GmbH | imprint | privacy policy